:root {
    /* --- Color Palette --- */
    --bg: #f4f7fb;
    --primary: #1e1b4b;
    /* Deep Indigo */
    --accent: #4f46e5;
    /* Vibrant Indigo */
    --success: #10b981;
    /* Emerald Green */
    --danger: #ef4444;
    /* Rose Red */
    --warning: #f59e0b;
    /* Amber Gold */
    --text: #0f172a;
    /* Slate Black */
    --text-light: #64748b;
    /* Slate Gray */
    --card-bg: #ffffff;

    /* --- Design Tokens --- */
    --radius: 24px;
    --radius-sm: 12px;
    --shadow: 0 8px 20px rgba(0, 0, 0, 0.04);
    --shadow-lg: 0 10px 25px rgba(30, 27, 75, 0.1);
}

/* --- Global Reset & Base Styles --- */
* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    margin: 0;
    padding: 0;
}

body {
    background: var(--bg);
    color: var(--text);
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    line-height: 1.5;
}

/* --- Header: Mobile Sticky Header --- */
header {
    background: var(--card-bg);
    padding: 1.2rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    z-index: 100;
    flex-shrink: 0;
}

.brand-container {
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand-logo {
    background: linear-gradient(135deg, var(--accent), var(--primary));
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.3rem;
    box-shadow: 0 4px 10px rgba(79, 70, 229, 0.3);
}

.brand-text h1 {
    font-size: 1.1rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    line-height: 1;
}

.brand-text p {
    font-size: 0.7rem;
    color: var(--text-light);
    font-weight: 700;
    text-transform: uppercase;
    margin-top: 4px;
}

/* --- Navigation: Fixed Bottom Bar --- */
.bottom-nav {
    position: fixed;
    bottom: 0;
    width: 100%;
    background: var(--card-bg);
    display: flex;
    justify-content: space-around;
    padding: 12px 10px calc(12px + env(safe-area-inset-bottom));
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.03);
    z-index: 1000;
}

.nav-tab {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    color: var(--text-light);
    font-size: 0.65rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    flex: 1;
    padding: 10px 5px;
    border-radius: 16px;
}

.nav-tab i {
    font-size: 1.6rem;
    transition: 0.2s;
}

.nav-tab.active {
    color: var(--accent);
    background: rgba(79, 70, 229, 0.05);
}

.nav-tab.active i {
    transform: translateY(-2px);
}

/* --- Main Content Layout --- */
main {
    flex: 1;
    overflow-y: auto;
    padding: 1.25rem;
    padding-bottom: 120px;
    /* Space for Nav + FAB */
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    /* Firefox */
    -ms-overflow-style: none;
    /* IE and Edge */
}

main::-webkit-scrollbar {
    display: none;
    /* Chrome, Safari and Opera */
}

