:root {
    /* --- 🎨 THEME CONFIGURATION --- */
    --bg-body: #0b0e14;    
    --primary: #2dd4bf;    
    --secondary: #fbbf24; 
    --text-main: #f1f5f9; 
    
    --glass-bg: rgba(30, 41, 59, 0.7);
    --glass-border: rgba(255, 255, 255, 0.08);
    --danger: #f43f5e;
    --text-muted: #94a3b8;
    --calc-bg: #1e293b;
}

/* --- ☀️ LIGHT MODE OVERRIDES --- */
body.light-mode {
    --bg-body: #f8fafc;            
    --text-main: #0f172a;          
    --text-muted: #64748b;         
    --glass-bg: rgba(255, 255, 255, 0.85); 
    --glass-border: rgba(0, 0, 0, 0.05);   
    --calc-bg: #ffffff;            
}

/* Fix specific elements for Light Mode visibility */
body.light-mode .calc-keypad { border-top: 1px solid rgba(0,0,0,0.1); }
body.light-mode .key { background: #f1f5f9; color: #334155; border: 1px solid #e2e8f0; }
body.light-mode .key:active { background: #cbd5e1; }
body.light-mode .calc-display-wrapper { background: #f1f5f9; color: #000; }
body.light-mode .calc-pill-select { background: #fff; color: #000; border-color: #cbd5e1; }
body.light-mode .calc-note-input { color: #000; border-color: #cbd5e1; }
body.light-mode .nav-btn { color: #64748b; }
body.light-mode .nav-btn.active { background: var(--primary); color: #fff; }
body.light-mode .profile-name-lg { color: #000; }
body.light-mode .profile-stats-grid .p-stat-box { background: rgba(0,0,0,0.05); }
body.light-mode .stat-card { box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1); }

* { margin: 0; padding: 0; box-sizing: border-box; font-family: 'Inter', sans-serif; }

body {
    background-color: var(--bg-body);
    background-image: 
        radial-gradient(circle at 10% 20%, var(--primary) 0%, transparent 20%), 
        radial-gradient(circle at 90% 80%, var(--secondary) 0%, transparent 20%);
    background-size: 100% 100%;
    color: var(--text-main);
    height: 100vh;
    overflow: hidden; 
}

select option { background-color: var(--bg-body); color: var(--text-main); padding: 10px; }

/* --- AUTHENTICATION SCREENS CSS --- */
#auth-wrapper {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    display: flex; align-items: center; justify-content: center;
    z-index: 2000;
    backdrop-filter: blur(20px);
    background: rgba(11, 14, 20, 0.8);
}

.auth-card {
    width: 400px; max-width: 90%;
    background: rgba(15, 23, 42, 0.9);
    border: 1px solid var(--glass-border);
    border-radius: 20px; padding: 40px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.5);
    text-align: center;
    display: block; 
    animation: fadeIn 0.4s ease-out;
}

.auth-logo { font-size: 3rem; color: var(--primary); margin-bottom: 10px; }
.auth-title { font-size: 1.5rem; font-weight: 700; margin-bottom: 5px; }
.auth-sub { color: var(--text-muted); font-size: 0.9rem; margin-bottom: 30px; }

/* Google Button Style */
.google-btn {
    width: 100%; padding: 12px; background: white;
    color: #333; border: none; border-radius: 8px;
    font-weight: 600; font-size: 1rem; cursor: pointer;
    margin-top: 10px; transition: transform 0.2s;
    display: flex; align-items: center; justify-content: center; gap: 10px;
}
.google-btn:hover { transform: scale(1.02); background: #f1f1f1; }
.google-btn i { color: #DB4437; font-size: 1.2rem; }

/* --- MAIN APP WRAPPER --- */
#app-wrapper {
    display: none; 
    width: 100%; height: 100%;
    display: flex; 
}

/* --- SIDEBAR --- */
#sidebar {
    width: 280px;
    background: rgba(15, 23, 42, 0.9);
    backdrop-filter: blur(12px);
    border-right: 1px solid var(--glass-border);
    display: flex;
    flex-direction: column;
    padding: 25px;
    z-index: 20;
    overflow-y: auto;
}

.app-title { font-size: 1.2rem; font-weight: 700; color: var(--primary); margin-bottom: 30px; display: flex; align-items: center; gap: 12px; }

/* PROFILE STYLES */
.profile-container {
    display: flex; flex-direction: column; align-items: center;
    max-width: 600px; margin: 0 auto; width: 100%;
}

.profile-header-card {
    background: var(--glass-bg); border: 1px solid var(--glass-border);
    border-radius: 20px; padding: 30px; width: 100%;
    display: flex; flex-direction: column; align-items: center; text-align: center;
    margin-bottom: 20px; position: relative; overflow: hidden;
}
.profile-header-card::before {
    content:''; position: absolute; top:0; left:0; width:100%; height:80px;
    background: linear-gradient(to right, rgba(45, 212, 191, 0.2), rgba(251, 191, 36, 0.2));
    z-index: 0;
}

.profile-img-lg {
    width: 100px; height: 100px; border-radius: 50%; border: 3px solid var(--bg-body);
    z-index: 1; margin-top: 20px; object-fit: cover; background: #000;
}

.profile-name-lg { font-size: 1.5rem; font-weight: 700; margin-top: 10px; z-index: 1; }
.profile-badge-lg { background: rgba(255,255,255,0.1); padding: 4px 10px; border-radius: 12px; font-size: 0.75rem; color: var(--primary); margin-top: 5px; z-index: 1; }

.profile-stats-grid {
    display: grid; grid-template-columns: 1fr 1fr; gap: 15px; width: 100%; margin-top: 25px; z-index: 1;
}
.p-stat-box {
    background: rgba(0,0,0,0.2); padding: 15px; border-radius: 12px;
}
.p-stat-num { font-size: 1.2rem; font-weight: 700; color: var(--text-main); }
.p-stat-lbl { font-size: 0.75rem; color: var(--text-muted); text-transform: uppercase; }

.settings-group { width: 100%; display: flex; flex-direction: column; gap: 10px; }
.settings-btn {
    background: var(--glass-bg); border: 1px solid var(--glass-border);
    padding: 15px; border-radius: 12px; color: var(--text-main);
    display: flex; align-items: center; justify-content: space-between;
    cursor: pointer; transition: 0.2s; font-size: 0.95rem;
}
.settings-btn:hover { background: rgba(255,255,255,0.05); }
.settings-btn.danger { border-color: rgba(244, 63, 94, 0.3); color: var(--danger); }
.settings-btn.danger:hover { background: rgba(244, 63, 94, 0.1); }

/* --- MAIN AREA --- */
#main { 
    flex-grow: 1; position: relative; display: flex; flex-direction: column; height: 100vh; overflow: hidden;
}

.report-header { 
    padding: 20px 25px; 
    display: flex; flex-direction: column; gap: 15px;
    background: rgba(15, 23, 42, 0.5); backdrop-filter: blur(5px); border-bottom: 1px solid var(--glass-border); flex-shrink: 0; z-index: 15;
}

.header-top-row { display: flex; justify-content: space-between; align-items: center; width: 100%; }
.report-title { font-size: 1.5rem; font-weight: 700; }

.header-controls { display: flex; gap: 10px; align-items: center; }
.header-select { width: auto; padding: 8px 15px; background: rgba(0,0,0,0.3); border: 1px solid var(--glass-border); color: var(--text-main); cursor: pointer; border-radius: 8px; font-size: 0.85rem; }

.custom-date-row {
    display: none; width: 100%; gap: 10px; align-items: center; 
    padding-top: 5px; border-top: 1px solid rgba(255,255,255,0.05);
    animation: slideDown 0.2s ease;
}
.custom-date-row.show { display: flex; }
@keyframes slideDown { from { opacity:0; transform:translateY(-5px); } to { opacity:1; transform:translateY(0); } }

.date-input-group { display: flex; align-items: center; gap: 8px; flex: 1; }
.date-label { font-size: 0.75rem; color: var(--text-muted); text-transform: uppercase; font-weight: 600; white-space: nowrap; }
.custom-date-input { width: 100%; padding: 8px; background: rgba(0,0,0,0.3); border: 1px solid var(--glass-border); border-radius: 6px; color: var(--text-main); font-size: 0.85rem; }

.currency-wrapper { position: relative; display: flex; align-items: center; }
.spinner { position: absolute; right: 30px; pointer-events: none; border: 2px solid rgba(255,255,255,0.1); border-top: 2px solid var(--primary); border-radius: 50%; width: 12px; height: 12px; animation: spin 1s linear infinite; display: inline-block; }
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

/* VIEW CONTAINER */
.view-container {
    flex-grow: 1; overflow-y: auto; 
    padding: 25px 25px 120px 25px; 
    display: none; 
}
.view-container.active { display: block; animation: fadeIn 0.3s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* DASHBOARD */
.summary-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; margin-bottom: 25px; }
.stat-card {
    background: var(--glass-bg); backdrop-filter: blur(10px); padding: 25px; border-radius: 16px;
    border: 1px solid var(--glass-border); display: flex; flex-direction: column;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}
.stat-title { font-size: 0.75rem; color: var(--text-muted); font-weight: 600; text-transform: uppercase; }
.stat-val { font-size: 2rem; font-weight: 700; margin-top: 10px; letter-spacing: -1px; }
.stat-val.pos { color: var(--primary); }
.stat-val.neg { color: var(--secondary); }

.dashboard-lower { display: flex; flex-direction: column; gap: 25px; min-height: 400px; }

/* EXPENSE FLOW CHART */
.flow-container {
    background: var(--glass-bg); backdrop-filter: blur(10px); padding: 20px; border-radius: 16px;
    border: 1px solid var(--glass-border); margin-bottom: 20px; display: flex; flex-direction: column;
    position: relative; 
}
#chart-flow { width: 100%; height: 200px; position: relative; }

.flow-tooltip {
    position: absolute; 
    background: rgba(15, 23, 42, 0.95); border: 1px solid var(--danger);
    padding: 8px 12px; border-radius: 8px; pointer-events: none; opacity: 0; 
    font-size: 12px; z-index: 1000; color: white; 
    transform: translate(-50%, -100%); 
    transition: opacity 0.1s; box-shadow: 0 5px 15px rgba(0,0,0,0.5);
    margin-top: -10px;
}

.flow-daily-strip {
    display: flex; gap: 10px; overflow-x: auto; padding: 15px 0 5px 0;
    border-top: 1px solid rgba(255,255,255,0.05); margin-top: 10px;
}
.flow-daily-item {
    min-width: 70px; background: rgba(255,255,255,0.02); border-radius: 8px; padding: 8px 5px;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    border: 1px solid transparent; transition: all 0.2s; flex-shrink: 0;
}
.flow-daily-item:hover { background: rgba(255,255,255,0.05); border-color: var(--glass-border); }
.flow-day { font-size: 0.65rem; color: var(--text-muted); text-transform: uppercase; }
.flow-date { font-size: 0.85rem; font-weight: bold; margin: 2px 0; }
.flow-amt { font-size: 0.7rem; color: var(--danger); font-family: 'Consolas', monospace; font-weight: 700; white-space: nowrap; }

/* SPENDING BREAKDOWN */
.top-cats-container {
    background: var(--glass-bg); backdrop-filter: blur(10px); padding: 30px; border-radius: 16px;
    border: 1px solid var(--glass-border); position: relative; display: flex; flex-direction: column;
    width: 100%; height: 550px;
}
.chart-header-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; flex-wrap: wrap; gap: 10px; }
.chart-title { font-size: 1.1rem; font-weight: 600; color: var(--text-muted); margin: 0; }

.chart-controls-right { display: flex; gap: 10px; align-items: center; }
.chart-switch-group { display: flex; background: rgba(0,0,0,0.2); border-radius: 8px; padding: 2px; border: 1px solid var(--glass-border); }
.chart-switch-btn { 
    background: transparent; border: none; color: var(--text-muted); padding: 5px 12px; 
    font-size: 0.75rem; font-weight: 600; cursor: pointer; border-radius: 6px; 
}
.chart-switch-btn.active { background: rgba(255,255,255,0.1); color: var(--text-main); }

.chart-label-select {
    background: rgba(0,0,0,0.3); border: 1px solid var(--glass-border); color: var(--text-muted);
    border-radius: 6px; padding: 4px 8px; font-size: 0.75rem; outline: none;
}

#chart-cats { flex-grow: 1; width: 100%; height: 100%; position: relative; }
.chart-tooltip { position: absolute; background: rgba(15, 23, 42, 0.95); border: 1px solid var(--primary); padding: 8px 12px; border-radius: 6px; pointer-events: none; opacity: 0; font-size: 12px; z-index: 100; color: white; transform: translate(-50%, -120%); transition: opacity 0.1s; }

.slice-label { font-size: 11px; fill: var(--text-muted); font-weight: 500; pointer-events: none; }
.slice-label-inner { font-size: 10px; fill: rgba(0,0,0,0.6); font-weight: 700; pointer-events: none; text-shadow: none; }
.slice-line { stroke: var(--text-muted); stroke-width: 1px; fill: none; opacity: 0.3; }

/* LISTS */
.detail-table { width: 100%; border-collapse: collapse; margin-top: 20px; }
.detail-table th { text-align: left; padding: 15px; color: var(--text-muted); font-size: 0.8rem; text-transform: uppercase; border-bottom: 1px solid var(--glass-border); }
.detail-table td { padding: 15px; border-bottom: 1px solid rgba(255,255,255,0.03); color: var(--text-main); font-size: 0.95rem; }
.detail-table tr:hover { background: rgba(255,255,255,0.02); }
.detail-icon { width: 32px; height: 32px; background: rgba(255,255,255,0.05); border-radius: 8px; display: inline-flex; align-items: center; justify-content: center; margin-right: 10px; color: var(--text-muted); font-size: 0.85rem; }
.empty-state { text-align: center; color: var(--text-muted); padding: 50px; font-style: italic; }
.method-tag { font-size: 0.7rem; padding: 2px 6px; border-radius: 4px; background: rgba(255,255,255,0.1); color: var(--text-muted); margin-left: 5px; }

/* CATEGORIES VIEW STYLES */
.cat-section-title { font-size: 0.85rem; font-weight: 700; color: var(--primary); margin: 25px 0 15px 0; text-transform: uppercase; letter-spacing: 0.5px; border-bottom: 1px solid var(--glass-border); padding-bottom: 10px; }
.cat-list-item { display: flex; justify-content: space-between; align-items: center; padding: 15px 0; border-bottom: 1px solid rgba(255,255,255,0.03); transition: background 0.2s; }
.cat-list-item:hover { background: rgba(255,255,255,0.02); }
.cat-left { display: flex; align-items: center; gap: 15px; }
.cat-icon-circle { width: 40px; height: 40px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 1rem; }
.cat-name { font-weight: 500; font-size: 1rem; color: var(--text-main); }
.cat-right { text-align: right; }
.cat-amount { font-weight: 700; font-family: 'Consolas', monospace; font-size: 1rem; }
.cat-count { font-size: 0.7rem; color: var(--text-muted); margin-top: 2px; }
/* --- SEARCH BAR --- */
.search-container { position: relative; margin-bottom: 15px; }
.search-input {
    width: 100%; padding: 12px 15px 12px 45px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    border-radius: 12px; color: var(--text-main);
    font-size: 0.95rem; outline: none; transition: 0.3s;
}
.search-input:focus {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--primary);
    box-shadow: 0 0 15px rgba(45, 212, 191, 0.2);
}
.search-icon {
    position: absolute; left: 15px; top: 50%;
    transform: translateY(-50%); color: var(--text-muted);
}
/* NAV */
.bottom-nav {
    position: fixed; bottom: 30px; left: 50%; transform: translateX(-50%);
    background: rgba(15, 23, 42, 0.95); backdrop-filter: blur(15px);
    border: 1px solid var(--glass-border); border-radius: 25px;
    display: flex; padding: 5px 10px; gap: 5px; box-shadow: 0 10px 40px rgba(0,0,0,0.5); z-index: 100;
    align-items: center; width: auto; max-width: 100%; overflow-x: auto;
}
.nav-btn {
    background: transparent; border: none; color: var(--text-muted);
    padding: 10px 12px; border-radius: 15px; cursor: pointer;
    font-size: 0.7rem; font-weight: 600; display: flex; flex-direction: column; align-items: center; gap: 4px; transition: all 0.2s;
    min-width: 60px; flex-shrink: 0;
}
.nav-btn:hover { color: var(--text-main); }
.nav-btn.active { background: var(--primary); color: #0b0e14; box-shadow: 0 4px 15px rgba(45, 212, 191, 0.3); }
.nav-btn i { font-size: 1.2rem; }

.nav-add-btn {
    background: var(--primary); color: #000; border: none;
    width: 45px; height: 45px; border-radius: 50%; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.4rem; cursor: pointer; margin: 0 5px;
    box-shadow: 0 5px 20px rgba(45, 212, 191, 0.3);
    transition: transform 0.2s;
}
.nav-add-btn:hover { transform: scale(1.1); }

/* --- COMPACT CALCULATOR MODAL --- */
#calc-modal {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.8); z-index: 999;
    display: none; align-items: center; justify-content: center;
    backdrop-filter: blur(5px); animation: fadeIn 0.2s ease-out;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

#calc-content {
    width: 360px; max-width: 95%; background: var(--bg-body);
    border: 1px solid var(--glass-border); border-radius: 20px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.5); overflow: hidden; display: flex; flex-direction: column;
    transform: scale(0.95); animation: popUp 0.2s ease-out forwards;
}
@keyframes popUp { to { transform: scale(1); } }

.calc-header { padding: 15px; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--glass-border); background: rgba(255,255,255,0.03); }
.calc-action-btn { background: none; border: none; font-size: 0.9rem; font-weight: 600; cursor: pointer; display: flex; align-items: center; gap: 5px; }
.btn-close { color: var(--danger); }
.btn-save { color: var(--primary); }
.calc-tabs { display: flex; justify-content: center; padding: 15px 0; gap: 20px; }
.calc-tab { color: var(--text-muted); cursor: pointer; font-weight: 600; padding-bottom: 5px; border-bottom: 2px solid transparent; font-size: 0.9rem; }
.calc-tab.active { color: var(--text-main); border-color: var(--primary); }
.calc-tab.active.expense-tab { border-color: var(--secondary); }
.calc-input-area { padding: 0 20px; margin-bottom: 15px; }
.input-row { display: flex; gap: 10px; margin-bottom: 10px; }
.calc-pill-select { flex: 1; padding: 10px; background: rgba(255,255,255,0.05); border: 1px solid var(--glass-border); border-radius: 8px; color: var(--text-main); outline: none; font-size: 0.85rem; appearance: none; background-image: url('data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%2394a3b8%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.5-12.8z%22%2F%3E%3C%2Fsvg%3E'); background-repeat: no-repeat; background-position: right 10px top 50%; background-size: 8px; }
.calc-note-input { width: 100%; padding: 10px; background: transparent; border: none; border-bottom: 1px solid var(--glass-border); color: var(--text-main); font-size: 0.9rem; outline: none; }
.calc-display-wrapper { padding: 10px 20px; text-align: right; }
.calc-display { font-size: 2.5rem; font-weight: 700; font-family: 'Consolas', monospace; color: var(--text-main); }
.calc-keypad { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; background: var(--glass-border); border-top: 1px solid var(--glass-border); }
.key { background: rgba(30, 41, 59, 0.4); border: none; color: var(--text-main); font-size: 1.2rem; display: flex; align-items: center; justify-content: center; cursor: pointer; padding: 18px 0; transition: background 0.1s; }
.key:active { background: rgba(255,255,255,0.1); }
.key.op { background: rgba(45, 212, 191, 0.1); color: var(--primary); }
.key.eq { background: var(--primary); color: #000; font-weight: bold; grid-row: span 2; height: 100%; }
.key.del { color: var(--danger); }

/* Records Date Header */
.records-date-header {
    padding: 10px 0; font-size: 0.85rem; color: var(--text-muted); font-weight: bold; 
    border-bottom: 1px solid var(--glass-border); margin-top: 20px;
}
/* --- NEW TAB HEADER STYLES --- */
.custom-tabs-header {
    display: flex;
    gap: 25px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    margin-bottom: 25px;
    padding: 0 10px;
    overflow-x: auto; /* Allows scrolling on small phones */
    white-space: nowrap;
}

/* Hide scrollbar for a clean look */
.custom-tabs-header::-webkit-scrollbar { display: none; }

.tab-link-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    padding: 15px 0;
    cursor: pointer;
    position: relative;
    transition: color 0.3s ease;
    letter-spacing: 0.8px;
    flex-shrink: 0; /* Prevents squishing */
}

