        /* ---------------------------------- */
        /* BASE DARK THEME (DEFAULT) */
        /* ---------------------------------- */
        :root, .dark-mode {
            --color-bg-deep: #0f172a; /* Slate 900 */
            --color-card-bg: #1e293b; /* Slate 800 */
            --color-sidebar-bg: #1e293b;
            --color-primary: #3b82f6; /* Blue 500 */
            --color-primary-light: #60a5fa; /* Blue 400 */
            --color-text-light: #f1f5f9; /* Slate 100 */
            --color-text-dark: #0f172a; /* Used by light mode */
            --color-text-muted: #94a3b8; /* Slate 400 */
            --color-text-muted-menu: #94a3b8; /* Slate 400 */
            --color-text-muted-text: #94a3b8; /* Slate 400 */
            --color-border: #334155; /* Slate 700 */
            --color-success: #10b981;
            --color-warning: #fbbf24;
            --color-danger: #ef4444; /* Red 500 */
            --border-radius-lg: 12px;
            --border-radius-sm: 8px;
            --shadow-card: 0 4px 10px rgba(0, 0, 0, 0.3);
            --shadow-sidebar: 2px 0 10px rgba(0, 0, 0, 0.4);
            --sidebar-width: 260px;
            --online-connectivity-color: #008874;
            --offline-connectivity-color: #ad0f0f;

        }

        /* ---------------------------------- */
        /* LIGHT MODE THEME */
        /* ---------------------------------- */
        .light-mode {
            --color-bg-deep: #f3f3f3; /* Slate 50 */
            --color-card-bg: #ffffff; /* White */
            --color-sidebar-bg: #ffffff;
            --color-text-light: var(--color-text-dark); /* Dark text on light background */
            --color-text-muted: #64748b; /* Slate 500 */
            --color-text-muted-menu: #64748b;
            --color-text-muted-text: #64748b; /* Slate 400 */
            --color-border: #e2e8f0; /* Slate 200 */
            --shadow-card: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
            --shadow-sidebar: 2px 0 5px rgba(0, 0, 0, 0.05);
            --online-connectivity-color: #35f0d4;
            --offline-connectivity-color: #f03535;

        }
        
        /* Specific adjustments for light mode elements */
        .light-mode ::-webkit-scrollbar-track { background: #f1f5f9; } 
        .light-mode ::-webkit-scrollbar-thumb { background: #cbd5e1; } /* Slate 300 */
        .light-mode ::-webkit-scrollbar-thumb:hover { background: #94a3b8; } /* Slate 400 */
        .light-mode .nav-link.active, .light-mode .nav-link:hover { background-color: rgba(59, 130, 246, 0.05); }
        .light-mode .submenu { background-color: #f1f5f9; } /* Slate 100 */
        .light-mode .sub-link:hover { background-color: #e2e8f0; } /* Slate 200 */
        .light-mode .search-input { color: var(--color-text-dark); }
        .light-mode .menu-button { color: var(--color-text-dark); background-color: #f1f5f9; }
        .light-mode .shortcuts-container .icon-btn { color: var(--color-text-muted); }
        
        /* ---------------------------------- */
        /* SEMI-DARK MODE THEME (LEFT DARK, RIGHT LIGHT) */
        /* ---------------------------------- */
        .semi-dark-mode {
            /* Main Background (Right Panel) is Light */
            --color-bg-deep: #f3f3f3; /* Slate 50 */
            --color-card-bg: #ffffff;
            --color-text-light: var(--color-text-dark); 
            --color-text-muted: #606b79;
            --color-text-muted-menu: #d8d8d8;
            --color-text-muted-text: #d8d8d8;
            --color-border: #e2e8f0;
            --shadow-card: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
            --shadow-sidebar: 2px 0 10px rgba(0, 0, 0, 0.4); /* Keep dark sidebar shadow */
            --online-connectivity-color: #35f0d4;
            --offline-connectivity-color: #f03535;

            /* Sidebar Panel (Left Panel) is Dark */
            --color-sidebar-bg: #1e293b; /* Slate 800 */
            /* Text/Elements inside sidebar will inherit light color from the default dark-mode variables */
        }
        
        /* Specific rule requested by user for semi-dark mode */
        .semi-dark-mode .profile-details h4 {
            color: #f1f5f9; /* Bright white text in dark sidebar */
        }
        
        /* Adjustments for right-side elements in semi-dark mode */
        .semi-dark-mode .main-content-wrapper {
            /* Override background for the main wrapper */
            background-color: var(--color-bg-deep);
        }
        .semi-dark-mode .sticky-top-nav {
            background-color: var(--color-bg-deep); /* Match main content background */
            border-bottom-color: var(--color-border);
        }
        /* Match light mode overrides for main content elements */
        .semi-dark-mode ::-webkit-scrollbar-track { background: #f1f5f9; } 
        .semi-dark-mode ::-webkit-scrollbar-thumb { background: #cbd5e1; } 
        .semi-dark-mode .search-input { color: var(--color-text-dark); }
        .semi-dark-mode .menu-button { color: var(--color-text-dark); background-color: #f1f5f9; }
        .semi-dark-mode .shortcuts-container .icon-btn { color: var(--color-text-muted); }


        /* ---------------------------------- */
        /* GLOBAL SCROLLBAR STYLES */
        /* ---------------------------------- */
        ::-webkit-scrollbar {
            width: 6px; 
            height: 6px; 
        }
        ::-webkit-scrollbar-track {
            background: var(--color-bg-deep); 
        }
        ::-webkit-scrollbar-thumb {
            background: var(--color-border); 
            border-radius: 3px;
        }
        ::-webkit-scrollbar-thumb:hover {
            background: var(--color-text-muted); 
        }

        /* Base Styles and Layout */
        body {
            font-family: 'Inter', sans-serif;
            background-color: var(--color-bg-deep);
            color: var(--color-text-light);
            line-height: 1.6;
            margin: 0;
            padding: 0;
            overflow: hidden;
            min-height: 100vh;
            transition: background-color 0.3s; /* Smooth mode transition */
        }

        /* ---------------------------------- */
        /* APPLICATION LAYOUT (Grid & Fixed Height) */
        /* ---------------------------------- */

        .app-layout {
            display: grid;
            grid-template-columns: 1fr; 
            min-height: 100vh;
            transition: grid-template-columns 0.3s ease-in-out; 
        }

        /* Fixed Height for Both Left and Right Panels */
        .sidebar, .main-content-wrapper {
            height: calc(100vh - 1px); 
        }
        
        /* ---------------------------------- */
        /* SIDEBAR (Left Panel) STYLES */
        /* ---------------------------------- */

        .sidebar {
            position: fixed; 
            top: 0;
            left: 0;
            width: var(--sidebar-width);
            background-color: var(--color-sidebar-bg);
            box-shadow: var(--shadow-sidebar);
            z-index: 1000;
            transform: translateX(-100%); 
            transition: transform 0.3s ease-in-out, background-color 0.3s, box-shadow 0.3s;
            display: flex;
            flex-direction: column;
        }

        .sidebar.open {
            transform: translateX(0);
        }

        /* Profile Section */
        .profile-section {
            padding: 24px 20px;
            border-bottom: 1px solid var(--color-border);
            display: flex;
            align-items: center;
            gap: 12px;
        }

        /* Profile Elements */
        .profile-avatar {
            width: 48px;
            height: 48px;
            background-color: var(--color-primary-light);
            border-radius: 50%;
            display: flex;
            justify-content: center;
            align-items: center;
            font-weight: 700;
            font-size: 1rem;
            flex-shrink: 0;
        }
        .profile-details h4 { margin: 0 0 2px 0; font-weight: 700; font-size: 1rem; color: var(--color-text-light); }
        .profile-details p { margin: 0; font-size: 0.8rem; color: var(--color-text-muted-text); }

        /* Menu Scroll Container */
        .menu-scroll-container {
            flex-grow: 1;
            overflow-y: scroll;  /* Allow vertical scrolling */
            padding: 15px 0;
            scrollbar-width: none;  /* Firefox */
            -ms-overflow-style: none;  /* Internet Explorer 10+ */
        }
        
        /* Hide scrollbar in Webkit browsers (Chrome, Safari, Edge) */
        .menu-scroll-container::-webkit-scrollbar {
            display: none;
        }
                
        .nav-section-title {
            padding: 0 20px;
            margin-top: 15px;
            margin-bottom: 5px;
            text-transform: uppercase;
            font-size: 0.75rem;
            font-weight: 700;
            color: var(--color-text-muted-text);
            letter-spacing: 0.5px;
        }

        /* Navigation Links and Submenus */
        .nav-link, .sub-link {
            display: flex;
            align-items: center;
            padding: 12px 20px;
            text-decoration: none;
            color: var(--color-text-muted-menu);
            transition: all 0.2s ease;
            font-weight: 500;
            position: relative;
        }
        .nav-link.active, .nav-link:hover {
            background-color: rgba(59, 130, 246, 0.1);
            color: var(--color-primary-light);
        }
        .nav-link.active {
            border-right: 4px solid var(--color-primary);
        }
        /* Font Awesome Icons for main menu */
        .nav-link i {
            margin-right: 12px;
            width: 20px;
            text-align: center;
            font-size: 1.1rem;
        }
        /* Font Awesome Icons for submenu */
        .sub-link i {
            width: 16px;
            margin-right: 10px;
            font-size: 0.9rem;
            color: var(--color-text-muted-menu);
        }


        /* Caret Icon (Chevron) */
        .caret {
            margin-left: auto;
            transition: transform 0.3s;
            font-size: 0.8rem;
            color: var(--color-text-muted);
        }
        .parent-link.expanded .caret { 
            transform: rotate(90deg); 
        }

        /* Submenu Styling */
        .submenu-wrapper { 
            overflow: hidden; 
        }
        .submenu {
            list-style: none;
            padding: 0;
            margin: 0;
            max-height: 0;
            transition: max-height 0.4s ease-in-out;
            background-color: rgba(46, 60, 78, 0.5); /* Darker shade for dark mode submenu */
        }
        .submenu.open { 
            max-height: 300px; 
        }
        .sub-link {
            padding-left: 50px; 
            font-size: 0.9rem;
            font-weight: 400;
        }
        .sub-link:hover { 
            background-color: rgba(46, 60, 78, 0.8); 
        }
        
        /* Light mode sub-menu overrides */
        .light-mode .submenu { background-color: #f1f5f9; } 
        .light-mode .sub-link:hover { background-color: #e2e8f0; } 
        .semi-dark-mode .submenu { background-color: rgba(46, 60, 78, 0.5); }
        .semi-dark-mode .sub-link:hover { background-color: rgba(46, 60, 78, 0.8); }

        /* Logout Footer */
        .sidebar-footer {
            padding: 20px;
            border-top: 1px solid var(--color-border);
        }
        .logout-btn {
            width: 100%;
            padding: 12px;
            background-color: #ef4444; 
            color: var(--color-text-light);
            border: none;
            border-radius: var(--border-radius-sm);
            font-weight: 600;
            cursor: pointer;
            box-shadow: 0 4px 8px rgba(239, 68, 68, 0.2);
            transition: background-color 0.2s;
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 8px;
        }
        .logout-btn:hover { background-color: #dc2626; }

        /* ---------------------------------- */
        /* MAIN CONTENT (Right Panel) STYLES */
        /* ---------------------------------- */

        .main-content-wrapper {
            display: flex;
            flex-direction: column;
            overflow: hidden;
            transition: background-color 0.3s, color 0.3s;
        }
        
        /* Sticky Top Navigation */
        .sticky-top-nav {
            background-color: var(--color-bg-deep); 
            padding: 10px;
            border-bottom: 1px solid var(--color-border);
            z-index: 50;
            flex-shrink: 0;
            transition: background-color 0.3s, border-color 0.3s;
        }
        
        .header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            flex-wrap: wrap;
            margin: 0 auto;
        }
        .header-left {
            display: flex;
            align-items: center;
            gap: 15px; 
            flex-grow: 1;
        }
        
        .menu-button {
            background-color: var(--color-card-bg);
            border: 1px solid var(--color-border);
            cursor: pointer;
            padding: 10px;
            border-radius: var(--border-radius-sm);
            color: var(--color-text-light);
            transition: all 0.2s;
            flex-shrink: 0; 
            font-size: 1.1rem;
            display: flex;
        }
        .menu-button:hover {
            background-color: rgba(59, 130, 246, 0.1);
            border-color: var(--color-primary);
        }

        .search-input {
            background: var(--color-card-bg);
            color: var(--color-text-light);
            border: 1px solid var(--color-border);
            padding: 10px 15px;
            border-radius: var(--border-radius-sm);
            transition: border-color 0.2s;
            outline: none;
            width: 100%; 
            max-width: 350px; 
        }
        .search-input:focus { border-color: var(--color-primary); }

        /* Shortcuts Container (Right side of the header) */
        .shortcuts-container {
            display: flex;
            align-items: center;
            gap: 15px; 
            flex-shrink: 0;
            margin-left: 20px; 
        }
        .shortcuts-container .icon-btn {
            background: none;
            border: none;
            color: var(--color-text-muted);
            cursor: pointer;
            padding: 8px;
            border-radius: 50%;
            transition: all 0.2s;
            position: relative;
            font-size: 1.15rem; /* Standard icon size */
            display: flex;
            align-items: center;
            justify-content: center;
        }
        .shortcuts-container .icon-btn:hover {
            color: var(--color-primary-light);
            background-color: var(--color-card-bg);
        }
        .shortcuts-container .icon-btn.profile-icon {
            width: 18px;
            height: 18px;
            background-color: var(--color-primary);
            border-radius: 50%;
            display: flex;
            justify-content: center;
            align-items: center;
            color: var(--color-text-light);
            font-weight: 600;
            font-size: 0.9rem;
        }
        
        /* ---------------------------------- */
        /* BEAUTIFIED NOTIFICATION BADGE */
        /* ---------------------------------- */
        .shortcuts-container .badge-notification {
            position: absolute;
            top: -3px; 
            right: -3px; 
            background-color: var(--color-danger); /* Solid Red */
            border-radius: 50%;
            border: 2px solid var(--color-bg-deep); /* Border using the main background color for contrast */
            box-shadow: 0 0 5px rgba(239, 68, 68, 0.7); /* Subtle glow/shadow */
            transform: scale(1.05); 
            z-index: 20;
            font-size: 14px;
            color: white;
            padding: 1px 3px 1px 3px;
        }

        /* Main Content Scrollable Area */
        main {
            flex-grow: 1;
            overflow-y: auto;
            padding: 10px;
        }
        
        .dashboard-container {
            margin: 0 auto;
        }
        
        /* Card and Panel Styles */
        .card, .panel {
            background-color: var(--color-card-bg); 
            box-shadow: var(--shadow-card); 
            transition: background-color 0.3s, box-shadow 0.3s, transform 0.3s;
        }
        .card { 
            padding: 25px; 
            border-radius: var(--border-radius-lg); 
            border-left: 4px solid transparent; 
            transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1); 
            cursor: pointer; 
        }
        .card:hover { 
            transform: translateY(-5px); 
            box-shadow: 0 10px 20px rgba(0, 0, 0, 0.5); 
        }

        /* Card Border Colors (from previous inline styles) */
        .card.revenue { border-left-color: var(--color-primary); }
        .card.users { border-left-color: var(--color-success); }
        .card.projects { border-left-color: var(--color-warning); }
        .card.rate { border-left-color: #a855f7; } /* Purple */

        /* Card Content Styles */
        .card-title { margin-top: 0; }
        .card-value { font-size: 2.5rem; font-weight: 800; margin-top: 5px; margin-bottom: 10px; }
        .card-alert-value { color: var(--color-warning); } /* Specific style for the critical alerts value */
        .card-footer { display: flex; align-items: center; font-size: 0.9rem; }
        .card-footer-text { margin-left: 10px; color: var(--color-text-muted); }
        .card-footer-arrow { width: 12px; height: 12px; }

        /* Metric Grid Layout */
        .metrics-grid { 
            display: grid; 
            grid-template-columns: repeat(1, 1fr); 
            gap: 20px; 
            margin-bottom: 30px; 
        }
        .main-content-grid { 
            display: grid; 
            grid-template-columns: 1fr; 
            gap: 20px; 
            margin-bottom: 30px; 
        }

        /* Panel Content Styles */
        .panel { 
            padding: 25px; 
            border-radius: var(--border-radius-lg); 
        }
        .panel h2 {
            font-size: 1.25rem; 
            font-weight: 700; 
            margin-bottom: 5px;
            margin-top: 0;
        }
        .panel p.muted { 
            color: var(--color-text-muted); 
            font-size: 0.9rem; 
            margin-bottom: 15px; 
            margin-top: 0;
        }

        /* Chart Placeholder */
        .chart-placeholder { 
            height: 350px; 
            background-color: var(--color-card-bg); 
            border-radius: 8px; 
            display: flex; 
            justify-content: center; 
            align-items: center; 
            font-size: 1.2rem; 
            color: var(--color-text-muted); 
            margin-top: 15px; 
            border: 1px dashed var(--color-border); 
        }

        /* Table Styles */
        .data-table { 
            width: 100%; 
            border-collapse: collapse; 
            margin-top: 15px; 
        }
        .data-table th, .data-table td { 
            padding: 12px 15px; 
            text-align: left; 
            border-bottom: 1px solid var(--color-border); 
        }
        .data-table th { 
            font-size: 0.85rem; 
            color: var(--color-text-muted); 
            text-transform: uppercase; 
            font-weight: 600; 
        }
        .data-table tbody tr:hover { 
            background-color: rgba(59, 130, 246, 0.05); 
        }
        .data-table-id {
            color: var(--color-primary-light); 
            font-weight: 600;
        }
        .data-table-amount {
            font-weight: 700;
        }
        
        /* Badge Styles (General) */
        .badge { 
            padding: 4px 8px; 
            border-radius: 9999px; 
            font-weight: 600; 
            font-size: 0.8rem; 
            display: inline-flex;
            align-items: center;
            gap: 4px;
        }
        /* Specific Badge Colors (from previous inline styles) */
        .badge-success { 
            color: var(--color-success); 
            background-color: rgba(16, 185, 129, 0.2); 
        }
        .badge-warning-light { 
            color: var(--color-warning); 
            background-color: rgba(251, 191, 36, 0.2); 
        }
        .badge-danger-light { 
            color: #f87171; 
            background-color: rgba(248, 113, 128, 0.2); 
        }
        
        .offline {
            color: var(--offline-connectivity-color);
        }
        .online {
            color: var(--online-connectivity-color);
        }



        /* Responsive Layout */
        @media (min-width: 1024px) {
            .app-layout {
                grid-template-columns: var(--sidebar-width) 1fr;
            }
            .sidebar {
                position: relative; 
                transform: translateX(0);
                grid-column: 1;
                transition: all 0.3s ease-in-out; 
            }
            
            .app-layout.collapsed {
                grid-template-columns: 0 1fr; 
            }
            .app-layout.collapsed .sidebar {
                width: 0;
                overflow: hidden;
            }

            .main-content-wrapper {
                grid-column: 2;
                padding: 0;
            }
            

            .overlay { display: none !important; }
            
            .metrics-grid {
                grid-template-columns: repeat(4, 1fr);
            }
            .main-content-grid {
                grid-template-columns: 2fr 1fr;
            }
        }
        
        @media (max-width: 600px) {
            .overlay {
                display: none;
                position: fixed;
                top: 0;
                left: 0;
                right: 0;
                bottom: 0;
                background: rgba(0, 0, 0, 0.5);
                z-index: 999;
            }
            .sidebar.open + .overlay {
                display: block;
            }
            .header-left {
                width: 100%;
                order: 1; 
                margin-bottom: 10px;
            }
            .search-input {
                width: 100%;
            }
            .shortcuts-container {
                width: 100%;
                justify-content: space-between; 
                order: 2;
                margin: 0;
            }
            .header {
                flex-direction: column;
                align-items: flex-start;
            }
            
            .sticky-top-nav {
                padding: 10px;
            }
            
            .shortcuts-container .icon-btn.profile-icon {
                width: 18px;
                height: 18px;
            }
        }