.view {
    display: none;
    animation: viewEnter 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.view.active {
    display: block;
}

@keyframes viewEnter {
    from {
        opacity: 0;
        transform: translateY(15px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* --- UI Building Blocks --- */
.card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 1.5rem;
    margin-bottom: 1.25rem;
    box-shadow: var(--shadow);
    border: 1px solid rgba(0, 0, 0, 0.02);
}

.glass-stat {
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: white;
    padding: 2.2rem;
    border-radius: var(--radius);
    margin-bottom: 1.5rem;
    position: relative;
    overflow: hidden;
    box-shadow: 0 12px 30px rgba(30, 27, 75, 0.25);
}

.glass-stat i {
    position: absolute;
    right: -20px;
    bottom: -20px;
    font-size: 8rem;
    opacity: 0.12;
    transform: rotate(-15deg);
}

/* GLASS CSS SNIPPET */

.staff-glass-card {
    padding: 20px;
    border-radius: 18px;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 2px;
    background: rgba(255, 255, 255, 0.3);
    overflow: hidden;
    z-index: 1;

    /* THE SIGNATURE 7-LAYER SHADOW STACK */
    box-shadow:
        0 0 .3rem #0000003a,
        5px 5px .5rem #ffffffe6,
        5px 5px .6rem #0000003a,
        inset 1px 1px #fff,
        inset -1px -1px #fff,
        inset 4px 4px .2rem #00000010,
        inset 0 0 .0rem #a6adb3;
}

.h-main-label {
    font-size: 1.2rem;
    font-weight: 700;
    line-height: normal;
}

.h-main-val {
    font-size: 2.8rem;
    font-weight: 900;
    line-height: normal;
}

.h-label {
    font-size: 0.75rem;
    opacity: 0.85;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    font-weight: 700;
    text-align: center;
}

.h-val {
    font-size: 1.6rem;
    text-align: center;
    font-weight: 900;
    margin-top: 8px;
    letter-spacing: -1.5px;
}

.target-tag {
    font-size: .7em;
    text-align: center;
}

/* Updated Investor Value Styling */
.h-val,
[id^="dash-usd-"],
[id^="dash-zar-"] {
    text-align: center;
    width: 100%;
    display: block;
}

/* Ensure the USD value stays bold and large */
[id^="dash-usd-"] {
    font-size: 1.6rem;
    font-weight: 900;
    margin-top: 8px;
    letter-spacing: -1px;
}

/* Ensure the ZAR value stays centered and slightly smaller */
[id^="dash-zar-"] {
    font-size: 1rem;
    font-weight: 700;
    opacity: 0.8;
}

/* Updated List Item Styles for User Request */
.list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 0;
    border-bottom: 1px solid #f1f5f9;
    transition: background 0.2s;
}

.list-item:active {
    background: #f8fafc;
}

.list-item:last-child {
    border: none;
}

.item-info {
    flex: 1;
}

.item-info p {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 4px;
    line-height: 1.2;
}

.item-info .sub-details {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    font-size: 0.75rem;
    color: var(--text-light);
    font-weight: 600;
}

.item-info .stock-indicator {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 6px;
    font-weight: 800;
    font-size: 0.7rem;
    text-transform: uppercase;
}

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

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

.item-meta {
    text-align: right;
    margin-left: 15px;
}

.item-meta .price {
    font-weight: 900;
    color: var(--primary);
    font-size: 1.15rem;
    display: block;
}

.item-meta .time {
    font-size: 0.7rem;
    color: var(--text-light);
    font-weight: 600;
    margin-top: 4px;
}

/* --- POS Grid System --- */
.category-scroll {
    display: flex;
    overflow-x: auto;
    gap: 10px;
    padding: 5px 0 15px 0;
    margin-bottom: 10px;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.category-scroll::-webkit-scrollbar {
    display: none;
}

.chip {
    background: var(--card-bg);
    padding: 10px 18px;
    border-radius: 25px;
    font-size: 0.8rem;
    font-weight: 700;
    white-space: nowrap;
    box-shadow: var(--shadow);
    border: 1px solid rgba(0, 0, 0, 0.02);
    cursor: pointer;
    transition: 0.2s;
}

.chip.active {
    background: var(--accent);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(79, 70, 229, 0.2);
}

.grid-pos {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(145px, 1fr));
    gap: 14px;
}

.product-tile {
    background: var(--card-bg);
    padding: 1.6rem 1rem;
    border-radius: 22px;
    text-align: center;
    box-shadow: var(--shadow);
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    border: 2px solid transparent;
}

.product-tile:active {
    transform: scale(0.94);
}

.product-tile i {
    font-size: 2.2rem;
    color: var(--accent);
    display: block;
    margin-bottom: 12px;
}

.product-tile h4 {
    font-size: 0.85rem;
    font-weight: 800;
    margin-bottom: 8px;
    line-height: 1.3;
    min-height: 2.6rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.product-tile .p-price {
    color: var(--success);
    font-weight: 900;
    font-size: 1.2rem;
}

.product-tile .p-stock {
    font-size: 0.7rem;
    color: var(--text-light);
    margin-top: 8px;
    font-weight: 700;
    background: #f1f5f9;
    padding: 4px;
    border-radius: 8px;
}

.tile-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: var(--danger);
    color: white;
    font-size: 0.6rem;
    padding: 4px 8px;
    border-radius: 10px;
    font-weight: 900;
    box-shadow: 0 4px 8px rgba(239, 68, 68, 0.3);
    z-index: 10;
}

/* Base Shared Styles for all FABs */
.fab-cart,
.fab-add {
    position: fixed;
    bottom: 105px;
    right: 30px;
    width: 68px;
    height: 68px;
    background: var(--primary);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    cursor: pointer;
    box-shadow: 0 10px 25px rgba(30, 27, 75, 0.3);
    z-index: 1000;
    /* Increased to ensure it stays above everything */
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);

    &:hover {
        transform: scale(1.1);
        background: #2d2a6e;
    }

    &:active {
        transform: scale(0.85) rotate(-10deg);
    }

    /* Target the icon inside specifically */
    i {
        display: flex;
        align-items: center;
        justify-content: center;
    }
}

/* Specific styling for the Cart FAB to handle the counter badge */
.fab-cart {
    .cart-count {
        position: absolute;
        top: 0;
        right: 0;
        background: var(--danger);
        width: 24px;
        height: 24px;
        border-radius: 50%;
        /* Changed to 50% for consistency */
        font-size: 0.75rem;
        display: flex;
        align-items: center;
        justify-content: center;
        font-weight: 900;
        border: 3px solid var(--card-bg);
        /* Ensure the count doesn't move when the button rotates */
        transform: rotate(0deg);
    }
}

/* Specific styling for the Add FAB (if you want a different color, change it here) */
.fab-add {
    display: none;
    /* Controlled by your switchView JS */

    /* Ensure the plus icon is perfectly centered */
    i {
        font-size: 2.2rem;
    }
}

/* --- Modals & Interaction Layers --- */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.7);
    backdrop-filter: blur(8px);
    z-index: 2000;
    display: none;
    justify-content: center;
    align-items: flex-end;
    padding: 10px;
}