.tab-link-btn:hover {
    color: var(--text-main);
}

/* Active State (Gold Line) */
.tab-link-btn.active {
    color: var(--secondary);
}

.tab-link-btn.active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    width: 100%;
    height: 3px;
    background: var(--secondary);
    border-radius: 3px 3px 0 0;
    box-shadow: 0 -4px 10px rgba(251, 191, 36, 0.3);
    animation: fadeInLine 0.2s ease-out;
}

@keyframes fadeInLine {
    from { width: 0%; opacity: 0; }
    to { width: 100%; opacity: 1; }
}
@media (max-width: 768px) {
    body { overflow-y: hidden; } /* Let main/view containers scroll */
    #app-wrapper { flex-direction: column; overflow-y: auto; }
    #sidebar { width: 100%; border-right: none; border-bottom: 1px solid var(--glass-border); position: relative; order: 1; padding: 20px; height: auto; display: none; } /* Hidden on mobile */
    #main { order: 2; height: 100%; overflow: visible; padding-bottom: 100px; }
    .report-header { padding: 15px 20px; align-items: flex-start; gap: 10px; }
    .header-top-row { flex-wrap: wrap; gap:10px; }
    /* --- FIXED HEADER FOR MOBILE --- */
    .header-controls { 
        width: 100%; 
        justify-content: flex-start; /* Align to start */
        overflow-x: auto; /* Enable scroll */
        gap: 10px; 
        padding-bottom: 5px; /* Space for scrollbar */
    }
    /* Stop items from squishing */
    .currency-wrapper, #period-select, #year-select { 
        flex: 0 0 auto; /* Do not shrink */
        width: auto; 
        min-width: auto; 
    }
    /* Hide scrollbar for clean look */
    .header-controls::-webkit-scrollbar { display: none; }
    .custom-date-row { flex-direction: column; align-items: flex-start; }
    .view-container { padding: 20px 20px 120px 20px; }
    .summary-grid { grid-template-columns: 1fr; }
    .top-cats-container { 
        height: auto; 
        min-height: 450px; 
        padding: 15px; 
        overflow: hidden; 
    }
    .chart-switch-btn { padding: 4px 8px; font-size: 0.7rem; }
    #chart-label-mode { max-width: 100px; }
    .bottom-nav { bottom: 0; left: 0; transform: none; width: 100%; border-radius: 0; justify-content: space-around; padding: 12px 10px; }
}
/* --- DEBT VIEW STYLES --- */
/* --- DEBT CARD IMPROVEMENTS --- */
/* --- SMART DEBT CARD --- */
.debt-card {
    background: var(--glass-bg); border: 1px solid var(--glass-border);
    border-radius: 12px; margin-bottom: 12px;
    display: flex; flex-direction: column; 
    transition: all 0.2s ease; overflow: hidden;
}
/* --- STYLIZED DROPDOWN HISTORY --- */
.debt-history-container {
    background: rgba(11, 14, 20, 0.5); /* Darker inner background */
    border-top: 1px solid rgba(255,255,255,0.05);
    box-shadow: inset 0 10px 20px rgba(0,0,0,0.3); /* Inner shadow for depth */
    display: none; /* Hidden by default */
    animation: slideOpen 0.3s ease-out; /* Smooth animation */
}

