        :root {
            --ink: #075E54;
            --ink-soft: #0a6d61;
            --ink-border: #0b4f47;
            --amber: #25D366;
            --amber-dark: #128C7E;
            --amber-tint: #dcf8e6;
            --paper: #eef0f3;
            --panel: #f5f6f8;
            --card: #ffffff;
            --line: #e2e5eb;
            --text: #1b1d22;
            --text-muted: #6b7078;
            --ok: #1f9d55;
            --danger: #c0392b;
            --sidebar-w: 268px;
            --accent: var(--amber);
            --accent-dark: var(--amber-dark);
            --border: var(--line);
        }
        * { scroll-behavior: smooth; box-sizing: border-box; }
        body {
            font-family: 'Space Grotesk', 'Noto Sans Bengali', sans-serif;
            background: var(--paper);
            color: var(--text);
            -webkit-tap-highlight-color: transparent;
            font-variant-numeric: tabular-nums;
        }
        h1, h2, h3, h4 { font-family: 'Space Grotesk', 'Noto Sans Bengali', sans-serif; letter-spacing: -0.01em; }

        /* ---------- App shell: sidebar + topbar ---------- */
        .app-shell { min-height: 100vh; }
        .topbar {
            display: flex; align-items: center; gap: .85rem;
            background: var(--ink); color: #fff;
            padding: .8rem 1rem; position: sticky; top: 0; z-index: 30;
            box-shadow: 0 2px 10px rgba(0,0,0,.15);
        }
        .topbar .brand-icon { color: var(--amber); font-size: 1.4rem; }
        .hamburger {
            background: transparent; border: 1px solid var(--ink-border); color: #fff;
            width: 42px; height: 42px; border-radius: .6rem; flex-shrink: 0;
        }
        .hamburger:active { background: var(--ink-soft); }
        @media (min-width: 1024px) { .topbar { display: none; } }

        .sidebar-overlay {
            position: fixed; inset: 0; background: rgba(10,10,12,.55); z-index: 35;
            opacity: 0; pointer-events: none; transition: opacity .2s ease;
        }
        .sidebar-overlay.open { opacity: 1; pointer-events: auto; }
        @media (min-width: 1024px) { .sidebar-overlay { display: none; } }

        .sidebar {
            position: fixed; top: 0; left: 0; height: 100vh; width: var(--sidebar-w);
            background: var(--ink); z-index: 40; display: flex; flex-direction: column;
            transform: translateX(-100%); transition: transform .25s ease;
        }
        .sidebar.open { transform: translateX(0); }
        @media (min-width: 1024px) { .sidebar { transform: translateX(0); } }

        .sidebar-brand {
            display: flex; align-items: center; gap: .8rem;
            padding: 1.35rem 1.35rem 1.1rem; border-bottom: 1px solid var(--ink-border);
        }
        .sidebar-brand i { color: var(--amber); font-size: 1.6rem; }
        .sidebar-brand h1 { font-size: 1.15rem; color: #fff; margin: 0; font-weight: 700; }
        .sidebar-brand p { font-size: .72rem; color: #8a8f99; margin: .2rem 0 0; }

        .main-content { padding: 1rem; }
        @media (min-width: 1024px) { .main-content { margin-left: var(--sidebar-w); padding: 1.75rem 2.25rem 2.5rem; } }
        .main-content-inner { max-width: 1360px; margin: 0 auto; }

        .app-footer { text-align: center; padding: 2rem 0 .5rem; color: var(--text-muted); font-size: .85rem; }

        .premium-card {
            background: var(--card);
            border-radius: 10px;
            border: 1px solid var(--line);
            border-top: 3px solid var(--ink);
            box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.05), 0 4px 6px -4px rgb(0 0 0 / 0.05);
        }
        /* Tighter, more utilitarian radius scale than Tailwind's soft defaults */
        .rounded-2xl { border-radius: 10px !important; }
        .rounded-xl { border-radius: 7px !important; }

        /* ---------- Stat cards as a single ledger strip ---------- */
        .ledger-strip {
            display: grid;
            grid-template-columns: repeat(2, 1fr);
            background: var(--card);
            border: 1px solid var(--line);
            border-radius: 10px;
            border-top: 3px solid var(--amber);
            overflow: hidden;
        }
        @media (min-width: 640px) { .ledger-strip { grid-template-columns: repeat(5, 1fr); } }
        .ledger-strip .stat-card:nth-child(5) { grid-column: span 2; }
        @media (min-width: 640px) { .ledger-strip .stat-card:nth-child(5) { grid-column: span 1; } }
        .stat-card {
            color: var(--text);
            background: transparent;
            padding: 1.1rem .9rem;
            border-bottom: 1px solid var(--line);
            border-right: 1px solid var(--line);
            position: relative;
        }
        .ledger-strip .stat-card:nth-child(2n) { border-right: none; }
        @media (min-width: 640px) {
            .ledger-strip .stat-card { border-bottom: none; }
            .ledger-strip .stat-card:last-child { border-right: none; }
        }
        .stat-card i {
            color: var(--amber-dark); background: none;
            width: auto; height: auto; font-size: 1.1rem !important;
            display: block; margin-bottom: .5rem;
        }
        .stat-card h3 { color: var(--text-muted); font-weight: 600; margin-bottom: .3rem; text-transform: uppercase; letter-spacing: .03em; font-size: .72rem !important; }
        .stat-card p { color: var(--text); font-weight: 700; }
        .stat-card.due-card i, .stat-card.due-card p { color: var(--danger); }

        /* ---------- Tabs repurposed as vertical sidebar nav ---------- */
        .tab-container {
            display: flex;
            overflow-x: auto;
            -webkit-overflow-scrolling: touch;
            scrollbar-width: none;
        }
        .tab-container::-webkit-scrollbar { display: none; }
        .tab-btn {
            white-space: nowrap;
            flex-shrink: 0;
            transition: all 0.15s ease;
            min-height: 48px;
        }
        .sidebar .tab-container {
            flex-direction: column; overflow-y: auto; flex: 1;
            padding: .85rem; gap: .2rem;
        }
        .sidebar .tab-btn {
            display: flex; align-items: center; gap: .8rem; width: 100%; text-align: left;
            padding: .75rem .9rem; border-radius: .65rem; border-left: 3px solid transparent;
            border-bottom: none !important; color: #a7abb4; background: none; font-weight: 500;
        }
        .sidebar .tab-btn i { width: 1.2rem; text-align: center; color: #767b85; }
        .sidebar .tab-btn:hover { background: var(--ink-soft); color: #fff; }
        .sidebar .tab-btn.active {
            background: rgba(37,211,102,0.16); color: #eafdf1;
            border-left-color: var(--amber); font-weight: 600;
        }
        .sidebar .tab-btn.active i { color: var(--amber); }

        .premium-form input, .premium-form select, .premium-form textarea {
            background: #fbfbfc;
            border: 1px solid var(--line);
            transition: border-color 0.2s ease, box-shadow 0.2s ease;
            min-height: 48px;
        }
        .premium-form textarea { min-height: unset; }
        .premium-form input:focus, .premium-form select:focus, .premium-form textarea:focus {
            border-color: var(--amber);
            box-shadow: 0 0 0 3px rgba(37, 211, 102, 0.22);
            outline: none;
        }
        .btn-premium {
            background: var(--amber);
            color: #fff;
            border: none;
            transition: all 0.15s ease;
            min-height: 48px;
            font-weight: 600;
            letter-spacing: .01em;
        }
        .btn-premium:hover { background: var(--amber-dark); box-shadow: 0 4px 14px rgba(18, 140, 126, 0.35); }
        .btn-premium:active { transform: translateY(1px); }
        .icon-btn { min-width: 44px; min-height: 44px; display: inline-flex; align-items: center; justify-content: center; }
        .premium-table thead { background: var(--ink); }
        .premium-table tbody tr:hover { background: rgba(37, 211, 102, 0.08); }
        .due-badge { background: #fdf0ee; color: var(--danger); border: 1px solid #f3cfc8; }
        .paid-badge { background: #eefaf2; color: var(--ok); border: 1px solid #bfead0; }

        /* ---------- Section headers: icon-first h3s get a square index chip ---------- */
        h3 > i.fas:first-child, h3 > i.far:first-child {
            display: inline-flex; align-items: center; justify-content: center;
            width: 1.9rem; height: 1.9rem; background: var(--ink);
            color: var(--amber) !important; border-radius: 6px;
            font-size: .85rem !important; margin-right: .65rem !important;
            vertical-align: middle;
        }

        /* ---------- Reskin stock Tailwind utility colors used throughout the markup ---------- */
        .bg-slate-50 { background: var(--panel); }
        .bg-slate-200 { background: #e6e8ec; }
        .bg-gray-50 { background: var(--panel); }
        .bg-gray-100 { background: #eceef1; }
        .text-gray-800 { color: var(--text); }
        .text-gray-700 { color: #383b42; }
        .text-gray-600 { color: var(--text-muted); }
        .text-gray-500 { color: #868a92; }
        .text-gray-400 { color: #a1a5ac; }
        .border-gray-200, .border-gray-300 { border-color: var(--line); }
        .text-red-500, .text-red-600, .text-red-700 { color: var(--amber-dark); }
        .border-red-500, .border-red-600 { border-color: var(--amber); }
        .bg-red-500 { background: var(--amber); }
        .bg-red-600 { background: var(--amber-dark); }
        .bg-red-50, .bg-red-100 { background: var(--amber-tint); }
        .hover\:bg-red-50:hover { background: var(--amber-tint); }
        .hover\:bg-red-600:hover { background: var(--amber-dark); }
        .hover\:text-red-700:hover { color: var(--amber-dark); }
        .bg-gray-700, .bg-slate-700 { background: var(--ink); }
        .bg-gray-800, .hover\:bg-gray-800:hover, .hover\:bg-slate-800:hover { background: var(--ink-soft); }
        .hover\:bg-gray-600:hover { background: var(--ink-soft); }
        /* Reminder "due soon" badge shifted off-amber so it stays distinct from the brand accent */
        .bg-yellow-100 { background: #eef1fb; }
        .text-yellow-700 { color: #3b4fa0; }
        .border-yellow-300 { border-color: #ccd4f3; }

        /* Responsive card-style tables for small screens */
        @media (max-width: 767px) {
            table.responsive-table thead { display: none; }
            table.responsive-table, table.responsive-table tbody, table.responsive-table tr, table.responsive-table td {
                display: block; width: 100%;
            }
            table.responsive-table tr {
                margin-bottom: 0.75rem;
                border: 1px solid var(--line);
                border-radius: 0.75rem;
                overflow: hidden;
                background: white;
            }
            table.responsive-table td {
                text-align: right;
                padding: 0.6rem 1rem 0.6rem 45%;
                position: relative;
                border-bottom: 1px solid #f1f5f9;
                min-height: 2.25rem;
            }
            table.responsive-table td:last-child { border-bottom: none; }
            table.responsive-table td::before {
                content: attr(data-label);
                position: absolute; left: 1rem; top: 0.6rem;
                width: 42%; text-align: left;
                font-weight: 600; color: #868a92; font-size: 0.8rem;
            }
            @media (max-width: 768px) {
                .p-8 { padding: 1.25rem; }
                .p-6 { padding: 1rem; }
                h1 { font-size: 1.35rem; }
            }
        }
        .toast-enter { transform: translateX(120%); }

        /* ---------- Login screen (Firebase Auth) ---------- */
        #loginScreen {
            position: fixed; inset: 0; z-index: 200; background: var(--ink);
            display: flex; align-items: center; justify-content: center; padding: 1.25rem;
        }
        #loginScreen.hidden { display: none; }
        /* ধাপ ১ ফিক্স: Firebase সেশন চেক শেষ না হওয়া পর্যন্ত এই নিরপেক্ষ স্প্ল্যাশ দেখানো হয়,
           যাতে লগইন স্ক্রিন হঠাৎ দেখিয়ে আবার অ্যাপে চলে যাওয়ার "flash" না হয় */
        #authLoading {
            position: fixed; inset: 0; z-index: 250; background: var(--ink);
            display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .9rem;
        }
        #authLoading.hidden { display: none; }
        #authLoading i { color: var(--amber); font-size: 2rem; }
        #authLoading span { color: #cfd2d8; font-size: .85rem; }
        .login-card {
            background: var(--card); width: 100%; max-width: 380px;
            border-radius: 14px; padding: 2rem 1.75rem; box-shadow: 0 20px 40px rgba(0,0,0,.35);
        }
        .login-card .brand { display:flex; align-items:center; gap:.7rem; justify-content:center; margin-bottom:1.5rem; }
        .login-card .brand i { color: var(--amber-dark); font-size: 1.6rem; }
        .login-card h2 { font-size: 1.25rem; font-weight: 700; text-align: center; margin-bottom: .3rem; }
        .login-card p.sub { text-align:center; color: var(--text-muted); font-size: .85rem; margin-bottom: 1.5rem; }
        #loginError { color: var(--danger); font-size: .85rem; text-align:center; min-height: 1.2rem; margin-top: .5rem; }
        .app-shell.hidden { display: none; }
        .sidebar-user { padding: .9rem 1.1rem; border-top: 1px solid var(--ink-border); color: #cfd2d8; font-size: .8rem; }
        .sidebar-user .role-badge { display:inline-block; background: rgba(37,211,102,0.16); color: var(--amber); padding: .1rem .5rem; border-radius: 999px; font-size: .68rem; font-weight:600; margin-left:.4rem; }
        #logoutBtn { width: 100%; margin-top: .5rem; background: transparent; border: 1px solid var(--ink-border); color: #cfd2d8; padding: .55rem; border-radius: .5rem; font-size: .8rem; }
        #logoutBtn:hover { background: var(--ink-soft); color: #fff; }