.sheet {
    background: white;
    width: 100%;
    max-width: 550px;
    border-radius: 32px 32px 20px 20px;
    padding: 2.2rem;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideUp 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
    position: relative;
}

@keyframes slideUp {
    from {
        transform: translateY(100%);
    }

    to {
        transform: translateY(0);
    }
}

/* --- Form Elements --- */
label.h-label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-light);
    font-size: 0.7rem;
}

input,
select {
    width: 100%;
    background: #f8fafc;
    border: 2px solid #e2e8f0;
    padding: 18px;
    border-radius: 18px;
    margin-bottom: 22px;
    font-size: 16px;
    font-weight: 600;
    outline: none;
    transition: 0.2s;
    appearance: none;
}

input:focus,
select:focus {
    border-color: var(--accent);
    background: white;
    box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.1);
}

.btn {
    width: 100%;
    padding: 20px;
    border-radius: 22px;
    border: none;
    font-weight: 800;
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.btn-primary {
    background: var(--accent);
    color: white;
    box-shadow: 0 8px 20px rgba(79, 70, 229, 0.25);
}

.btn-primary:active {
    transform: scale(0.97);
    filter: brightness(1.1);
}

.btn-success {
    background: var(--success);
    color: white;
    box-shadow: 0 8px 20px rgba(16, 185, 129, 0.25);
}

.btn-success:active {
    transform: scale(0.97);
}

.btn-outline {
    background: #f1f5f9;
    color: var(--text-light);
    margin-top: 12px;
}

.search-box {
    position: relative;
    margin-bottom: 1.5rem;
}

.search-box i {
    position: absolute;
    left: 18px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-light);
    font-size: 1.3rem;
}

.search-box input {
    margin: 0;
    padding-left: 52px;
    border-radius: 22px;
    background: white;
    box-shadow: var(--shadow);
    border: none;
    height: 60px;
}

/* --- Utilities --- */
.text-red {
    color: var(--danger);
}

.text-green {
    color: var(--success);
}

.text-amber {
    color: var(--warning);
}

.price-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 13px;
    /* Precise spacing */
}

