:root {
    --bg-color: #F8FAFC;
    --surface-color: #FFFFFF;
    --primary-color: #6366F1;
    /* Indigo */
    --primary-hover: #4F46E5;
    --accent-color: #F472B6;
    /* Pink */
    --text-main: #1E293B;
    --text-muted: #64748B;
    --border-color: #E2E8F0;

    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);

    --radius-md: 12px;
    --radius-lg: 20px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', sans-serif;
}

body {
    background-color: var(--bg-color);
    color: var(--text-main);
    height: 100vh;
    overflow: hidden;
}

/* Layout */
.app-container {
    display: flex;
    height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 260px;
    background-color: var(--surface-color);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    padding: 1.5rem;
    transition: all 0.3s ease;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 3rem;
    padding-left: 0.5rem;
}

.nav-links {
    list-style: none;
    flex: 1;
}

.nav-links li {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.85rem 1rem;
    margin-bottom: 0.5rem;
    border-radius: var(--radius-md);
    cursor: pointer;
    color: var(--text-muted);
    font-weight: 500;
    transition: all 0.2s ease;
}

.nav-links li:hover {
    background-color: #EEF2FF;
    color: var(--primary-color);
}

.nav-links li.active {
    background-color: var(--primary-color);
    color: white;
    box-shadow: var(--shadow-md);
}

.add-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    color: white;
    border: none;
    padding: 1rem;
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s;
    box-shadow: var(--shadow-md);
}

.add-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

/* Main Content */
.main-content {
    flex: 1;
    padding: 2rem;
    overflow-y: auto;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}

.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.user-pill {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: var(--surface-color);
    padding: 0.5rem 1rem;
    border-radius: 50px;
    box-shadow: var(--shadow-sm);
    cursor: pointer;
}

.user-pill img {
    width: 32px;
    height: 32px;
    border-radius: 50%;
}

/* Views Logic */
.view {
    display: none;
    animation: fadeIn 0.3s ease;
}

.view.active-view {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Components: Summary Cards */
.summary-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.card {
    background: var(--surface-color);
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.card-icon {
    width: 56px;
    height: 56px;
    background: #EFF6FF;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
    color: var(--primary-color);
}

.card h2 {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-main);
}

.card .label {
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: 500;
}

/* Components: Transaction List */
.transaction-list {
    background: var(--surface-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: 1.5rem;
    min-height: 200px;
}

.transaction-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 0;
    border-bottom: 1px solid var(--border-color);
}

.transaction-item:last-child {
    border-bottom: none;
}

.t-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.t-icon {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: #F3F4F6;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

.t-info h4 {
    margin-top: 0;
    margin-bottom: 2px;
}

.t-info span {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.t-amount {
    font-weight: 700;
    color: var(--text-main);
}

/* Charts */
.chart-filters {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.filter-btn {
    padding: 0.5rem 1.5rem;
    border: none;
    background: var(--surface-color);
    border-radius: 8px;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s;
}

.filter-btn.active {
    background: var(--primary-color);
    color: white;
}

.charts-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 1.5rem;
}

.chart-card {
    background: var(--surface-color);
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

/* Calendar */
.calendar-container {
    background: var(--surface-color);
    padding: 2rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

.calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.calendar-header button {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-muted);
}

.calendar-grid-header {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    text-align: center;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 1rem;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 0.5rem;
}

.cal-day {
    aspect-ratio: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding-top: 0.5rem;
    border-radius: 8px;
    cursor: pointer;
    position: relative;
    font-size: 0.9rem;
}

.cal-day:hover {
    background-color: #F1F5F9;
}

.cal-day.today {
    background-color: #E0E7FF;
    color: var(--primary-color);
    font-weight: 700;
}

.cal-day.has-expense::after {
    content: '';
    width: 6px;
    height: 6px;
    background-color: var(--accent-color);
    border-radius: 50%;
    margin-top: 4px;
}

/* Profile */
.profile-card {
    background: var(--surface-color);
    padding: 3rem;
    border-radius: var(--radius-lg);
    max-width: 600px;
    margin: 0 auto;
    text-align: center;
}

.profile-header {
    position: relative;
    display: inline-block;
    margin-bottom: 2rem;
}

#profile-avatar-large {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    border: 4px solid #F1F5F9;
}

.edit-avatar-btn {
    position: absolute;
    bottom: 0;
    right: 0;
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 0.5rem;
    border-radius: 50%;
    cursor: pointer;
}

.form-group {
    text-align: left;
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--text-muted);
}

.form-group input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
}

.save-btn {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 0.75rem 2rem;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
}

.reset-db-btn {
    background: #EF4444;
    color: white;
    border: none;
    padding: 0.75rem 2rem;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    margin-left: 1rem;
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(4px);
    display: none;
    place-items: center;
    z-index: 1000;
}

.modal-overlay.open {
    display: grid;
    animation: fadeIn 0.2s;
}

.modal {
    background: var(--surface-color);
    width: 90%;
    max-width: 500px;
    border-radius: var(--radius-lg);
    padding: 2rem;
    box-shadow: var(--shadow-lg);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.close-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-muted);
}

.category-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
}

.cat-radio input {
    display: none;
}

.cat-radio .bubble {
    display: block;
    text-align: center;
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.9rem;
}

.cat-radio input:checked+.bubble {
    background: #EEF2FF;
    border-color: var(--primary-color);
    color: var(--primary-color);
    font-weight: 600;
}

.full-width {
    width: 100%;
    margin-top: 1rem;
}

/* Responsive */
@media (max-width: 768px) {
    .app-container {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        height: auto;
        padding: 1rem;
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
    }

    .logo {
        margin-bottom: 0;
        font-size: 1.25rem;
    }

    .nav-links {
        display: none;
    }

    /* Mobile Menu interaction needed or bottom bar */
    .add-btn span {
        display: none;
    }

    /* Simple mobile nav transformation */
    .nav-links {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: white;
        display: flex;
        justify-content: space-around;
        padding: 0.5rem;
        box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05);
        z-index: 100;
        margin-bottom: 0;
    }

    .nav-links li {
        flex-direction: column;
        gap: 0.25rem;
        font-size: 0.75rem;
        padding: 0.5rem;
    }

    .main-content {
        padding: 1rem;
        padding-bottom: 80px;
        /* Space for mobile nav */
    }

    .charts-grid {
        grid-template-columns: 1fr;
    }
}

/* Calendar Daily Note Tag */
.cal-day-note {
    font-size: 0.65rem;
    color: #4338ca;
    /* Indigo/Blue text */
    background: #E0E7FF;
    /* Light Blue bg */
    margin-top: 2px;
    padding: 2px 4px;
    border-radius: 4px;
    width: 95%;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}