:root {
    --primary-color: #6366f1;
    --secondary-color: #ec4899;
    --accent-color: #8b5cf6;
    --background-color: #0f172a;
    --surface-color: #1e293b;
    --text-color: #f8fafc;
    --text-muted: #94a3b8;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --card-bg: rgba(30, 41, 59, 0.7);
    --glass-border: rgba(255, 255, 255, 0.1);

    /* Global Reset */
    * {
        box-sizing: border-box;
        margin: 0;
        padding: 0;
    }

    body {
        font-family: 'Inter', sans-serif;
        background-color: var(--background-color);
        color: var(--text-color);
        min-height: 100vh;
        display: flex;
    }

    /* Glassmorphism Utilities */
    .glass {
        background: var(--card-bg);
        backdrop-filter: blur(10px);
        -webkit-backdrop-filter: blur(10px);
        border: 1px solid var(--glass-border);
        box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
        border-radius: 1rem;
    }

    /* Layout */
    .sidebar {
        width: 250px;
        background: rgba(15, 23, 42, 0.95);
        border-right: 1px solid var(--glass-border);
        height: 100vh;
        position: fixed;
        top: 0;
        left: 0;
        padding: 1.5rem;
        display: flex;
        flex-direction: column;
        z-index: 50;
        transition: width 0.3s ease-in-out, transform 0.3s ease-in-out;
        overflow: hidden;
        /* Hide text when shrunk */
    }

    /* Mini Sidebar (Desktop Closed) */
    .sidebar.closed {
        width: 80px;
        transform: none;
        /* Don't hide completely on desktop */
    }

    .sidebar.closed .brand span:last-child {
        display: none;
    }

    .sidebar.closed .nav-link span {
        display: none;
    }

    .sidebar.closed .brand {
        justify-content: center;
        margin-right: 0;
    }

    .sidebar.closed .nav-link {
        justify-content: center;
        padding: 0.75rem;
    }

    .sidebar.closed .nav-link i {
        margin-right: 0;
    }

    .main-content {
        margin-left: 250px;
        padding: 2rem;
        width: calc(100% - 250px);
        min-height: 100vh;
        background: radial-gradient(circle at top right, #1e1b4b, #0f172a);
        transition: margin-left 0.3s ease-in-out, width 0.3s ease-in-out;
    }

    .main-content.expanded {
        margin-left: 80px;
        width: calc(100% - 80px);
    }

    /* Menu Toggle */
    .menu-toggle {
        display: block;
        position: fixed;
        top: 1.5rem;
        left: 265px;
        /* Open sidebar width (250px) + gap (15px) */
        background: var(--surface-color);
        color: var(--text-color);
        border: 1px solid var(--glass-border);
        font-size: 1.25rem;
        cursor: pointer;
        z-index: 60;
        padding: 0.5rem;
        border-radius: 0.5rem;
        transition: left 0.3s ease-in-out;
        box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    }

    .menu-toggle:hover {
        background: rgba(255, 255, 255, 0.1);
        color: var(--primary-color);
    }

    /* When sidebar is closed (Desktop) */
    body.sidebar-closed .menu-toggle {
        left: 95px;
        /* Closed width (80px) + gap (15px) */
    }

    /* Responsive Design (Mobile) */
    @media (max-width: 768px) {
        .menu-toggle {
            left: 1rem;
            /* Default mobile position */
            top: 1rem;
            right: auto;
            background: var(--primary-color);
            color: white;
        }

        body.sidebar-active .menu-toggle {
            left: 265px;
            /* When mobile sidebar is open */
        }

        .sidebar {
            transform: translateX(-100%);
            /* Hidden completely on mobile */
            width: 250px;
            /* Reset width */
        }

        .sidebar.active {
            transform: translateX(0);
        }

        .sidebar.closed {
            width: 250px;
            /* No mini mode on mobile */
            transform: translateX(-100%);
        }

        .sidebar.closed .nav-link span,
        .sidebar.closed .brand span {
            display: inline;
            /* Show text on mobile */
        }

        .main-content {
            margin-left: 0 !important;
            /* Force full width */
            width: 100% !important;
            padding: 1rem;
        }
    }

    /* Navigation */
    .nav-link {
        display: flex;
        align-items: center;
        padding: 0.75rem 1rem;
        color: var(--text-muted);
        text-decoration: none;
        border-radius: 0.5rem;
        margin-bottom: 0.5rem;
        transition: all 0.3s ease;
    }

    .nav-link:hover,
    .nav-link.active {
        background: rgba(99, 102, 241, 0.1);
        color: var(--primary-color);
    }

    .nav-link i {
        margin-right: 0.75rem;
        font-size: 1.25rem;
    }

    .brand {
        font-size: 1.5rem;
        font-weight: 700;
        color: var(--text-color);
        margin-bottom: 2rem;
        display: flex;
        align-items: center;
        gap: 0.5rem;
    }

    .brand span {
        color: var(--primary-color);
    }

    /* Components */
    .card {
        padding: 1.5rem;
        margin-bottom: 1.5rem;
    }

    .grid-4 {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
        gap: 1.5rem;
    }

    .grid-2 {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
        gap: 1.5rem;
    }

    h1,
    h2,
    h3 {
        margin-top: 0;
    }

    .stat-value {
        font-size: 1.875rem;
        font-weight: 700;
        margin: 0.5rem 0;
    }

    .stat-label {
        color: var(--text-muted);
        font-size: 0.875rem;
    }

    /* Tables */
    .table-container {
        overflow-x: auto;
    }

    table {
        width: 100%;
        border-collapse: collapse;
        color: var(--text-color);
    }

    th {
        text-align: left;
        padding: 1rem;
        color: var(--text-muted);
        border-bottom: 1px solid var(--glass-border);
    }

    td {
        padding: 1rem;
        border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    }

    /* Buttons */
    .btn {
        display: inline-flex;
        align-items: center;
        padding: 0.5rem 1rem;
        border-radius: 0.5rem;
        font-weight: 500;
        text-decoration: none;
        transition: all 0.2s;
        border: none;
        cursor: pointer;
        gap: 0.5rem;
    }

    .btn-primary {
        background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
        color: white;
        box-shadow: 0 4px 6px -1px rgba(99, 102, 241, 0.3);
    }

    .btn-primary:hover {
        transform: translateY(-1px);
        box-shadow: 0 6px 8px -1px rgba(99, 102, 241, 0.4);
    }

    .btn-danger {
        background: rgba(239, 68, 68, 0.1);
        color: var(--danger-color);
    }

    .btn-danger:hover {
        background: rgba(239, 68, 68, 0.2);
    }

    .btn-success {
        background: rgba(16, 185, 129, 0.1);
        color: var(--success-color);
    }

    /* Badge */
    .badge {
        padding: 0.25rem 0.75rem;
        border-radius: 9999px;
        font-size: 0.75rem;
        font-weight: 600;
    }

    .badge-income {
        background: rgba(16, 185, 129, 0.1);
        color: var(--success-color);
    }

    .badge-expense {
        background: rgba(239, 68, 68, 0.1);
        color: var(--danger-color);
    }

    /* Forms */
    .form-group {
        margin-bottom: 1rem;
    }

    label {
        display: block;
        margin-bottom: 0.5rem;
        color: var(--text-muted);
    }

    input,
    select,
    textarea {
        width: 100%;
        padding: 0.75rem;
        border-radius: 0.5rem;
        background: rgba(15, 23, 42, 0.5);
        border: 1px solid var(--glass-border);
        color: white;
        font-family: inherit;
    }

    input:focus,
    select:focus,
    textarea:focus {
        outline: none;
        border-color: var(--primary-color);
        box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
    }

    /* Modal */
    .modal-overlay {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.7);
        display: flex;
        align-items: center;
        justify-content: center;
        z-index: 70;
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.3s;
    }

    .modal-overlay.active {
        opacity: 1;
        pointer-events: auto;
    }

    .modal {
        background: #1e293b;
        padding: 2rem;
        border-radius: 1rem;
        width: 100%;
        max-width: 500px;
        border: 1px solid var(--glass-border);
        transform: translateY(20px);
        transition: transform 0.3s;
    }

    .modal-overlay.active .modal {
        transform: translateY(0);
    }