.p-price {
    font-weight: 800;
    color: var(--primary);
    margin: 0;
    line-height: 1;
    /* Match the icon height */
}

.convert-btn {
    background: none;
    border: none;
    padding: 0;
    margin: 0;
    cursor: pointer;
    color: var(--text-light);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
}

.convert-btn:hover {
    color: var(--primary);
}

.convert-btn i {
    font-size: 1.1rem;
    /* Slightly larger for visibility */
    display: inline-block;
    vertical-align: middle;
    margin-top: 11px;
}

/*========== OPERATIONS ==========*/

#view-alerts.view {
    padding: 1.5rem;

    /* Standardized HQ Cards */
    .hq-card {
        background: rgba(255, 255, 255, 0.03);
        /* 60% Base */
        border: 1px solid rgba(255, 255, 255, 0.05);
        border-radius: 24px;
        padding: 25px;
        position: relative;
        cursor: pointer;
        transition: all 0.3s ease;

        .hq-icon-box {
            width: 50px;
            height: 50px;
            border-radius: 12px;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 1.5rem;
            background: rgba(99, 102, 241, 0.1);
            /* 10% Accent Tint */
            color: #6366f1;
            /* 10% Accent */
        }

        .hq-card-content {
            margin-top: 15px;

            h3 {
                font-weight: 900;
                color: var(--text-main);
                /* 30% Secondary */
                margin: 0;
            }

            p {
                font-size: 0.75rem;
                color: var(--text-light);
                margin-top: 4px;
            }
        }

        .hq-arrow {
            position: absolute;
            right: 20px;
            top: 25px;
            opacity: 0.2;
            color: var(--text-light);
        }

        &:hover {
            background: rgba(255, 255, 255, 0.08);
            border-color: rgba(99, 102, 241, 0.3);

            .hq-arrow {
                opacity: 1;
                transform: translateX(5px);
                color: #6366f1;
            }
        }
    }
}

/*========== TREASURY ==========*/