/* Animation for opening */
@keyframes slideOpen {
    from { opacity: 0; transform: translateY(-5px); }
    to { opacity: 1; transform: translateY(0); }
}

/* The small header inside the list */
.debt-hist-header-label {
    padding: 10px 15px;
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    background: rgba(255,255,255,0.02);
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

/* Individual Transaction Items */
.debt-hist-item {
    padding: 12px 15px;
    display: flex; justify-content: space-between; align-items: center;
    border-bottom: 1px solid rgba(255,255,255,0.03);
    transition: background 0.2s;
}
.debt-hist-item:last-child { border-bottom: none; }
.debt-hist-item:hover { background: rgba(255,255,255,0.05); } /* Highlight on hover */

/* Icons inside the list */
.hist-action-btn {
    width: 28px; height: 28px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 50%; border: none; background: rgba(255,255,255,0.05);
    color: var(--text-muted); cursor: pointer; transition: all 0.2s;
}
.hist-action-btn:hover { background: var(--text-main); color: #000; }
.hist-action-btn.del:hover { background: var(--danger); color: white; }

/* Row 1: Name, Amount, Chevron */
.debt-header-main {
    padding: 15px 15px 5px 15px; /* Less bottom padding */
    display: flex; justify-content: space-between; align-items: center;
    cursor: pointer;
}

/* Row 2: Info (Days) & Actions */
.debt-action-row {
    padding: 5px 15px 15px 15px;
    display: flex; justify-content: space-between; align-items: center;
}

.debt-days-badge {
    font-size: 0.7rem; color: var(--text-muted);
    background: rgba(255,255,255,0.05); padding: 2px 8px; border-radius: 6px;
    display: inline-block;
}

.debt-btn-group { display: flex; gap: 8px; }

/* Action Buttons */
.btn-mini-action {
    border: none; border-radius: 6px; 
    padding: 6px 12px; font-size: 0.75rem; font-weight: 600; cursor: pointer;
    display: flex; align-items: center; gap: 5px;
}
.btn-settle { background: var(--primary); color: #000; }
.btn-wa { background: #25D366; color: #fff; } /* WhatsApp Green */

/* History List (Hidden by default) */
.debt-history-container {
    background: rgba(0,0,0,0.2); /* Slightly darker background for list */
    border-top: 1px solid var(--glass-border);
    display: none; /* Hidden */
}
.debt-card.open .debt-history-container { display: block; }

/* Rotating Chevron */
.debt-chevron { transition: transform 0.3s; margin-left: 8px; font-size: 0.8rem; color: var(--text-muted); }
.debt-card.open .debt-chevron { transform: rotate(180deg); }

/* Custom Scrollbar for the history list */
.debt-history-scroll::-webkit-scrollbar { width: 4px; }
.debt-history-scroll::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.2); border-radius: 4px; }
.debt-avatar { 
    width: 40px; height: 40px; border-radius: 50%; 
    background: rgba(255,255,255,0.05); color: var(--text-main);
    display: flex; align-items: center; justify-content: center; font-weight: bold; margin-right: 12px;
}
.debt-amt { font-family: 'Consolas', monospace; font-weight: 700; font-size: 1rem; }
.debt-amt.lent { color: var(--secondary); }   /* Money you gave (Asset) */
.debt-amt.borrowed { color: var(--danger); } /* Money you took (Liability) */

/* Calculator Debt Tab Color */
.calc-tab.active.debt-tab { border-color: #a855f7; color: #a855f7; }

/* --- GOALS VIEW STYLES --- */
.goal-card {
    background: var(--glass-bg); border: 1px solid var(--glass-border);
    border-radius: 16px; padding: 20px; margin-bottom: 20px;
    position: relative; overflow: hidden;
}
.goal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.goal-title { font-weight: 700; font-size: 1.1rem; color: var(--text-main); display: flex; align-items: center; gap: 10px; }
.goal-icon-box { 
    width: 40px; height: 40px; border-radius: 10px; 
    background: rgba(45, 212, 191, 0.1); color: var(--primary);
    display: flex; align-items: center; justify-content: center; font-size: 1.1rem;
}

/* Progress Bar */
.goal-progress-bg {
    width: 100%; height: 8px; background: rgba(255,255,255,0.05);
    border-radius: 4px; margin: 15px 0; overflow: hidden;
}
.goal-progress-fill {
    height: 100%; background: linear-gradient(90deg, var(--primary), var(--secondary));
    border-radius: 4px; width: 0%; transition: width 0.5s ease;
}

.goal-stats { display: flex; justify-content: space-between; font-size: 0.85rem; color: var(--text-muted); font-weight: 600; }
.goal-current { color: var(--text-main); font-size: 1rem; }

/* Add Money Button inside Card */
.btn-goal-add {
    width: 100%; padding: 10px; margin-top: 15px;
    background: rgba(255,255,255,0.05); border: 1px solid var(--glass-border);
    border-radius: 8px; color: var(--primary); font-weight: 600; cursor: pointer;
    display: flex; align-items: center; justify-content: center; gap: 8px;
    transition: 0.2s;
}
.btn-goal-add:hover { background: var(--primary); color: #000; }

/* New Goal Form (Hidden by default) */
#add-goal-form {
    background: rgba(0,0,0,0.3); padding: 15px; border-radius: 12px;
    border: 1px dashed var(--glass-border); margin-bottom: 20px; display: none;
}

/* --- PRO CALENDAR STYLES --- */
.calendar-wrapper {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 20px; /* Big rounded corners like the image */
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

.calendar-header {
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    margin-bottom: 20px;
    padding: 0 10px;
}

/* The Grid Container */
.calendar-grid { 
    display: grid; 
    grid-template-columns: repeat(7, 1fr); 
    gap: 5px; /* Tighter gap */
    width: 100%;
}

/* Day Labels (S M T W...) */
.cal-day-label { 
    text-align: center; 
    color: var(--text-muted); 
    font-size: 0.75rem; 
    font-weight: 700; 
    margin-bottom: 10px;
    opacity: 0.7;
}

/* Individual Day Cell */
.cal-day {
    aspect-ratio: 1/1; /* Keeps it square */
    display: flex; 
    flex-direction: column; 
    align-items: center; 
    justify-content: center;
    border-radius: 50%; /* Circular selection like iOS */
    font-size: 0.9rem; 
    font-weight: 500;
    position: relative;
    cursor: pointer;
    border: 2px solid transparent; /* Reserve space for border */
    transition: all 0.2s ease;
    color: var(--text-main);
}

/* Hover Effect */
.cal-day:hover:not(.empty) { 
    background: rgba(255,255,255,0.1); 
}

/* "Today" State (Solid Circle) */
.cal-day.today { 
    background: var(--primary); 
    color: #000; 
    font-weight: 800;
    box-shadow: 0 0 10px rgba(45, 212, 191, 0.4);
}

/* "Has Bill" State (Indicator Dot) */
.cal-dot-container {
    position: absolute;
    bottom: 4px;
    display: flex;
    gap: 2px;
}

.cal-icon-dot {
    width: 5px; 
    height: 5px; 
    border-radius: 50%; 
    background-color: var(--text-muted);
}

/* Status Colors for Dots */
.dot-paid { background-color: #10b981; }   /* Green */
.dot-due { background-color: var(--text-muted); } /* Gray */
.dot-overdue { background-color: #ef4444; } /* Red */

/* Empty slots for spacing */
.cal-day.empty { pointer-events: none; }

/* --- DESKTOP OPTIMIZATIONS --- */
@media (min-width: 768px) {
    
    /* 1. Restrict Calendar Width */
    .calendar-wrapper {
        max-width: 350px;  /* Stop it from stretching */
        margin: 0 auto 25px auto; /* Center it */
        padding: 15px;
        border: 1px solid rgba(255,255,255,0.1);
        box-shadow: 0 4px 20px rgba(0,0,0,0.2);
    }

    /* 2. Smaller Text & Gaps */
    .calendar-header { margin-bottom: 10px; }
    #cal-month-title { font-size: 1rem; }
    .calendar-grid { gap: 4px; }
    .cal-day-label { font-size: 0.7rem; margin-bottom: 5px; }

    /* 3. Smaller Day Circles (Mouse friendly) */
    .cal-day {
        width: 32px;
        height: 32px;
        font-size: 0.8rem;
        border-radius: 8px; /* Slightly squarer looks better small */
    }

    /* 4. Tiny Dots */
    .cal-dot-container { bottom: 2px; gap: 1px; }
    .cal-icon-dot { width: 3px; height: 3px; }
    
    /* 5. Make the Bill List a Grid on Desktop */
    #bills-list-container {
        display: grid;
        grid-template-columns: 1fr 1fr; /* 2 Columns */
        gap: 15px;
    }
}

/* --- BILL CARD STYLING --- */
.bill-card {
    display: flex;
    justify-content: space-between; /* Pushes content to edges */
    align-items: center;
    background: linear-gradient(145deg, rgba(255,255,255,0.05), rgba(255,255,255,0.01));
    border: 1px solid var(--glass-border);
    border-radius: 14px;
    padding: 12px 16px;
    margin-bottom: 10px;
    transition: transform 0.2s;
}

.bill-card:active { transform: scale(0.98); }

.bill-left {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1; /* Takes up all empty space */
}

.bill-right {
    text-align: right;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-width: 80px; /* Ensures alignment even for small/big numbers */
}

.bill-amount {
    font-family: 'Consolas', monospace; /* Monospace aligns numbers better */
    font-weight: 700;
    font-size: 1rem;
    color: var(--text-main);
}
/* --- CALENDAR SUMMARY (Inside the dark card) --- */
.cal-summary-line {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid rgba(255,255,255,0.1);
    font-size: 0.75rem;
    color: var(--text-muted);
}

.cal-sum-item { display: flex; align-items: center; gap: 6px; }

/* --- FILTER TABS (Pills below calendar) --- */
.bill-filter-tabs {
    display: flex;
    background: var(--glass-bg);
    padding: 5px;
    border-radius: 12px;
    margin-bottom: 15px;
    border: 1px solid var(--glass-border);
}

.bill-filter-btn {
    flex: 1;
    padding: 8px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.2s;
}

.bill-filter-btn.active {
    background: var(--bg-body); /* Or a highlight color */
    color: var(--text-main);
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}
.presets-scroll {
    display: flex; gap: 8px; overflow-x: auto; padding-bottom: 5px;
}
.preset-chip {
    flex: 0 0 auto; background: var(--glass-bg); border: 1px solid var(--glass-border);
    border-radius: 20px; padding: 6px 12px; display: flex; align-items: center; gap: 8px;
    cursor: pointer; font-size: 0.75rem; color: var(--text-main); transition: 0.2s;
}
.preset-chip:hover { background: rgba(255,255,255,0.05); }
