* { margin: 0; padding: 0; box-sizing: border-box; }
        
        :root, [data-theme="dark"] {
            --bg-primary: #0a0a0f;
            --bg-secondary: #12121a;
            --bg-card: rgba(20, 20, 30, 0.8);
            --bg-input: rgba(30, 30, 45, 0.6);
            --text-primary: #f0f0f5;
            --text-secondary: #8888a0;
            --text-muted: #555566;
            --accent-gold: #ffd700;
            --accent-green: #00ff88;
            --accent-red: #ff4757;
            --accent-blue: #00d4ff;
            --accent-savings: #002654;
            --border-color: rgba(255, 255, 255, 0.06);
            --border-color-strong: rgba(255, 255, 255, 0.12);
            --shadow-color: rgba(0, 0, 0, 0.3);
            --grid-color: rgba(255, 255, 255, 0.02);
            --mesh-opacity: 0.08;
            --gradient-gold: linear-gradient(135deg, #ffd700 0%, #ffaa00 100%);
        }

        [data-theme="light"] {
            --bg-primary: #f8f9fc;
            --bg-secondary: #ffffff;
            --bg-card: rgba(255, 255, 255, 0.95);
            --bg-input: rgba(240, 242, 247, 0.8);
            --text-primary: #1a1a2e;
            --text-secondary: #6b7280;
            --text-muted: #9ca3af;
            --accent-gold: #d4a012;
            --accent-green: #059669;
            --accent-red: #dc2626;
            --accent-blue: #0284c7;
            --accent-savings: #002654;
            --border-color: rgba(0, 0, 0, 0.06);
            --border-color-strong: rgba(0, 0, 0, 0.1);
            --shadow-color: rgba(0, 0, 0, 0.08);
            --grid-color: rgba(0, 0, 0, 0.02);
            --mesh-opacity: 0.04;
            --gradient-gold: linear-gradient(135deg, #fbbf24 0%, #d4a012 100%);
        }

        html { scroll-behavior: smooth; }
        
        body {
            font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
            background: var(--bg-primary);
            color: var(--text-primary);
            min-height: 100vh;
            overflow-x: hidden;
            line-height: 1.6;
            transition: background-color 0.5s ease, color 0.3s ease;
        }

        .bg-mesh {
            position: fixed;
            top: 0; left: 0; right: 0; bottom: 0;
            z-index: -2;
            background: radial-gradient(ellipse at 20% 20%, rgba(0, 255, 136, var(--mesh-opacity)) 0%, transparent 50%),
                        radial-gradient(ellipse at 80% 80%, rgba(255, 71, 87, var(--mesh-opacity)) 0%, transparent 50%),
                        radial-gradient(ellipse at 50% 50%, rgba(0, 212, 255, 0.05) 0%, transparent 60%);
            animation: meshMove 20s ease-in-out infinite;
            transition: background 0.5s ease;
        }
        @keyframes meshMove {
            0%, 100% { transform: scale(1) rotate(0deg); }
            50% { transform: scale(1.1) rotate(2deg); }
        }

        .grid-overlay {
            position: fixed;
            top: 0; left: 0; right: 0; bottom: 0;
            z-index: -1;
            background-image: linear-gradient(var(--grid-color) 1px, transparent 1px),
                              linear-gradient(90deg, var(--grid-color) 1px, transparent 1px);
            background-size: 50px 50px;
            pointer-events: none;
        }

        .particle {
            position: fixed;
            pointer-events: none;
            z-index: -1;
            opacity: 0;
            animation: floatUp linear forwards;
        }
        @keyframes floatUp {
            0% { transform: translateY(100vh) rotate(0deg) scale(0.5); opacity: 0; }
            10% { opacity: 0.8; }
            90% { opacity: 0.8; }
            100% { transform: translateY(-100vh) rotate(720deg) scale(1); opacity: 0; }
        }
        @keyframes floatDown {
            0% { transform: translateY(-100vh) rotate(0deg) scale(0.5); opacity: 0; }
            10% { opacity: 0.8; }
            90% { opacity: 0.8; }
            100% { transform: translateY(100vh) rotate(720deg) scale(1); opacity: 0; }
        }

        .container {
            max-width: 1400px;
            margin: 0 auto;
            padding: 2rem;
            position: relative;
            z-index: 1;
            transition: margin-left 0.4s cubic-bezier(0.4, 0, 0.2, 1);
        }

        /* Sidebar Styles */
        .sidebar-toggle {
            position: fixed;
            top: 1.5rem;
            left: 1.5rem;
            z-index: 2000;
            background: var(--bg-card);
            border: 1px solid var(--border-color-strong);
            color: var(--text-primary);
            width: 44px;
            height: 44px;
            border-radius: 12px;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 1.25rem;
            backdrop-filter: blur(20px);
            transition: all 0.3s;
            box-shadow: 0 4px 15px var(--shadow-color);
        }

        .sidebar-toggle:hover {
            border-color: var(--accent-gold);
            transform: scale(1.05);
        }

        .sidebar {
            position: fixed;
            top: 0;
            left: -300px;
            width: 280px; /* Slightly narrower */
            height: 100vh;
            background: var(--bg-card);
            border-right: 1px solid var(--border-color);
            z-index: 1999;
            backdrop-filter: blur(30px);
            display: flex;
            flex-direction: column;
            transition: left 0.4s cubic-bezier(0.4, 0, 0.2, 1);
            padding: 1rem; /* Compact padding */
            box-shadow: 5px 0 30px rgba(0, 0, 0, 0.5); /* Elevation shadow */
        }

        .sidebar.active {
            left: 0;
        }

        .sidebar-backdrop {
            position: fixed;
            top: 0; left: 0; right: 0; bottom: 0;
            background: rgba(0, 0, 0, 0.5);
            backdrop-filter: blur(4px);
            z-index: 1998;
            opacity: 0;
            pointer-events: none;
            transition: opacity 0.4s cubic-bezier(0.4, 0, 0.2, 1);
        }

        body.sidebar-open .sidebar-backdrop {
            opacity: 1;
            pointer-events: auto;
        }

        .sidebar-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 1rem; /* Reduced margin */
            padding-bottom: 0.5rem; /* Reduced padding */
            border-bottom: 1px solid var(--border-color);
            margin-top: 3.5rem;
            flex-shrink: 0; /* Prevent shrinking */
        }

        .sidebar-brand {
            font-size: 1.1rem; /* Slightly smaller */
            font-weight: 800;
            background: linear-gradient(135deg, var(--text-primary) 0%, var(--accent-gold) 100%);
            -webkit-background-clip: text;
            -webkit-text-fill-color: transparent;
            text-decoration: none;
        }

        .sidebar-content {
            flex-grow: 1;
            display: flex;
            flex-direction: column;
            gap: 1.25rem; /* Reduced gap between groups */
            overflow-y: auto; /* Enable vertical scrolling */
            overflow-x: hidden;
            scrollbar-width: thin;
            scrollbar-color: var(--border-color-strong) transparent;
            padding-right: 2px;
        }

        /* Custom Scrollbar */
        .sidebar-content::-webkit-scrollbar {
            width: 4px;
        }
        .sidebar-content::-webkit-scrollbar-track {
            background: transparent;
        }
        .sidebar-content::-webkit-scrollbar-thumb {
            background-color: var(--border-color-strong);
            border-radius: 4px;
        }

        .user-info-section {
            background: var(--bg-input);
            padding: 0.75rem; /* Compact padding */
            border-radius: 12px; /* Tighter radius */
            border: 1px solid var(--border-color);
            flex-shrink: 0;
            transition: border-color 0.2s ease, background 0.2s ease;
        }

        .user-info-section:hover {
            border-color: var(--border-color-strong);
            background: rgba(255, 255, 255, 0.05);
        }

        .edit-username-btn {
            background: none;
            border: none;
            cursor: pointer;
            color: var(--text-secondary);
            font-size: 0.9rem;
            opacity: 0;
            transition: opacity 0.2s ease, color 0.2s ease, transform 0.2s ease;
            padding: 2px;
        }

        .user-info-section:hover .edit-username-btn {
            opacity: 1;
        }

        .edit-username-btn:hover {
            color: var(--accent-gold);
            transform: scale(1.1);
        }

        .sidebar-group {
            display: flex;
            flex-direction: column;
            gap: 0.25rem; /* Tighter item spacing */
        }

        .sidebar-label {
            font-size: 0.65rem; /* Smaller label */
            text-transform: uppercase;
            letter-spacing: 1.5px;
            color: var(--text-muted);
            font-weight: 700;
            margin-bottom: 0.25rem;
            padding-left: 0.75rem; /* Align with items */
        }

        .sidebar-link, .sidebar-btn {
            display: flex;
            align-items: center;
            gap: 0.6rem; /* Tighter icon gap */
            padding: 0.6rem 0.75rem; /* Compact item padding */
            border-radius: 8px; /* Tighter radius */
            color: var(--text-secondary);
            text-decoration: none;
            font-size: 0.85rem; /* Modern font size */
            font-weight: 500;
            transition: all 0.2s ease; /* Faster transition */
            border: 1px solid transparent;
            background: transparent;
            width: 100%;
            cursor: pointer;
            text-align: left;
            font-family: inherit;
        }

        .sidebar-link:hover, .sidebar-btn:hover {
            background: var(--bg-input);
            color: var(--text-primary);
            border-color: var(--border-color-strong);
            transform: translateX(2px); /* Subtle hover movement */
        }

        .sidebar-link.logout {
            color: var(--accent-red);
        }
        .sidebar-link.logout:hover {
            background: rgba(255, 71, 87, 0.1);
            border-color: rgba(255, 71, 87, 0.2);
        }

        .link-icon {
            font-size: 1.1rem;
        }

        .sidebar-footer {
            font-size: 0.75rem;
            color: var(--text-muted);
            text-align: center;
            padding-top: 1rem;
            border-top: 1px solid var(--border-color);
        }

        /* Navigation removed as requested */
        .navbar { display: none; }


        .navbar-brand {
            font-size: 1.25rem;
            font-weight: 800;
            background: linear-gradient(135deg, var(--text-primary) 0%, var(--accent-gold) 100%);
            -webkit-background-clip: text;
            -webkit-text-fill-color: transparent;
            text-decoration: none;
        }

        .navbar-nav {
            display: flex;
            align-items: center;
            gap: 1rem;
        }

        .nav-link {
            color: var(--text-secondary);
            text-decoration: none;
            padding: 0.5rem 1rem;
            border-radius: 8px;
            transition: all 0.3s;
            font-size: 0.9rem;
            font-weight: 500;
        }

        .nav-link:hover {
            color: var(--text-primary);
            background: var(--bg-input);
        }

        .nav-link.active {
            color: var(--accent-gold);
        }

        .user-greeting {
            display: flex;
            align-items: center;
            gap: 0.75rem;
            padding: 0.5rem 1rem;
            background: var(--bg-input);
            border-radius: 10px;
        }

        .user-avatar {
            width: 32px;
            height: 32px;
            border-radius: 8px;
            background: linear-gradient(135deg, var(--accent-gold), var(--accent-blue));
            display: flex;
            align-items: center;
            justify-content: center;
            font-weight: 700;
            font-size: 0.8rem;
            color: #0a0a0f;
        }

        .user-name {
            font-weight: 600;
            font-size: 0.9rem;
        }

        .btn-logout {
            background: rgba(255, 71, 87, 0.15);
            color: var(--accent-red);
            border: none;
            padding: 0.5rem 1rem;
            border-radius: 8px;
            cursor: pointer;
            font-family: inherit;
            font-size: 0.9rem;
            font-weight: 500;
            text-decoration: none;
            transition: all 0.3s;
        }

        .btn-logout:hover {
            background: var(--accent-red);
            color: white;
        }

        .btn-login {
            background: var(--gradient-gold);
            color: #0a0a0f;
            border: none;
            padding: 0.5rem 1.25rem;
            border-radius: 8px;
            cursor: pointer;
            font-family: inherit;
            font-size: 0.9rem;
            font-weight: 600;
            text-decoration: none;
            transition: all 0.3s;
        }

        .btn-login:hover {
            transform: translateY(-2px);
            box-shadow: 0 4px 15px rgba(255, 215, 0, 0.3);
        }

        .theme-toggle {
            background: var(--bg-input);
            border: 1px solid var(--border-color-strong);
            border-radius: 8px;
            padding: 0.5rem 0.75rem;
            cursor: pointer;
            font-size: 1rem;
            transition: all 0.3s;
        }

        .theme-toggle:hover {
            border-color: var(--accent-gold);
        }

        .demo-banner {
            background: rgba(255, 215, 0, 0.1);
            border: 1px solid rgba(255, 215, 0, 0.3);
            border-radius: 12px;
            padding: 1rem 1.5rem;
            margin-bottom: 2rem;
            display: flex;
            justify-content: space-between;
            align-items: center;
            flex-wrap: wrap;
            gap: 1rem;
        }

        .demo-banner-text {
            color: var(--accent-gold);
            font-size: 0.9rem;
        }

        .header {
            text-align: center;
            padding: 1rem 0 2rem;
        }

        .logo {
            font-size: clamp(2rem, 5vw, 3rem);
            font-weight: 800;
            letter-spacing: -2px;
            background: linear-gradient(135deg, var(--text-primary) 0%, var(--accent-gold) 50%, var(--text-primary) 100%);
            background-size: 200% auto;
            -webkit-background-clip: text;
            -webkit-text-fill-color: transparent;
            animation: shimmer 3s linear infinite;
        }
        @keyframes shimmer { to { background-position: 200% center; } }
        
        .subtitle {
            color: var(--text-secondary);
            font-size: 0.9rem;
            margin-top: 0.5rem;
            letter-spacing: 2px;
            text-transform: uppercase;
        }

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

        .metric-card {
            background: var(--bg-card);
            border: 1px solid var(--border-color);
            border-radius: 20px;
            padding: 1.5rem;
            position: relative;
            overflow: hidden;
            backdrop-filter: blur(20px);
            transition: all 0.4s;
        }

        .metric-card:hover {
            transform: translateY(-4px);
            border-color: rgba(255, 215, 0, 0.3);
            box-shadow: 0 20px 40px var(--shadow-color);
        }

        .metric-label {
            font-size: 0.75rem;
            color: var(--text-muted);
            text-transform: uppercase;
            letter-spacing: 2px;
            font-weight: 600;
        }

        .metric-value {
            font-family: 'JetBrains Mono', monospace;
            font-size: 2rem;
            font-weight: 700;
            margin: 0.5rem 0;
        }

        .metric-icon {
            position: absolute;
            top: 1.5rem;
            right: 1.5rem;
            font-size: 1.5rem;
            opacity: 0.5;
        }

        .revenue-card .metric-value { color: var(--accent-green); }
        .expense-card .metric-value { color: var(--accent-red); }
        .balance-card .metric-value { color: var(--accent-gold); }
        .balance-card.surplus .metric-value { color: var(--accent-green); }
        .balance-card.deficit .metric-value { color: var(--accent-red); }
        .planned-card .metric-value { color: var(--accent-savings); }

        .main-grid {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 2rem;
            margin-bottom: 2rem;
        }
        @media (max-width: 1024px) { .main-grid { grid-template-columns: 1fr; } }

        .panel {
            background: var(--bg-card);
            border: 1px solid var(--border-color);
            border-radius: 24px;
            padding: 1.5rem;
            backdrop-filter: blur(20px);
            position: relative;
        }

        .panel-header {
            display: flex;
            align-items: center;
            gap: 1rem;
            margin-bottom: 1rem;
            padding-bottom: 1rem;
            border-bottom: 1px solid var(--border-color);
        }

        .panel-icon {
            width: 44px;
            height: 44px;
            border-radius: 12px;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 1.3rem;
        }

        .revenue-panel .panel-icon { background: rgba(0, 255, 136, 0.15); }
        .expense-panel .panel-icon { background: rgba(255, 71, 87, 0.15); }
        [data-theme="light"] .revenue-panel .panel-icon { background: rgba(5, 150, 105, 0.15); }
        [data-theme="light"] .expense-panel .panel-icon { background: rgba(220, 38, 38, 0.15); }

        .panel-title { font-size: 1.1rem; font-weight: 700; }
        .panel-subtitle { font-size: 0.75rem; color: var(--text-muted); }

        /* Unified List Styles */
        .data-header {
            display: grid;
            grid-template-columns: 20px 1fr 100px 100px 32px;
            padding: 0 12px 10px;
            gap: 10px;
            font-size: 0.65rem;
            text-transform: uppercase;
            letter-spacing: 1px;
            color: var(--text-muted);
            font-weight: 600;
            border-bottom: 1px solid var(--border-color);
            margin-bottom: 8px;
        }


        .spending-list, .revenue-list {
            display: flex;
            flex-direction: column;
            gap: 4px;
            min-height: 50px;
        }
        
        .category-group {
            border: 1px solid var(--border-color);
            border-radius: 10px;
            background: rgba(255, 255, 255, 0.015);
            transition: all 0.3s;
            overflow: hidden;
            margin-bottom: 4px;
        }
        
        .category-header-row {
            background: var(--bg-input);
            display: flex;
            align-items: center;
            padding: 6px 12px;
            gap: 10px;
            border-bottom: 1px solid var(--border-color);
        }
        .category-drag-handle { cursor: move; color: var(--text-muted); font-size: 0.9rem; width: 20px; opacity: 0.6; }
        .category-name {
            background: transparent; border: none;
            color: var(--accent-gold); font-weight: 700; font-size: 0.85rem;
            flex-grow: 1; outline: none; padding: 4px 0;
            text-transform: uppercase; letter-spacing: 1px;
        }
        .revenue-panel .category-name { color: var(--accent-green); }

        .items-container {
            min-height: 50px;
            display: flex;
            flex-direction: column;
            gap: 4px;
            padding: 10px 6px;
            position: relative;
            transition: all 0.2s;
        }
        
        .items-container:empty::before {
            content: "DRAG & DROP ITEMS HERE";
            position: absolute;
            inset: 8px;
            border: 2px dashed var(--border-color-strong);
            border-radius: 10px;
            display: flex;
            align-items: center;
            justify-content: center;
            color: var(--text-muted);
            font-size: 0.7rem;
            font-weight: 600;
            letter-spacing: 1px;
            pointer-events: none;
            opacity: 0.6;
            background: rgba(255, 255, 255, 0.01);
            transition: all 0.2s;
        }

        body.is-dragging .items-container:empty::before {
            border-color: var(--accent-gold);
            color: var(--accent-gold);
            background: rgba(255, 215, 0, 0.05);
            opacity: 1;
        }

        body.is-dragging .revenue-panel .items-container:empty::before {
            border-color: var(--accent-green);
            color: var(--accent-green);
            background: rgba(0, 255, 136, 0.05);
        }

        .spending-item, .revenue-item {
            display: grid;
            grid-template-columns: 24px 1fr 100px 100px 32px;
            align-items: center;
            padding: 6px 14px;
            gap: 10px;
            background: var(--bg-input);
            border-radius: 8px;
            transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
            border: 1px solid transparent;
        }
        .spending-item:hover, .revenue-item:hover { 
            background: rgba(255, 255, 255, 0.04); 
            border-color: var(--border-color-strong);
            transform: translateX(4px);
        }
        .revenue-panel .revenue-item:hover { border-color: var(--accent-green); }
        
        .spending-item.sortable-ghost, .revenue-item.sortable-ghost { opacity: 0.4; background: var(--accent-gold); }
        
        .spending-item.indented, .revenue-item.indented {
            margin-left: 20px;
            background: rgba(255, 255, 255, 0.008);
            border-left: 3px solid var(--border-color-strong);
            border-radius: 0 8px 8px 0;
        }
        
        .item-drag-handle { cursor: move; color: var(--text-muted); font-size: 0.85rem; opacity: 0.5; text-align: center; }
        .item-drag-handle:hover { opacity: 0.9; color: var(--text-primary); }

        .delete-btn {
            background: rgba(255, 71, 87, 0.08);
            border: none;
            color: var(--accent-red);
            width: 30px;
            height: 30px;
            border-radius: 6px;
            cursor: pointer;
            font-size: 1.3rem;
            font-weight: 300;
            transition: all 0.2s;
            display: flex;
            align-items: center;
            justify-content: center;
            padding: 0;
            line-height: 1;
        }
        .delete-btn:hover { background: var(--accent-red); color: white; transform: scale(1.1); }

        .add-btn {
            width: 100%;
            padding: 12px;
            margin-top: 0.75rem;
            background: transparent;
            border: 2px dashed var(--border-color-strong);
            border-radius: 12px;
            color: var(--text-secondary);
            font-family: inherit;
            font-size: 0.85rem;
            font-weight: 600;
            cursor: pointer;
            transition: all 0.3s;
        }
        .add-btn:hover { border-color: var(--accent-gold); color: var(--accent-gold); background: rgba(255, 215, 0, 0.05); }
        .revenue-panel .add-btn:hover { border-color: var(--accent-green); color: var(--accent-green); background: rgba(0, 255, 136, 0.05); }
        .expense-panel .add-btn:hover { border-color: var(--accent-red); color: var(--accent-red); background: rgba(255, 71, 87, 0.05); }

        .savings-panel {
            grid-column: 1 / -1;
            border-color: var(--accent-savings);
            transition: all 0.3s;
        }
        .savings-panel .panel-icon { background: rgba(0, 38, 84, 0.15); }
        .savings-panel .panel-title { color: var(--accent-savings); }
        .savings-panel .add-btn:hover { border-color: var(--accent-savings); color: var(--accent-savings); background: rgba(0, 38, 84, 0.05); }
        
        .savings-panel.disabled {
            opacity: 0.5;
            pointer-events: none;
            filter: grayscale(1);
        }

        .savings-list {
            display: flex;
            flex-direction: column;
            gap: 4px;
            min-height: 50px;
        }

        .savings-item {
            display: grid;
            grid-template-columns: 24px 1.2fr 1fr 2.2fr 120px 32px;
            align-items: center;
            padding: 6px 14px;
            gap: 10px;
            background: var(--bg-input);
            border-radius: 8px;
            transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
            border: 1px solid transparent;
        }
        .savings-item:hover {
            background: rgba(255, 255, 255, 0.04);
            border-color: var(--border-color-strong);
            transform: translateX(4px);
        }
        .savings-panel .savings-item:hover { border-color: var(--accent-savings); }

        .strategy-select {
            background: transparent;
            border: 1px solid transparent;
            border-radius: 6px;
            color: var(--text-secondary);
            font-size: 0.75rem;
            padding: 4px;
            outline: none;
            width: 100%;
            transition: all 0.3s;
        }
        .strategy-select:hover, .strategy-select:focus { border-color: var(--border-color-strong); color: var(--text-primary); }

        .strategy-inputs {
            display: flex;
            gap: 12px;
            align-items: center;
        }

        .input-mini {
            background: transparent;
            border: 1px solid transparent;
            border-radius: 4px;
            color: var(--text-primary);
            padding: 4px 8px;
            font-size: 0.8rem;
            width: 100%;
            min-width: 60px;
            transition: all 0.3s;
            text-align: right;
        }
        [data-theme="light"] .input-mini { background: transparent; }
        .input-mini:focus, .input-mini:hover { border-color: var(--border-color-strong); outline: none; }

        .add-btn.group-add:hover {
            border-color: var(--accent-gold) !important;
            color: var(--accent-gold) !important;
            background: rgba(255, 215, 0, 0.05) !important;
        }

        .actions-row {
            display: flex;
            gap: 0.75rem;
            margin-top: 0.75rem;
        }
        .actions-row .add-btn {
            margin-top: 0;
            width: auto;
        }
        .actions-row .item-add {
            flex: 3;
        }
        .actions-row .group-add {
            flex: 1;
        }

        /* Inputs */
        .input-name {
            background: transparent; border: none;
            color: var(--text-primary); font-size: 0.85rem;
            font-family: inherit; width: 100%;
            outline: none;
            padding: 6px 0;
        }
        .input-name::placeholder { color: var(--text-muted); }
        .input-name:focus { color: var(--accent-gold); }
        .revenue-panel .input-name:focus { color: var(--accent-green); }
        .savings-panel .input-name:focus { color: var(--accent-savings); }

        .input-amount-group {
            display: flex; align-items: center;
            background: rgba(0, 0, 0, 0.12); border-radius: 6px;
            padding: 0 8px; border: 1px solid transparent;
            transition: all 0.3s;
        }
        [data-theme="light"] .input-amount-group { background: rgba(255, 255, 255, 0.5); }
        .input-amount-group:focus-within { border-color: var(--accent-gold); }
        .revenue-panel .input-amount-group:focus-within { border-color: var(--accent-green); }
        .savings-panel .input-amount-group:focus-within { border-color: var(--accent-savings); }

        .currency-symbol { color: var(--text-muted); font-weight: 600; margin-right: 4px; font-size: 0.75rem; }

        .input-amount {
            background: transparent; border: none;
            color: var(--text-primary); font-size: 0.85rem;
            font-family: 'JetBrains Mono', monospace;
            width: 100%; outline: none; text-align: right;
            padding: 6px 0;
        }

        .input-period {
            background: transparent; border: 1px solid var(--border-color-strong);
            border-radius: 6px; color: var(--text-secondary);
            font-size: 0.7rem; padding: 4px;
            outline: none; cursor: pointer; width: 100%;
        }
        .input-period:hover { border-color: var(--accent-gold); }
        .revenue-panel .input-period:hover { border-color: var(--accent-green); }
        .savings-panel .input-period:hover { border-color: var(--accent-savings); }



        .generate-section { 


            text-align: center; 
            margin: 2rem 0;
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 1.5rem;
        }

        .view-period-toggle {
            display: flex;
            background: var(--bg-input);
            padding: 4px;
            border-radius: 100px;
            border: 1px solid var(--border-color-strong);
        }
        .view-period-btn {
            padding: 8px 24px;
            border-radius: 100px;
            border: none;
            background: transparent;
            color: var(--text-secondary);
            font-weight: 600;
            font-size: 0.85rem;
            cursor: pointer;
            transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        }
        .view-period-btn.active {
            background: var(--gradient-gold);
            color: #0a0a0f;
            box-shadow: 0 4px 12px rgba(255, 215, 0, 0.2);
        }

        .generate-btn {
            padding: 1rem 3rem;
            font-size: 1rem;
            font-weight: 700;
            font-family: inherit;
            text-transform: uppercase;
            letter-spacing: 2px;
            color: #0a0a0f;
            background: var(--gradient-gold);
            border: none;
            border-radius: 100px;
            cursor: pointer;
            overflow: hidden;
            transition: all 0.4s;
            box-shadow: 0 10px 40px rgba(255, 215, 0, 0.3);
        }
        .generate-btn:hover {
            transform: translateY(-3px) scale(1.02);
            box-shadow: 0 20px 60px rgba(255, 215, 0, 0.4);
        }

        .chart-container {
            background: var(--bg-card);
            border: 1px solid var(--border-color);
            border-radius: 24px;
            padding: 1.5rem;
            backdrop-filter: blur(20px);
            margin-bottom: 2rem;
            position: relative;
            overflow: hidden;
        }
        .chart-container::before {
            content: '';
            position: absolute;
            top: 0; left: 0; right: 0;
            height: 1px;
            background: linear-gradient(90deg, transparent, var(--accent-gold), transparent);
        }
        #sankey-chart { 
            min-height: 400px;
            height: 750px; 
            width: 100%;
            display: flex;
            align-items: center;
            justify-content: center;
        }

        .empty-state {
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            text-align: center;
            padding: 4rem 2rem;
            border: 2px dashed var(--border-color-strong);
            border-radius: 24px;
            background: rgba(255, 255, 255, 0.01);
            transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
            max-width: 600px;
            width: 90%;
            animation: fadeIn 0.8s ease-out;
            cursor: pointer;
        }

        .empty-state:hover {
            border-color: var(--accent-gold);
            background: rgba(255, 215, 0, 0.03);
            transform: scale(1.02);
            box-shadow: 0 30px 60px rgba(0, 0, 0, 0.2);
        }

        .empty-state-icon {
            font-size: 5rem;
            margin-bottom: 2rem;
            filter: drop-shadow(0 0 30px rgba(255, 215, 0, 0.3));
            animation: float 4s ease-in-out infinite;
        }

        .empty-state h3 {
            font-size: 2rem;
            font-weight: 800;
            margin-bottom: 1rem;
            color: var(--text-primary);
            letter-spacing: -0.5px;
        }

        .empty-state p {
            font-size: 1.1rem;
            color: var(--text-secondary);
            max-width: 450px;
            margin-bottom: 2.5rem;
            line-height: 1.6;
        }

        @keyframes float {
            0%, 100% { transform: translateY(0); }
            50% { transform: translateY(-15px); }
        }

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


        
        .chart-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 1rem;
        }
        .chart-title {
            font-size: 1rem;
            font-weight: 600;
            color: var(--text-secondary);
        }
        .chart-actions {
            display: flex;
            gap: 0.5rem;
        }
        .export-btn {
            background: var(--bg-input);
            border: 1px solid var(--border-color-strong);
            color: var(--text-secondary);
            padding: 0.5rem 1rem;
            border-radius: 8px;
            font-size: 0.8rem;
            font-weight: 500;
            cursor: pointer;
            transition: all 0.3s;
        }
        .export-btn:hover {
            background: var(--accent-gold);
            color: #0a0a0f;
            border-color: var(--accent-gold);
        }

        .status-indicator {
            position: fixed;
            top: 5rem;
            right: 2rem;
            padding: 1rem 1.5rem;
            background: var(--bg-card);
            border: 1px solid var(--border-color);
            border-radius: 16px;
            backdrop-filter: blur(20px);
            display: none;
            align-items: center;
            gap: 12px;
            z-index: 100;
            animation: slideIn 0.5s;
            box-shadow: 0 10px 40px var(--shadow-color);
        }
        @keyframes slideIn { from { transform: translateX(100px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
        .status-indicator.surplus { border-color: rgba(0, 255, 136, 0.3); }
        .status-indicator.deficit { border-color: rgba(255, 71, 87, 0.3); }
        .status-emoji { font-size: 1.5rem; }
        .status-text { font-weight: 600; }
        .status-amount { font-family: 'JetBrains Mono', monospace; font-weight: 700; }
        .status-indicator.surplus .status-amount { color: var(--accent-green); }
        .status-indicator.deficit .status-amount { color: var(--accent-red); }

        .loading {
            display: none;
            position: fixed;
            top: 0; left: 0; right: 0; bottom: 0;
            background: rgba(10, 10, 15, 0.9);
            z-index: 1000;
            align-items: center;
            justify-content: center;
            flex-direction: column;
            gap: 1rem;
        }
        [data-theme="light"] .loading { background: rgba(248, 249, 252, 0.95); }
        .loading.active { display: flex; }
        
        /* Sankey Label Enhancements for Dark Mode */
        [data-theme="dark"] .sankey-node .node-label {
            filter: drop-shadow(0px 1px 2px rgba(0, 0, 0, 1)) drop-shadow(0px 0px 4px rgba(0, 0, 0, 0.8));
            font-weight: 600 !important;
        }

        .spinner {
            width: 50px;
            height: 50px;
            border: 3px solid var(--border-color);
            border-top-color: var(--accent-gold);
            border-radius: 50%;
            animation: spin 1s linear infinite;
        }
        @keyframes spin { to { transform: rotate(360deg); } }
        .loading-text { color: var(--text-secondary); font-weight: 500; }

        .footer {
            text-align: center;
            padding: 3rem 1.5rem 2rem;
            color: var(--text-muted);
            font-size: 0.85rem;
            border-top: 1px solid var(--border-color);
            margin-top: 2rem;
        }

        .footer-content {
            display: flex;
            flex-direction: column;
            gap: 0.75rem;
            max-width: 600px;
            margin: 0 auto;
        }

        .footer-row.links {
            display: flex;
            justify-content: center;
            gap: 2rem;
        }

        .footer-row.links a {
            color: var(--text-secondary);
            text-decoration: none;
            transition: all 0.3s ease;
            font-weight: 500;
        }

        .footer-row.links a:hover {
            color: var(--accent-gold);
            transform: translateY(-1px);
        }

        .flash-messages { 
            position: fixed;
            top: 2rem;
            left: 50%;
            transform: translateX(-50%);
            z-index: 2000;
            width: 100%;
            max-width: 400px;
            pointer-events: none;
        }
        .flash-message { 
            padding: 12px 16px; 
            border-radius: 12px; 
            margin-bottom: 8px; 
            font-size: 0.9rem; 
            box-shadow: 0 10px 30px rgba(0,0,0,0.2);
            animation: slideDownFade 0.5s cubic-bezier(0.4, 0, 0.2, 1) forwards;
            pointer-events: auto;
            text-align: center;
        }
        @keyframes slideDownFade {
            from { transform: translateY(-20px); opacity: 0; }
            to { transform: translateY(0); opacity: 1; }
        }
        .flash-message.fade-out {
            animation: fadeOut 0.8s forwards;
        }
        @keyframes fadeOut {
            to { opacity: 0; transform: translateY(-10px); }
        }
        .flash-message.success { background: rgba(0, 255, 136, 0.1); border: 1px solid rgba(0, 255, 136, 0.3); color: var(--accent-green); }
        .flash-message.error { background: rgba(255, 71, 87, 0.1); border: 1px solid rgba(255, 71, 87, 0.3); color: var(--accent-red); }

        @media (max-width: 768px) {
            .container { padding: 1rem; }
            body.sidebar-open .container { margin-left: 0; }
            .sidebar { width: 85%; max-width: 320px; }
            #sankey-chart { height: 350px; }
        }

        /* Modal System */
        .modal-overlay {
            position: fixed;
            top: 0; left: 0; right: 0; bottom: 0;
            background: rgba(0, 0, 0, 0.7);
            backdrop-filter: blur(8px);
            z-index: 3000;
            display: none;
            justify-content: center;
            align-items: center;
            animation: modalFadeIn 0.3s ease-out forwards;
        }

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

        .modal-window {
            background: var(--bg-card);
            border: 1px solid var(--border-color);
            border-radius: 24px;
            padding: 2.5rem;
            max-width: 480px;
            width: 90%;
            text-align: center;
            box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
            position: relative;
            overflow: hidden;
            animation: modalScaleIn 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
        }

        @keyframes modalScaleIn {
            from { transform: scale(0.95); opacity: 0; }
            to { transform: scale(1); opacity: 1; }
        }

        .modal-icon {
            font-size: 3rem;
            margin-bottom: 1.5rem;
            display: inline-block;
            filter: drop-shadow(0 0 20px rgba(255, 215, 0, 0.2));
        }

        .modal-title {
            color: var(--text-primary);
            font-size: 1.75rem;
            margin-bottom: 1rem;
            font-weight: 800;
            letter-spacing: -0.5px;
        }

        .modal-description {
            color: var(--text-secondary);
            font-size: 1rem;
            line-height: 1.6;
            margin-bottom: 2rem;
        }

        .form-group {
            margin-bottom: 1.5rem;
            text-align: left;
        }

        .form-label {
            display: block;
            margin-bottom: 0.75rem;
            color: var(--text-secondary);
            font-size: 0.9rem;
            font-weight: 500;
            margin-left: 4px;
        }

        .form-input {
            width: 100%;
            background: var(--bg-input);
            border: 1px solid var(--border-color-strong);
            border-radius: 12px;
            padding: 12px 16px;
            color: var(--text-primary);
            font-family: inherit;
            font-size: 1rem;
            outline: none;
            transition: all 0.3s;
        }

        .form-input:focus {
            border-color: var(--accent-gold);
            background: rgba(255, 255, 255, 0.05);
            box-shadow: 0 0 0 4px rgba(255, 215, 0, 0.1);
        }

        .modal-actions {
            display: flex;
            flex-direction: column;
            gap: 1rem;
            margin-top: 2rem;
        }

        .modal-btn {
            width: 100%;
            padding: 14px;
            border-radius: 12px;
            font-size: 1rem;
            font-weight: 600;
            cursor: pointer;
            transition: all 0.3s;
            border: none;
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 0.5rem;
        }

        .modal-btn-primary {
            background: var(--gradient-gold);
            color: #0a0a0f;
            box-shadow: 0 4px 15px rgba(255, 215, 0, 0.2);
        }

        .modal-btn-primary:hover {
            transform: translateY(-2px);
            box-shadow: 0 8px 25px rgba(255, 215, 0, 0.3);
        }

        .modal-btn-danger {
            background: rgba(255, 71, 87, 0.15);
            color: var(--accent-red);
            border: 1px solid rgba(255, 71, 87, 0.3);
        }

        .modal-btn-danger:hover {
            background: var(--accent-red);
            color: white;
            border-color: var(--accent-red);
            transform: translateY(-2px);
            box-shadow: 0 8px 25px rgba(255, 71, 87, 0.3);
        }

        .modal-btn-secondary {
            background: transparent;
            border: 1px solid var(--border-color-strong);
            color: var(--text-secondary);
        }

        .modal-btn-secondary:hover {
            border-color: var(--text-primary);
            color: var(--text-primary);
            background: var(--bg-input);
        }
        
        /* Staging Environment Indicator */
        .staging-badge {
            display: inline-block;
            vertical-align: middle;
            font-size: 0.8rem;
            background: rgba(255, 170, 0, 0.2);
            color: #ffaa00;
            -webkit-text-fill-color: #ffaa00; /* Override parent gradient text */
            border: 1px solid #ffaa00;
            padding: 4px 8px;
            border-radius: 6px;
            margin-left: 10px;
            letter-spacing: 1px;
            text-transform: uppercase;
            font-weight: 700;
            animation: pulse 2s infinite;
        }

        @keyframes pulse {
            0% { opacity: 0.7; }
            50% { opacity: 1; box-shadow: 0 0 10px rgba(255, 170, 0, 0.3); }
            100% { opacity: 0.7; }
        }