.treasury-module {
    .treasury-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 2rem;

        h2 {
            font-weight: 900;
            font-size: 1.6rem;
            letter-spacing: -1px;
            margin: 0;
        }

        p {
            color: var(--text-light);
            font-size: 0.8rem;
            font-weight: 600;
            opacity: 0.7;
        }

        .ledger-badge {
            background: rgba(99, 102, 241, 0.1);
            color: #6366f1;
            padding: 6px 14px;
            border-radius: 50px;
            font-size: 0.65rem;
            font-weight: 800;
            text-transform: uppercase;
        }
    }

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

        .stat-card {
            background: rgba(255, 255, 255, 0.03);
            border: 1px solid rgba(255, 255, 255, 0.05);
            border-radius: 20px;
            padding: 1.5rem;
            position: relative;
            overflow: hidden;

            &.primary-accent {
                background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
                border: none;
                color: white;

                .label {
                    color: rgba(255, 255, 255, 0.7);
                }

                h4,
                p {
                    color: white;
                }
            }

            &.balance-card {
                background: rgba(16, 185, 129, 0.05);
                border-color: rgba(16, 185, 129, 0.1);

                .label,
                h4,
                p {
                    color: #10b981;
                }
            }

            .card-bg-icon {
                position: absolute;
                right: -10px;
                bottom: -10px;
                font-size: 5rem;
                opacity: 0.1;
            }

            .label {
                font-size: 0.65rem;
                font-weight: 800;
                text-transform: uppercase;
                display: block;
                margin-bottom: 10px;
            }

            h4 {
                font-size: 1.8rem;
                font-weight: 900;
                margin: 0;
            }

            p {
                font-size: 1rem;
                font-weight: 700;
                margin: 0;
                opacity: 0.8;
            }

            .negative {
                color: #ef4444;
            }
        }
    }

    .treasury-row {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 1.5rem;

        .hq-card-static {
            background: rgba(255, 255, 255, 0.03);
            border-radius: 24px;
            padding: 1.5rem;
            border: 1px solid rgba(255, 255, 255, 0.05);

            .card-title {
                display: flex;
                align-items: center;
                gap: 12px;
                margin-bottom: 1.5rem;

                h3 {
                    font-weight: 900;
                    font-size: 1.1rem;
                    margin: 0;
                }

                &.justify {
                    justify-content: space-between;
                }

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

            .icon-box {
                width: 40px;
                height: 40px;
                border-radius: 12px;
                background: rgba(255, 255, 255, 0.05);
                display: flex;
                align-items: center;
                justify-content: center;

                &.red {
                    background: rgba(239, 68, 68, 0.1);
                    color: #ef4444;
                }
            }

            .input-group {
                margin-bottom: 1rem;

                label {
                    display: block;
                    font-size: 0.65rem;
                    font-weight: 800;
                    color: var(--text-light);
                    text-transform: uppercase;
                    margin: 0 0 5px 5px;
                }

                input {
                    width: 100%;
                    background: rgba(255, 255, 255, 0.03);
                    border: 1px solid rgba(255, 255, 255, 0.08);
                    padding: 12px;
                    border-radius: 12px;
                    color: white;
                    outline: none;

                    &:focus {
                        border-color: #6366f1;
                    }
                }
            }

            .input-row {
                display: grid;
                grid-template-columns: 1fr 1fr;
                gap: 12px;
            }

            .action-btn {
                width: 100%;
                padding: 16px;
                border-radius: 15px;
                background: #6366f1;
                color: white;
                border: none;
                font-weight: 900;
                font-size: 0.75rem;
                text-transform: uppercase;
                cursor: pointer;
                transition: 0.3s;
                margin-top: 10px;

                &:hover {
                    background: #4f46e5;
                    transform: translateY(-2px);
                }
            }

            .history-scroll {
                height: 250px;
                overflow-y: auto;

                .transaction-item {
                    display: flex;
                    justify-content: space-between;
                    align-items: center;
                    padding: 12px 0;
                    border-bottom: 1px solid rgba(255, 255, 255, 0.05);

                    &:last-child {
                        border: none;
                    }

                    .info h5 {
                        margin: 0;
                        font-size: 0.85rem;
                        font-weight: 800;
                    }

                    .info span {
                        font-size: 0.65rem;
                        color: var(--text-light);
                        font-weight: 600;
                    }

                    .amount {
                        text-align: right;

                        h5 {
                            color: #ef4444;
                            margin: 0;
                            font-size: 0.85rem;
                        }

                        p {
                            font-size: 0.7rem;
                            margin: 0;
                            color: var(--text-light);
                        }
                    }
                }
            }

            .clear-btn {
                background: none;
                border: none;
                color: var(--text-light);
                font-size: 0.65rem;
                font-weight: 800;
                text-transform: uppercase;
                cursor: pointer;
            }
        }
    }
}

.sidebar-desktop {
    display: none;
}

.header-desktop {
    display: none;
}

/*========== HUB DIRECTORY (The Grid) ==========*/
#hub-directory-container {
    .hub-header {
        margin-bottom: 32px;

        .hub-main-title {
            font-size: 1.8rem;
            font-weight: 800;
            color: #1f2937;
            margin-bottom: 4px;
        }

        .hub-subtitle {
            color: #9ca3af;
            font-size: 0.95rem;
        }
    }

    .hub-modules-grid {
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
        gap: 20px;

        .hub-card {
            background: #ffffff;
            border: 1px solid rgba(0, 0, 0, 0.05);
            border-radius: 16px;
            padding: 24px;
            cursor: pointer;
            transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
            position: relative;
            overflow: hidden;

            &:hover {
                transform: translateY(-5px);
                box-shadow: 0 12px 24px rgba(0, 0, 0, 0.05);
                border-color: #6366f1;
            }

            .module-icon-box {
                width: 48px;
                height: 48px;
                border-radius: 12px;
                display: flex;
                align-items: center;
                justify-content: center;
                font-size: 1.5rem;
                margin-bottom: 16px;

                /* Icon Colors */
                &.expense-icon {
                    background: #fee2e2;
                    color: #ef4444;
                }

                &.flow-icon {
                    background: #dcfce7;
                    color: #10b981;
                }

                &.equity-icon {
                    background: #e0e7ff;
                    color: #6366f1;
                }

                &.vault-icon {
                    background: #fef3c7;
                    color: #f59e0b;
                }
            }

            .module-title {
                font-size: 1.1rem;
                font-weight: 700;
                color: #1f2937;
                margin-bottom: 8px;
            }

            .module-desc {
                font-size: 0.85rem;
                color: #6b7280;
                line-height: 1.4;
            }
        }
    }
}

