/* style.css - Main Application Styles */
:root {
    --primary: #8b5cf6; --accent: #d946ef; --glass: rgba(255, 255, 255, 0.75);
    --glass-border: rgba(255, 255, 255, 0.4); --text: #1e293b;
    --bg-gradient: linear-gradient(135deg, #eef2ff 0%, #fdf4ff 100%);
    --danger: #ef4444;
}
[data-theme="dark"] {
    --glass: rgba(15, 23, 42, 0.85); --glass-border: rgba(255, 255, 255, 0.1);
    --text: #f8fafc; --bg-gradient: linear-gradient(135deg, #0f172a 0%, #1e1b4b 100%);
}
/* Dark Mode Overrides */
[data-theme="dark"] body { background: linear-gradient(135deg, #0f172a, #1e1b4b, #0c1222); }
[data-theme="dark"] .landing-subtitle { color: #94a3b8; }
[data-theme="dark"] .btn-google { background: rgba(255,255,255,0.08); border-color: rgba(255,255,255,0.15); color: #e2e8f0; }
[data-theme="dark"] .btn-google:hover { background: rgba(255,255,255,0.15); }
[data-theme="dark"] .entry-preview-item { background: rgba(255,255,255,0.08); border-color: rgba(255,255,255,0.1); }
[data-theme="dark"] .onboarding-chip { background: rgba(255,255,255,0.08); border-color: rgba(255,255,255,0.1); }
[data-theme="dark"] .onboarding-chip:hover { background: rgba(255,255,255,0.15); border-color: #8b5cf6; }
[data-theme="dark"] .landing-badges span { background: rgba(255,255,255,0.1) !important; color: #c4b5fd !important; border-color: rgba(255,255,255,0.1) !important; }
[data-theme="dark"] .hero-announcement-pill { background: rgba(139, 92, 246, 0.2); border-color: rgba(139, 92, 246, 0.3); }
[data-theme="dark"] .preview-card { box-shadow: 0 8px 25px rgba(0,0,0,0.3); }
[data-theme="dark"] .tab-compact.active { background: rgba(255,255,255,0.12); }
[data-theme="dark"] .tgl-c.active { background: rgba(255,255,255,0.12); }
[data-theme="dark"] .toggle-btn.active { background: rgba(255,255,255,0.12); }
[data-theme="dark"] .category-accordion.active .category-header { background: rgba(255,255,255,0.1); }
[data-theme="dark"] .item-accordion { background: rgba(15, 23, 42, 0.9); }
[data-theme="dark"] .item-header { background: rgba(255,255,255,0.06); }
[data-theme="dark"] .item-body { background: rgba(255,255,255,0.03); }
[data-theme="dark"] .milestone-card { background: rgba(255,255,255,0.06); }
[data-theme="dark"] .grouped-card.collapsed { background: rgba(255,255,255,0.04); }
[data-theme="dark"] .settings-card { background: rgba(255,255,255,0.06); border-color: rgba(255,255,255,0.1); color: #cbd5e1; }
[data-theme="dark"] .settings-card:hover { background: rgba(255,255,255,0.12); color: #a78bfa; border-color: #8b5cf6; }
[data-theme="dark"] .settings-group { background: rgba(255,255,255,0.06); border-color: rgba(255,255,255,0.1); }
[data-theme="dark"] .settings-item { border-bottom-color: rgba(255,255,255,0.05); }
[data-theme="dark"] .settings-item:hover { background: rgba(255,255,255,0.08); }
[data-theme="dark"] .st-text { color: #e2e8f0; }
[data-theme="dark"] .form-input, [data-theme="dark"] .date-input-clean { background: rgba(255,255,255,0.08) !important; border-color: rgba(255,255,255,0.15) !important; color: #f8fafc !important; }
[data-theme="dark"] .btn-outline { background: rgba(255,255,255,0.06); border-color: rgba(255,255,255,0.1) !important; color: #cbd5e1; }
[data-theme="dark"] .date-pill-box { background: rgba(255,255,255,0.06); border-color: rgba(255,255,255,0.1); }
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

body {
    font-family: -apple-system, "SF Pro Display", "Segoe UI", sans-serif;
    background: linear-gradient(135deg, #eef2ff, #f3e8ff, #e0f2fe);
    background-size: 400% 400%;
    animation: gradientBG 15s ease infinite;
    color: var(--text);
    min-height: 100vh;           /* Fallback */
    min-height: 100dvh;          /* Dynamic height for iOS Safari */
    overflow-x: hidden; display: flex; flex-direction: column;
    padding-top: env(safe-area-inset-top); padding-bottom: env(safe-area-inset-bottom);
}

@keyframes gradientBG {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.container { max-width: 1100px; margin: 0 auto; padding: 20px 15px; width: 100%; flex: 1; }
.glass-panel { background: var(--glass); backdrop-filter: blur(25px); border: 1px solid var(--glass-border); border-radius: 25px; box-shadow: 0 10px 40px rgba(0, 0, 0, 0.08); }

/* --- Landing Hero --- */
.landing-hero { text-align: center; padding: 50px 20px 25px; max-width: 680px; margin: 0 auto; position: relative; overflow: visible; }

/* Decorative gradient orbs */
.landing-hero::before {
    content: '';
    position: absolute;
    top: -40px; left: -60px;
    width: 200px; height: 200px;
    background: radial-gradient(circle, rgba(139, 92, 246, 0.15) 0%, transparent 70%);
    border-radius: 50%;
    filter: blur(40px);
    pointer-events: none;
    animation: floatOrb 6s ease-in-out infinite;
}
.landing-hero::after {
    content: '';
    position: absolute;
    top: 20px; right: -40px;
    width: 160px; height: 160px;
    background: radial-gradient(circle, rgba(217, 70, 239, 0.12) 0%, transparent 70%);
    border-radius: 50%;
    filter: blur(35px);
    pointer-events: none;
    animation: floatOrb 6s ease-in-out infinite reverse;
}
@keyframes floatOrb {
    0%, 100% { transform: translate(0, 0) scale(1); }
    50% { transform: translate(15px, -20px) scale(1.1); }
}

/* Announcement pill */
.hero-announcement-pill {
    display: inline-block;
    padding: 6px 16px;
    background: rgba(139, 92, 246, 0.1);
    border-radius: 50px;
    color: var(--primary);
    font-weight: 800;
    font-size: 0.75rem;
    margin-bottom: 14px;
    border: 1px solid rgba(139, 92, 246, 0.2);
    position: relative;
    overflow: hidden;
}
.hero-announcement-pill::after {
    content: '';
    position: absolute;
    top: 0; left: -100%;
    width: 100%; height: 100%;
    background: linear-gradient(90deg, transparent, rgba(139, 92, 246, 0.15), transparent);
    animation: pillShine 3s ease-in-out infinite;
}
@keyframes pillShine {
    0% { left: -100%; }
    50% { left: 100%; }
    100% { left: 100%; }
}

.hero-title { font-size: clamp(2.5rem, 7vw, 3.5rem); font-weight: 900; background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 40%, #d946ef 100%); background-size: 200% auto; -webkit-background-clip: text; -webkit-text-fill-color: transparent; letter-spacing: -1.5px; margin-bottom: 8px; line-height: 1.1; animation: shimmerTitle 4s linear infinite; }
@keyframes shimmerTitle {
    0% { background-position: 0% center; }
    100% { background-position: 200% center; }
}
.hero-tagline { font-size: 1.1rem; font-weight: 800; color: var(--text); opacity: 0.8; margin-bottom: 10px; }
.landing-subtitle { font-size: 0.92rem; opacity: 0.7; max-width: 420px; margin: 0 auto 12px auto; line-height: 1.6; color: #334155; }
.btn-google { display: inline-flex; align-items: center; gap: 10px; padding: 14px 36px; font-size: 1rem; font-weight: 800; border-radius: 50px; border: 1px solid #dadce0; background: white; color: #3c4043; cursor: pointer; box-shadow: 0 4px 15px rgba(0,0,0,0.08); transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1); position: relative; }
.btn-google:hover { box-shadow: 0 8px 30px rgba(139, 92, 246, 0.2); transform: translateY(-2px); background: white; border-color: rgba(139, 92, 246, 0.3); }
.btn-google:active { transform: translateY(0) scale(0.98); }
.landing-badges { margin-bottom: 8px; display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; }
.landing-badges span { padding: 8px 16px; border-radius: 50px; font-size: 0.78rem; font-weight: 800; display: inline-flex; align-items: center; gap: 4px; backdrop-filter: blur(10px); border: 1px solid rgba(255,255,255,0.5); box-shadow: 0 4px 15px rgba(0,0,0,0.05); transition: transform 0.2s, box-shadow 0.2s; }
.landing-badges span:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(0,0,0,0.1); }
/* Hero Mini Dashboard Preview */
.hero-preview {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin: 18px auto 12px;
    max-width: 380px;
    animation: fadeIn 0.8s ease 0.3s both;
}
.preview-card {
    flex: 1;
    padding: 12px 10px;
    border-radius: 16px;
    text-align: center;
    color: white;
    box-shadow: 0 8px 25px rgba(0,0,0,0.12);
    transition: transform 0.3s;
}
.preview-card:hover { transform: translateY(-3px) scale(1.03); }
.preview-income { background: linear-gradient(135deg, #10b981, #34d399); }
.preview-expense { background: linear-gradient(135deg, #f43f5e, #fb7185); }
.preview-left { background: linear-gradient(135deg, #3b82f6, #60a5fa); }
.preview-label { display: block; font-size: 0.6rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; opacity: 0.9; }
.preview-amount { display: block; font-size: 1.05rem; font-weight: 900; margin-top: 2px; letter-spacing: -0.5px; }

.entry-preview { margin-top: 8px; }
.entry-preview-label { font-size: 0.72rem; font-weight: 800; color: var(--text); opacity: 0.4; text-transform: uppercase; letter-spacing: 1px; margin-bottom: 6px; }
.entry-preview-row { display: inline-flex; gap: 8px; }
.entry-preview-item { display: inline-flex; align-items: center; gap: 5px; padding: 6px 14px; border-radius: 50px; background: rgba(255,255,255,0.6); border: 1px solid rgba(255,255,255,0.5); font-size: 0.78rem; font-weight: 700; color: var(--text); opacity: 0.7; }
.entry-preview-item span { font-size: 0.9rem; }
#landingControls { margin-bottom: 14px; margin-top: 12px; }

.feature-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 14px; max-width: 680px; margin-left: auto; margin-right: auto; }
.feature-card { padding: 18px; text-align: left; border-radius: 20px; }
.feature-card .feature-icon { width: 40px; height: 40px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 1.2rem; margin-bottom: 8px; }
.feature-card h3 { color: var(--primary); margin-bottom: 4px; font-weight: 800; font-size: 0.88rem; }
.feature-card p { font-size: 0.75rem; opacity: 0.7; line-height: 1.45; }
.features-heading { text-align: center; margin-top: 18px; margin-bottom: -4px; font-weight: 900; font-size: 0.8rem; color: var(--text); opacity: 0.4; text-transform: uppercase; letter-spacing: 1.5px; }

/* --- Header & Tabs --- */
.header { padding: 40px 20px; text-align: center; margin-bottom: 25px; background: linear-gradient(135deg, #8b5cf6, #d946ef); color: white; border-radius: 25px; position: relative; }
.home-btn { position: absolute; top: 15px; left: 15px; cursor: pointer; padding: 10px; border-radius: 50%; background: rgba(255,255,255,0.2); border: none; color: white; font-size: 1.2rem; }
.top-right-controls { position: absolute; top: 15px; right: 15px; display: flex; align-items: center; gap: 12px; z-index: 10; }
.theme-btn-header { background: rgba(255,255,255,0.2); border: none; color: white; padding: 8px; border-radius: 50%; cursor: pointer; font-size: 1.1rem; display: flex; align-items: center; justify-content: center; }
.header-avatar { width: 38px; height: 38px; border-radius: 50%; border: 2px solid rgba(255,255,255,0.8); cursor: pointer; object-fit: cover; background: #e2e8f0; }
.banner-notification { background: rgba(255, 255, 255, 0.2); padding: 10px 22px; border-radius: 50px; display: inline-block; font-size: 0.9rem; font-weight: 800; margin-top: 15px; border: 1px solid rgba(255, 255, 255, 0.3); }

.view-toggles { display: flex; padding: 3px; border-radius: 10px; background: rgba(255, 255, 255, 0.4); border: 1px solid var(--glass-border); }
.toggle-btn { padding: 6px 14px; border-radius: 8px; border: none; background: transparent; font-weight: 800; font-size: 0.78rem; color: var(--text); transition: 0.2s; cursor: pointer; }
.toggle-btn.active { background: white; color: var(--primary); box-shadow: 0 2px 4px rgba(0,0,0,0.1); }

/* --- Stats --- */
.stats-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 15px; }
.stat-card { padding: 25px 15px; border-radius: 28px; color: white; text-align: center; border: 1px solid rgba(255,255,255,0.1); }
.stat-card p { font-size: 0.8rem; font-weight: 700; opacity: 0.9; text-transform: uppercase; letter-spacing: 0.5px; }
.stat-card h2 { font-size: 2rem; font-weight: 900; margin-top: 6px; letter-spacing: -1px; }
.income-card { background: linear-gradient(135deg, #10b981, #34d399); }
.expense-card { background: linear-gradient(135deg, #f43f5e, #fb7185); }
.money-left-card { background: linear-gradient(135deg, #3b82f6, #60a5fa); }

/* 1. Grid now prefers wider rows instead of small squares */
.categories-grid { 
    display: grid; 
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); 
    gap: 15px; 
}

/* 2. Cards are now Flex rows (Left-to-Right) instead of stacked blocks */
.category-card { 
    padding: 20px 25px; 
    border-radius: 25px; 
    cursor: pointer; 
    color: white; 
    border: 1px solid rgba(255,255,255,0.1); 
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    
    /* This aligns items horizontally */
    display: flex; 
    align-items: center; 
    justify-content: space-between; 
    gap: 15px;
}

.category-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
}

/* 3. Make the icon smaller and cleaner */
.category-card .cat-icon {
    font-size: 24px; 
    background: rgba(255,255,255,0.2); 
    width: 45px; height: 45px; 
    display: flex; align-items: center; justify-content: center; 
    border-radius: 12px;
}

/* 4. Text Alignment */
.category-card .cat-info { text-align: left; flex: 1; }
.category-card .cat-name { font-weight: 700; font-size: 0.8rem; opacity: 0.9; text-transform: uppercase; letter-spacing: 0.5px; }
.category-card .cat-amount { font-weight: 800; font-size: 1.4rem; letter-spacing: -0.5px; }

/* --- Budget Goal Progress Bars --- */
.cat-goal-bar {
    height: 4px;
    background: rgba(255,255,255,0.25);
    border-radius: 4px;
    margin-top: 6px;
    overflow: hidden;
}
.cat-goal-fill {
    height: 100%;
    border-radius: 4px;
    background: rgba(255,255,255,0.85);
    transition: width 0.3s ease;
}
.cat-goal-fill.over-budget {
    background: #fbbf24;
}
.cat-goal-text {
    font-size: 0.65rem;
    opacity: 0.85;
    margin-top: 2px;
}
.goal-input-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 15px;
    margin-bottom: 10px;
    background: rgba(139, 92, 246, 0.08);
    border-radius: 12px;
    border: 1px dashed rgba(139, 92, 246, 0.25);
}
.goal-input-row label {
    font-size: 0.78rem;
    font-weight: 800;
    color: var(--primary);
}

/* --- Forecast --- */
.milestone-card { padding: 18px; border-radius: 20px; background: rgba(255, 255, 255, 0.85); margin-bottom: 10px; display: flex; align-items: center; gap: 16px; border: 1px solid rgba(255, 255, 255, 0.5); }
.milestone-icon { width: 45px; height: 45px; border-radius: 14px; display: flex; align-items: center; justify-content: center; font-size: 1.2rem; color: white; }
.ms-date { font-size: 0.7rem; font-weight: 800; text-transform: uppercase; color: #8b5cf6; letter-spacing: 1px; margin-bottom: 4px; }
.ms-title { font-size: 0.9rem; font-weight: 700; color: var(--text); line-height: 1.3; }
.ms-gain { display: inline-block; background: #dcfce7; color: #166534; padding: 4px 10px; border-radius: 50px; font-size: 0.8rem; font-weight: 800; margin-top: 6px; }

/* --- Modals --- */
.modal { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.4); backdrop-filter: blur(15px); display: none; z-index: 9999; justify-content: center; align-items: center; }
.modal.active { display: flex; }
.modal-content { background: var(--glass); border: 1px solid var(--glass-border); width: 100%; max-width: 650px; border-radius: 25px; max-height: 92vh; display: flex; flex-direction: column; overflow: hidden; }
.modal-header { padding: 25px; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--glass-border); color: white; }

/* --- Universal Accordion --- */
.category-accordion { margin-bottom: 12px; border-radius: 24px; background: rgba(255, 255, 255, 0.4); border: 1px solid var(--glass-border); overflow: hidden; transition: 0.3s ease; }
.category-header { padding: 20px 25px; display: flex; justify-content: space-between; align-items: center; cursor: pointer; font-weight: 900; font-size: 1rem; color: var(--text); background: rgba(255, 255, 255, 0.3); }
.category-header::after { content: '▼'; font-size: 0.8rem; opacity: 0.4; transition: transform 0.3s ease; }
.category-accordion.active .category-header::after { transform: rotate(180deg); }
.category-accordion.active .category-header { background: white; border-bottom: 1px solid var(--glass-border); }
.category-body { display: none; padding: 15px; }
.category-accordion.active .category-body { display: block; animation: fadeIn 0.3s ease; }

.item-accordion { background: white; border-radius: 16px; overflow: hidden; border: 1px solid var(--glass-border); box-shadow: 0 2px 5px rgba(0,0,0,0.03); margin-bottom:10px; }
.item-header { padding: 15px; display: flex; justify-content: space-between; align-items: center; cursor: pointer; background: rgba(255, 255, 255, 0.8); font-weight: 700; color: var(--text); }
.item-body { display: none; padding: 15px; background: #f8fafc; border-top: 1px solid var(--glass-border); }
.item-accordion.active .item-body { display: block; animation: slideDown 0.2s ease; }

/* --- Inputs & Buttons --- */
.date-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 8px; }
.date-pill-box { background: #f1f5f9; padding: 10px; border-radius: 14px; border: 1px solid #e2e8f0; display: flex; flex-direction: column; gap: 3px; }
.date-pill-label { font-size: 0.62rem; font-weight: 900; opacity: 0.5; text-transform: uppercase; letter-spacing: 0.4px; }
.date-input-clean { border: none; background: transparent; font-size: 0.85rem; font-weight: 700; color: var(--text); width: 100%; outline: none; cursor: pointer; text-align: left; }

.form-input { flex: 1; padding: 12px; border: 1px solid var(--glass-border); border-radius: 12px; font-size: 16px; font-weight: 600; background: white; color: var(--text); width: 100%; }
.btn { padding: 18px; border-radius: 22px; border: none; font-weight: 800; cursor: pointer; transition: 0.3s; }
.btn-success { background: var(--primary); color: white; box-shadow: 0 10px 25px rgba(139, 92, 246, 0.3); }
.btn-outline { background: var(--glass); border: 1px solid var(--glass-border); color: var(--text); }
.master-footer { text-align: center; padding: 40px 20px; font-size: 0.85rem; opacity: 0.7; border-top: 1px solid var(--glass-border); }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideDown { from { opacity: 0; transform: translateY(-5px); } to { opacity: 1; transform: translateY(0); } }
@media (max-width: 768px) { .modal-content { border-radius: 25px 25px 0 0; align-self: flex-end; } .tab { font-size: 0.7rem; } }

/* Privacy Mode */
body.privacy-mode .stat-card h2,
body.privacy-mode .cat-amount,
body.privacy-mode .item-preview,
body.privacy-mode #dispIncome,
body.privacy-mode #dispExpense,
body.privacy-mode #dispLeft {
    filter: blur(6px);
    transition: filter 0.3s ease;
    user-select: none; /* Prevents selecting text to cheat */
}

/* Spinner Animation for Loading Toast */
@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Authentication Loading Spinner */
.loader-spinner {
    width: 50px;
    height: 50px;
    border: 5px solid var(--glass-border);
    border-top: 5px solid var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* Hover Effects for Cards */
/* 1. Define smooth transitions */
.feature-card, .stat-card, .category-card, .item-accordion, .milestone-card {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid rgba(255, 255, 255, 0.4);
}

/* 2. The Floating Effect */
.feature-card:hover, .stat-card:hover, .category-card:hover {
    transform: translateY(-6px); /* Lift up higher */
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.2); /* Stronger shadow for depth */
    border-color: rgba(255, 255, 255, 0.9); /* Brighten the border */
    /* We leave the background alone so gradients stay visible! */
}

.item-accordion:hover, .milestone-card:hover {
    transform: translateY(-4px); /* Lift up */
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1); /* Soft shadow */
    border-color: #8b5cf6; /* Highlight border Purple */
    cursor: pointer;
}

/* 3. Make the icons pop slightly */
.feature-card:hover div, .category-card:hover .cat-icon {
    transform: scale(1.15);
    transition: transform 0.3s ease;
}

/* Money Shimmer Effect */
/* 1. Define the shine animation */
@keyframes shimmer {
    0% { transform: translateX(-150%) skewX(-15deg); }
    100% { transform: translateX(150%) skewX(-15deg); }
}

/* 2. Apply it to the Money Left card */
.money-left-card {
    position: relative;
    overflow: hidden; /* Keeps the shine inside the card */
}

.money-left-card::after {
    content: '';
    position: absolute;
    top: 0; left: 0;
    width: 50%; height: 100%;
    background: linear-gradient(
        to right,
        rgba(255, 255, 255, 0) 0%,
        rgba(255, 255, 255, 0.3) 50%,
        rgba(255, 255, 255, 0) 100%
    );
    animation: shimmer 3s infinite; /* Runs every 3 seconds */
}

.money-left-card.negative {
    background: linear-gradient(135deg, #ef4444, #f87171) !important;
    animation: pulse-warning 2s ease-in-out infinite;
}

@keyframes pulse-warning {
    0%, 100% { box-shadow: 0 4px 15px rgba(239, 68, 68, 0.3); }
    50% { box-shadow: 0 4px 25px rgba(239, 68, 68, 0.6); }
}


/* Profile Picture Glow */
#profileImg {
    transition: 0.3s;
    box-shadow: 0 0 0 4px rgba(139, 92, 246, 0.2); /* Default Ring */
}

#profileImg:hover {
    transform: scale(1.05);
    box-shadow: 0 0 0 8px rgba(139, 92, 246, 0.4); /* Glow expands on hover */
    border-color: #d946ef !important; /* Changes border to Pink */
}

/* Floating Accordion Headers */
.category-accordion {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.category-accordion:hover {
    transform: scale(1.01); /* Subtle grow */
    box-shadow: 0 8px 20px rgba(139, 92, 246, 0.15); /* Purple Glow */
    border-color: #8b5cf6;
    z-index: 5; /* Bring to front */
}

/* Chart Container Glass Depth */
.chart-container {
    background: linear-gradient(135deg, rgba(255,255,255,0.6), rgba(255,255,255,0.3));
    box-shadow: inset 0 0 20px rgba(255,255,255,0.5); /* Inner glow */

    /* Purple-tinted border for better visibility */
    border: 1px solid rgba(139, 92, 246, 0.25);
}

/* Nested Milestones Layout */
/* 1. Update the main card to stack vertically */
.milestone-card.grouped-card {
    display: flex;
    flex-direction: column; /* Stack top-to-bottom */
    align-items: stretch;   /* Full width */
    padding: 0;             /* Reset padding */
    gap: 0;
    overflow: hidden;       /* Keep rounded corners clean */
}

/* 2. The Month Header (e.g. "APR 2026") - Clickable */
.ms-date-header {
    background: rgba(139, 92, 246, 0.1); /* Very light purple bg */
    padding: 12px 20px;
    font-size: 0.8rem;
    font-weight: 900;
    letter-spacing: 1px;
    color: #8b5cf6;
    text-transform: uppercase;
    border-bottom: 1px solid rgba(139, 92, 246, 0.1);

    /* Clickable header layout */
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background 0.2s;
}

.ms-date-header:hover {
    background: rgba(139, 92, 246, 0.2); /* Darker on hover */
}

/* 3. The List Container */
.ms-group-list {
    padding: 5px 20px 15px 20px;
}

/* 4. Individual Rows (The Nested Items) */
.ms-item-row {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 12px 0;
    border-bottom: 1px solid rgba(0,0,0,0.05);
}
.ms-item-row:last-child {
    border-bottom: none; /* No line on the last item */
}

/* 5. Mini Icons */
.milestone-icon-mini {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.1rem;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

/* 6. Collapse Arrow */
.collapse-arrow {
    font-size: 0.8rem;
    transition: transform 0.3s ease;
    opacity: 0.6;
}

/* 7. Collapsed State Logic */
.grouped-card.collapsed .ms-group-list {
    display: none; /* Hides the list */
}

.grouped-card.collapsed .ms-date-header {
    border-bottom: none; /* Keep this 'none' to avoid double lines */
}

/* When collapsed, make the OUTER border purple so it stays visible */
.grouped-card.collapsed {
    border-color: rgba(139, 92, 246, 0.3) !important;
    background: rgba(255, 255, 255, 0.5); /* Slight bg change */
}

/* Rotate the arrow */
.grouped-card.collapsed .collapse-arrow {
    transform: rotate(-90deg);
}

/* style.css - FINAL BORDER CONSISTENCY FIX */

/* GROUP A: White/Glass Tiles (Charts, Milestones, FAQ)
   These should have a SUBTLE PURPLE border to look premium on the light background. */
.chart-container,
.milestone-card,
.item-accordion,
.glass-panel {
    border: 1px solid rgba(139, 92, 246, 0.25) !important; /* Unified Purple Tint */
}

/* GROUP B: Colored Tiles (Income, Spending, Category Cards)
   These have colorful backgrounds, so they need a WHITE border to stand out. */
.stat-card,
.category-card {
    border: 1px solid rgba(255, 255, 255, 0.3) !important; /* Unified White Tint */
}

/* GROUP C: Hover Effects (Interaction) */
/* When hovering Glass Cards -> Glow Purple */
.milestone-card:hover,
.item-accordion:hover,
.chart-container:hover {
    border-color: #8b5cf6 !important;
}

/* When hovering Colored Cards -> Glow Bright White */
.stat-card:hover,
.category-card:hover {
    border-color: rgba(255, 255, 255, 0.9) !important;
}

/* GROUP D: The Missing "Collapsed" Fix
   This ensures the card doesn't disappear when you minimize it. */
.grouped-card.collapsed {
    border: 1px solid #8b5cf6 !important; /* Solid Purple Border when closed */
    background: rgba(255, 255, 255, 0.6);
}

/* style.css - Fix for Settings/Profile Buttons */

/* 1. Make the Outline Buttons Visible (PDF, CSV, Sign Out) */
.btn-outline {
    border: 1px solid rgba(139, 92, 246, 0.3) !important; /* Purple Tint Border */
    background: rgba(255, 255, 255, 0.6); /* Slightly distinct background */
    color: #475569; /* Professional dark gray text */
    font-weight: 700;
}

/* 2. Hover Effect for these buttons */
.btn-outline:hover {
    border-color: #8b5cf6 !important; /* Bright Purple on Hover */
    background: white;
    transform: translateY(-2px); /* Lift up slightly */
    box-shadow: 0 5px 15px rgba(139, 92, 246, 0.15); /* Purple Glow */
    color: #8b5cf6; /* Text turns purple */
}

/* 3. Special Case: The "Reset Data" button (Keep it Red) */
.btn-outline[onclick*="reset"] {
    border-color: rgba(239, 68, 68, 0.3) !important; /* Red tint */
    color: #ef4444 !important;
}

.btn-outline[onclick*="reset"]:hover {
    border-color: #ef4444 !important;
    background: #fef2f2;
    box-shadow: 0 5px 15px rgba(239, 68, 68, 0.15);
}

/* style.css - iOS-Style Settings Menu */

/* Settings Section Headers */
.settings-label {
    margin: 0 0 10px 15px;
    font-size: 0.75rem;
    font-weight: 900;
    color: #64748b;
    opacity: 0.8;
    letter-spacing: 1px;
}

/* 1. The Grid Cards (PDF/CSV) */
.settings-card {
    background: rgba(255,255,255,0.6);
    border: 1px solid rgba(255,255,255,0.4);
    border-radius: 20px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    color: #475569;
    cursor: pointer;
    transition: 0.2s;
}
.settings-card:hover {
    background: white;
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(139, 92, 246, 0.15);
    color: #8b5cf6;
    border-color: #8b5cf6;
}

/* 2. The Menu Groups (List Style) */
.settings-group {
    background: rgba(255,255,255,0.7);
    border: 1px solid rgba(255,255,255,0.4);
    border-radius: 20px;
    overflow: hidden; /* Clips corners */
    margin-bottom: 25px;
}

/* 3. The Individual Items */
.settings-item {
    padding: 18px 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    cursor: pointer;
    border-bottom: 1px solid rgba(0,0,0,0.05);
    transition: background 0.2s;
}
.settings-item:last-child {
    border-bottom: none;
}
.settings-item:hover {
    background: rgba(255,255,255,0.9);
}

/* Icons & Text */
.st-icon {
    width: 36px; height: 36px;
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.1rem;
}
.st-text {
    flex: 1;
    font-weight: 700;
    color: #1e293b;
    font-size: 0.95rem;
}
.st-arrow {
    color: #cbd5e1;
    font-weight: 900;
    font-size: 1.2rem;
}

/* style.css - FIX INVISIBLE INPUTS */

.form-input, .date-input-clean {
    background: #f1f5f9 !important; /* Light Grey Background */
    border: 1px solid #cbd5e1 !important; /* Visible Border */
    color: #1e293b !important; /* Dark Text */
    font-weight: 700;
}

.form-input:focus {
    background: #ffffff !important;
    border-color: #8b5cf6 !important; /* Purple Glow */
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.2);
}

/* --- NEW FEATURES STYLING --- */

/* 1. Daily Safe Spend Pill (Inside the Blue Card) */
.daily-pill {
    font-size: 0.75rem;
    background: rgba(255, 255, 255, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: 12px;
    padding: 6px 12px;
    margin-top: 10px;
    display: inline-block;
    backdrop-filter: blur(4px);
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    animation: fadeIn 0.5s ease-out;
}

/* 2. Success Animation Class (for the Bot) */
.confetti-feedback {
    animation: popIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}


/* --- NAVIGATION BAR (DESKTOP GRID) --- */
#navPanel {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    padding: 8px 15px;
    gap: 10px;
}

.tabs-compact {
    justify-self: start;
    display: flex;
    gap: 5px;
    background: rgba(255,255,255,0.4);
    padding: 4px;
    border-radius: 12px;
    overflow-x: auto;
    max-width: 100%;
}

.tab-compact {
    padding: 8px 14px;
    border-radius: 10px;
    border: none;
    background: transparent;
    font-weight: 700;
    font-size: 0.78rem;
    color: var(--text);
    opacity: 0.6;
    cursor: pointer;
    white-space: nowrap;
    transition: 0.2s;
}
.tab-compact.active { background: white; opacity: 1; color: var(--primary); box-shadow: 0 2px 5px rgba(0,0,0,0.05); }

.view-toggles-compact {
    justify-self: center;
    display: flex;
    background: rgba(255,255,255,0.4);
    border-radius: 10px;
    padding: 3px;
    border: 1px solid rgba(255,255,255,0.3);
}

.tgl-c {
    padding: 6px 14px;
    border-radius: 8px;
    border: none;
    background: transparent;
    font-weight: 800;
    font-size: 0.72rem;
    color: var(--text);
    cursor: pointer;
}
.tgl-c.active { background: white; color: var(--primary); box-shadow: 0 2px 4px rgba(0,0,0,0.1); }

.controls-compact {
    justify-self: end;
}

.btn-compact-action {
    background: var(--primary);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 10px;
    font-weight: 700;
    font-size: 0.8rem;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(139, 92, 246, 0.3);
}

/* --- ONBOARDING PANEL (COMPACT) --- */
.onboarding-compact {
    text-align: center;
    padding: 14px 20px;
    margin-bottom: 15px;
    border: 1px dashed rgba(139, 92, 246, 0.3) !important;
    border-radius: 20px !important;
}
.onboarding-label {
    font-size: 0.78rem;
    font-weight: 800;
    color: var(--primary);
    margin-bottom: 10px;
    opacity: 0.8;
}
.onboarding-row {
    display: inline-flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: center;
}
.onboarding-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 18px;
    border-radius: 50px;
    background: rgba(255,255,255,0.7);
    border: 1px solid rgba(255,255,255,0.5);
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--text);
    cursor: pointer;
    transition: 0.2s;
}
.onboarding-chip span { font-size: 1rem; }
.onboarding-chip:hover {
    background: white;
    border-color: #8b5cf6;
    color: var(--primary);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.15);
}


/* --- LOADING SKELETON SHIMMER --- */
@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}
.stat-card.skeleton p,
.stat-card.skeleton h2,
.stat-card.skeleton .daily-pill {
    color: transparent !important;
    background: linear-gradient(90deg, rgba(255,255,255,0.1) 25%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0.1) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s ease infinite;
    border-radius: 8px;
    min-height: 1em;
}
.stat-card.skeleton h2 {
    min-height: 2rem;
    max-width: 80%;
    margin: 8px auto 0;
}
.chart-container.skeleton canvas { opacity: 0; }
.chart-container.skeleton {
    position: relative;
}
.chart-container.skeleton::after {
    content: '';
    display: block;
    height: 200px;
    border-radius: 12px;
    background: linear-gradient(90deg, rgba(139,92,246,0.05) 25%, rgba(139,92,246,0.12) 50%, rgba(139,92,246,0.05) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s ease infinite;
}

/* --- RESPONSIVE & MOBILE-SPECIFIC --- */

/* Mobile Styles */
@media (max-width: 600px) {
    #navPanel {
        display: none; /* Hide desktop nav on mobile */
    }

    .container {
        padding-bottom: 85px; /* Prevent content hiding behind nav */
    }

    /* Compact header on mobile */
    .header {
        padding: 25px 15px;
        border-radius: 25px;
        margin-bottom: 15px;
    }
    .header h1 {
        font-size: 1.4rem;
    }
    .header p {
        font-size: 0.8rem;
    }
    .banner-notification {
        font-size: 0.75rem;
        padding: 7px 16px;
        margin-top: 10px;
    }
    .home-btn {
        padding: 7px;
        font-size: 1rem;
    }
    .theme-btn-header {
        padding: 6px;
        font-size: 0.95rem;
    }
    .header-avatar {
        width: 32px;
        height: 32px;
    }

    /* Compact landing page on mobile */
    .landing-hero {
        padding: 20px 12px 15px;
    }
    .hero-title {
        font-size: clamp(1.8rem, 8vw, 2.4rem);
        letter-spacing: -1px;
    }
    .hero-tagline {
        font-size: 0.85rem;
        margin-bottom: 8px;
    }
    .landing-subtitle {
        font-size: 0.8rem;
        margin-bottom: 8px;
    }
    .btn-google {
        padding: 10px 24px;
        font-size: 0.88rem;
    }
    .entry-preview { margin-top: 8px; }
    .entry-preview-label { font-size: 0.65rem; }
    .entry-preview-row { gap: 5px; }
    .entry-preview-item { padding: 5px 10px; font-size: 0.68rem; }
    .entry-preview-item span { font-size: 0.8rem; }
    .landing-badges span {
        font-size: 0.68rem;
        padding: 5px 10px;
    }
    .hero-preview {
        gap: 8px;
        max-width: 320px;
        margin: 14px auto 10px;
    }
    .preview-card {
        padding: 10px 6px;
        border-radius: 12px;
    }
    .preview-label { font-size: 0.52rem; }
    .preview-amount { font-size: 0.9rem; }
    .hero-announcement-pill { font-size: 0.68rem; margin-bottom: 10px; }
    #landingControls {
        margin-top: 10px;
        margin-bottom: 15px;
    }
    #btn-login {
        padding: 12px 30px !important;
        font-size: 0.9rem !important;
    }
    .feature-grid {
        grid-template-columns: 1fr 1fr;
        gap: 8px;
        margin-top: 15px;
    }
    .feature-card {
        padding: 14px;
        border-radius: 18px;
    }
    .feature-card .feature-icon {
        width: 36px;
        height: 36px;
        font-size: 1.1rem;
        border-radius: 10px;
        margin-bottom: 8px;
    }
    .feature-card h3 {
        font-size: 0.8rem;
        margin-bottom: 3px;
    }
    .feature-card p {
        font-size: 0.7rem;
        line-height: 1.4;
    }
    .features-heading {
        font-size: 0.75rem;
        margin-top: 18px;
    }

    /* Compact stat tiles on mobile - stay as 3 columns */
    .stats-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
    }
    .stat-card {
        padding: 16px 8px;
        border-radius: 20px;
    }
    .stat-card p {
        font-size: 0.65rem;
    }
    .stat-card h2 {
        font-size: 1.4rem;
        margin-top: 4px;
    }
    .daily-pill {
        font-size: 0.6rem;
        padding: 4px 8px;
    }

    /* Compact category cards on mobile */
    .categories-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    .category-card {
        padding: 14px 18px;
        border-radius: 18px;
    }
    .category-card .cat-icon {
        width: 38px;
        height: 38px;
        font-size: 20px;
    }
    .category-card .cat-amount {
        font-size: 1.15rem;
    }

    /* Smaller chart containers on mobile */
    .chart-container {
        border-radius: 20px !important;
    }

    /* Compact onboarding on mobile */
    .onboarding-compact {
        padding: 10px 12px;
        border-radius: 16px !important;
        margin-bottom: 10px;
    }
    .onboarding-label {
        font-size: 0.7rem;
        margin-bottom: 8px;
    }
    .onboarding-row {
        gap: 6px;
    }
    .onboarding-chip {
        padding: 6px 12px;
        font-size: 0.72rem;
    }
    .onboarding-chip span {
        font-size: 0.85rem;
    }

    .mobile-nav {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        height: calc(56px + env(safe-area-inset-bottom));
        background: var(--glass);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        border-top: 1px solid var(--glass-border);
        justify-content: space-around;
        align-items: flex-start;
        padding: 8px 0;
        padding-bottom: calc(8px + env(safe-area-inset-bottom));
        z-index: 1000;
    }

    .mobile-tab-btn {
        background: none;
        border: none;
        color: var(--text);
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 3px;
        font-weight: 700;
        font-size: 0.6rem;
        opacity: 0.6;
        transition: 0.2s;
        flex: 1;
        padding: 0 4px;
    }

    .mobile-tab-btn .mb-icon {
        font-size: 1.2rem;
    }

    .mobile-tab-btn.active {
        opacity: 1;
        color: var(--primary);
        transform: translateY(-2px);
    }
    
    .fab {
        display: flex;
        position: fixed;
        bottom: calc(68px + env(safe-area-inset-bottom));
        right: 20px;
        height: 48px;
        padding: 0 20px;
        background: var(--primary);
        color: white;
        border: none;
        border-radius: 50px;
        font-size: 1.2rem;
        align-items: center;
        justify-content: center;
        gap: 6px;
        box-shadow: 0 8px 25px rgba(139, 92, 246, 0.4);
        z-index: 1001;
        cursor: pointer;
        transition: 0.2s ease-out;
    }
    .fab-label {
        font-size: 0.85rem;
        font-weight: 800;
        letter-spacing: 0.3px;
    }

    .fab:hover {
        transform: scale(1.05);
        box-shadow: 0 12px 30px rgba(139, 92, 246, 0.5);
    }

    /* Footer: clear mobile nav */
    .master-footer {
        padding-bottom: calc(70px + env(safe-area-inset-bottom));
    }

    /* Compact settings on mobile */
    .settings-item { padding: 14px 16px; gap: 12px; }
    .st-icon { width: 32px; height: 32px; font-size: 1rem; border-radius: 8px; }
    .st-text { font-size: 0.88rem; }
    .settings-card { padding: 16px; border-radius: 16px; }
    .settings-group { border-radius: 16px; margin-bottom: 18px; }
    .settings-label { font-size: 0.7rem; margin-bottom: 8px; }

    /* Compact profile card on mobile */
    #settings > .glass-panel:first-child { padding: 18px !important; gap: 14px !important; }
    #settings #profileImg { width: 50px !important; height: 50px !important; }
    #settings #profileFullName { font-size: 1.1rem !important; }
    #settings #profileEmail { font-size: 0.8rem !important; }
}

/* Tablet adjustments */
@media (min-width: 601px) and (max-width: 900px) {
    .stat-card {
        padding: 20px 12px;
        border-radius: 24px;
    }
    .stat-card h2 {
        font-size: 1.6rem;
    }
    .tab-compact {
        padding: 7px 10px;
        font-size: 0.72rem;
    }
    .tgl-c {
        padding: 5px 10px;
        font-size: 0.68rem;
    }
}

/* Desktop-only styles */
@media (min-width: 601px) {
    .mobile-nav, .fab {
        display: none;
    }
}