/*========== MODULE VIEWPORT (The Sub-Module Container) ==========*/
#financial-module-viewport {
    animation: fadeIn 0.3s ease-out;

    .module-nav-header {
        margin-bottom: 24px;
        padding-bottom: 16px;
        border-bottom: 1px solid rgba(0, 0, 0, 0.06);

        .nav-top-row {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 16px;

            .back-btn {
                display: flex;
                align-items: center;
                gap: 8px;
                background: #f3f4f6;
                border: 1px solid #e5e7eb;
                padding: 8px 16px;
                border-radius: 8px;
                color: #4b5563;
                font-weight: 600;
                font-size: 0.85rem;
                cursor: pointer;
                transition: all 0.2s ease;

                &:hover {
                    background: #fff;
                    border-color: #6366f1;
                    color: #6366f1;
                }
            }

            .module-status-pill {
                display: flex;
                align-items: center;
                gap: 6px;
                background: #ecfdf5;
                color: #065f46;
                padding: 6px 12px;
                border-radius: 20px;
                font-size: 0.75rem;
                font-weight: 700;

                .status-dot {
                    width: 8px;
                    height: 8px;
                    background: #10b981;
                    border-radius: 50%;
                    box-shadow: 0 0 8px rgba(16, 185, 129, 0.4);
                }
            }
        }

        .module-title-section {
            .active-module-name {
                font-size: 1.8rem;
                font-weight: 800;
                color: #111827;
                margin: 0;
            }

            .module-breadcrumb {
                font-size: 0.75rem;
                color: #9ca3af;
                text-transform: uppercase;
                letter-spacing: 1px;
                margin-top: 4px;

                #breadcrumb-sub {
                    color: #6366f1;
                    font-weight: 700;
                }
            }
        }
    }

    /* Shared Dashboard Elements */
    .persistent-balance-card {
        background: #1f2937;
        color: white;
        padding: 24px;
        border-radius: 16px;
        margin-bottom: 24px;
        box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);

        .balance-label {
            font-size: 0.8rem;
            text-transform: uppercase;
            letter-spacing: 1px;
            opacity: 0.7;
            margin-bottom: 8px;
        }

        .balance-value {
            font-size: 2.2rem;
            font-weight: 800;
            margin: 0;
        }
    }

    /* Action Buttons */
    .action-btn-main {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 10px;
        width: 100%;
        background: #6366f1;
        color: white;
        border: none;
        padding: 14px;
        border-radius: 12px;
        font-weight: 700;
        font-size: 1rem;
        cursor: pointer;
        transition: all 0.2s ease;

        &:hover {
            background: #4f46e5;
            box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
        }
    }

    /* Module Log Section */
    .hub-log-container {
        background: white;
        border-radius: 16px;
        border: 1px solid rgba(0, 0, 0, 0.05);

        .log-header {
            padding: 20px;
            border-bottom: 1px solid rgba(0, 0, 0, 0.05);
            display: flex;
            justify-content: space-between;
            align-items: center;

            .log-title {
                font-size: 1rem;
                font-weight: 700;
                color: #374151;
                text-transform: uppercase;
                letter-spacing: 0.5px;
            }
        }

        .log-content {
            padding: 40px 20px;
            text-align: center;

            .empty-log-state {
                i {
                    font-size: 3rem;
                    color: #d1d5db;
                    margin-bottom: 12px;
                    display: block;
                }

                p {
                    color: #9ca3af;
                    font-size: 0.9rem;
                }
            }
        }
    }
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/*==========Sub Module: Expense Manager Specific==========*/
.internal-balance {
    background: linear-gradient(135deg, #ef4444 0%, #b91c1c 100%) !important;
}

#expense-log-list {

    /* Styles for dynamic list items added via JS */
    .log-item {
        display: flex;
        justify-content: space-between;
        padding: 12px 16px;
        border-bottom: 1px solid #f3f4f6;
        text-align: left;

        .log-item-info {
            .log-reason {
                font-weight: 600;
                color: #1f2937;
            }

            .log-meta {
                font-size: 0.75rem;
                color: #9ca3af;
            }
        }

        .log-amount {
            color: #ef4444;
            font-weight: 700;
        }
    }

}


/* --- Desktop Viewport Handling --- */
@media (min-width: 1024px) {
    body {
        display: block;
        /* Reset from flex column to normal block for fixed layout */
    }

    /* Hide Mobile Navigation elements */
    header:not(.header-desktop),
    .bottom-nav {
        display: none !important;
    }

    /* ========== DESKTOP SIDEBAR ========== */
    .sidebar-desktop {
        display: flex;
        width: 280px;
        background: var(--primary);
        height: 100vh;
        position: fixed;
        left: 0;
        top: 0;
        flex-direction: column;
        padding: 2.5rem 1.5rem;
        z-index: 1100;
        color: white;
        border-right: 1px solid rgba(255, 255, 255, 0.05);
        box-shadow: 4px 0 20px rgba(0, 0, 0, 0.05);
    }

    .sidebar-brand {
        display: flex;
        align-items: center;
        gap: 15px;
        margin-bottom: 3.5rem;
        width: 100%;
    }

    .sidebar-brand .brand-logo {
        background: var(--accent);
        width: 45px;
        height: 45px;
        border-radius: 14px;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 1.8rem;
        box-shadow: 0 4px 15px rgba(79, 70, 229, 0.4);
    }

    .sidebar-brand h1 {
        font-size: 1.25rem;
        font-weight: 900;
        letter-spacing: -0.5px;
        line-height: 1.2;
        margin: 0;
        color: white;
    }

    .sidebar-brand p {
        font-size: 0.7rem;
        opacity: 0.6;
        text-transform: uppercase;
        font-weight: 700;
        margin: 0;
        color: white;
    }

    .sidebar-links {
        display: flex;
        flex-direction: column;
        gap: 8px;
        flex: 1;
    }

    .sidebar-desktop .nav-tab {
        display: flex;
        flex-direction: row;
        /* Override mobile column layout */
        align-items: center;
        justify-content: flex-start;
        gap: 14px;
        padding: 14px 18px;
        border-radius: 16px;
        cursor: pointer;
        transition: all 0.3s ease;
        color: rgba(255, 255, 255, 0.6);
        font-weight: 600;
        width: 100%;
        height: auto;
        flex: none;
        /* Override flex: 1 from mobile */
    }

    .sidebar-desktop .nav-tab i {
        font-size: 1.4rem;
    }

    .sidebar-desktop .nav-tab span {
        font-size: 0.95rem;
        /* Override mobile 0.6rem */
    }

    .sidebar-desktop .nav-tab:hover {
        background: rgba(255, 255, 255, 0.05);
        color: white;
        transform: translateX(4px);
    }

    .sidebar-desktop .nav-tab.active {
        background: var(--accent);
        color: white;
        box-shadow: 0 8px 20px rgba(79, 70, 229, 0.3);
    }

    .sidebar-desktop .nav-tab.active i {
        transform: translateY(0);
        /* Override mobile translateY */
        color: white;
    }

    .sidebar-footer {
        margin-top: auto;
        padding: 20px;
        border-top: 1px solid rgba(255, 255, 255, 0.1);
        text-align: center;
    }

    .sidebar-footer #desktop-date {
        font-size: 0.75rem;
        font-weight: 800;
        color: rgba(255, 255, 255, 0.4);
        letter-spacing: 1px;
        text-transform: uppercase;
    }

    /* ========== DESKTOP HEADER ========== */
    .header-desktop {
        display: flex;
        position: fixed;
        top: 0;
        left: 280px;
        /* Aligned next to sidebar */
        right: 0;
        height: 80px;
        background: rgba(255, 255, 255, 0.9);
        backdrop-filter: blur(10px);
        -webkit-backdrop-filter: blur(10px);
        align-items: center;
        justify-content: space-between;
        padding: 0 3rem;
        border-bottom: 1px solid #eef2f6;
        z-index: 900;
    }

    .header-left h2 {
        font-weight: 900;
        font-size: 1.5rem;
        letter-spacing: -0.8px;
        color: var(--primary);
        margin: 0;
    }

    .header-right {
        display: flex;
        align-items: center;
        gap: 25px;
    }

    .header-desktop .status-pill {
        background: #f1f5f9;
        padding: 8px 18px;
        border-radius: 30px;
        font-size: 0.75rem;
        font-weight: 800;
        color: var(--text-light);
        display: flex;
        align-items: center;
        gap: 10px;
    }

    .header-desktop .status-pill span {
        width: 8px;
        height: 8px;
        border-radius: 50%;
        background: var(--success);
        box-shadow: 0 0 10px var(--success);
        animation: pulse-dot 2s infinite;
    }

    .header-desktop .user-profile {
        display: flex;
        align-items: center;
        gap: 15px;
        padding-left: 25px;
        border-left: 1px solid #e2e8f0;
    }

    .header-desktop .user-info {
        text-align: right;
    }

    .header-desktop .user-info p:first-child {
        font-size: 0.85rem;
        font-weight: 800;
        color: var(--primary);
        margin: 0;
    }

    .header-desktop .user-info p:last-child {
        font-size: 0.65rem;
        color: var(--text-light);
        font-weight: 600;
        margin: 0;
    }

    .header-desktop .avatar {
        width: 42px;
        height: 42px;
        background: var(--bg);
        border-radius: 14px;
        display: flex;
        align-items: center;
        justify-content: center;
        font-weight: 900;
        color: var(--primary);
        border: 1px solid #e2e8f0;
    }

    /* ========== ADJUSTMENTS FOR DESKTOP ========== */
    .fab-cart {
        right: 50px;
        bottom: 50px;
        width: 85px;
        height: 85px;
        font-size: 2.4rem;
    }

    main {
        padding: calc(80px + 3rem) 3rem 3rem 3rem;
        /* Account for fixed header */
        margin-left: 280px;
        /* Account for fixed sidebar */
        max-width: 100%;
        /* Changed from 1400px to allow full width */
        height: 100vh;
        overflow-y: auto;
    }

    .sheet {
        border-radius: 35px;
        margin-bottom: 0;
        max-height: 85vh;
        width: 500px;
    }

    .overlay {
        align-items: center;
        justify-content: center;
        /* Center the modal on desktop */
    }

    .grid-pos {
        grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
        gap: 20px;
    }
}

@keyframes pulse-dot {
    0% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
    }

    70% {
        transform: scale(1);
        box-shadow: 0 0 0 10px rgba(16, 185, 129, 0);
    }

    100% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
    }
}

/* Mobile-First Refinement */
@media (max-width: 768px) {
    #view-alerts {
        padding: 1rem;
        /* Reduce padding to give content more room */
    }

    /* Stack the Stats Grid vertically */
    .stats-grid {
        grid-template-columns: 1fr !important;
        gap: 1rem;
    }

    /* Stack the Form and History vertically */
    .treasury-row {
        grid-template-columns: 1fr !important;
        gap: 1.5rem;
    }

    /* Make text sizes more readable on small screens */
    .stat-card {
        .stat-value {
            font-size: 1.5rem;
        }

        .stat-sub-value {
            font-size: 0.9rem;
        }
    }

    /* Fix the Record Withdrawal inputs for fat fingers */
    .hq-input {
        padding: 16px;
        font-size: 1rem;
        /* Prevents iOS from zooming in on focus */
    }
}