        :root {
            /* Palette: Soft Architectural Light Palette */
            --bg-canvas: #f8fafc;
            --bg-surface: #ffffff;
            --bg-sidebar: #ffffff;
            --border-subtle: #f1f5f9;
            --border-default: #e2e8f0;
            --border-strong: #cbd5e1;
            
            --text-primary: #0f172a;
            --text-secondary: #334155;
            --text-muted: #64748b;
            --text-light: #94a3b8;

            /* Brand Accent: Ultramarine / Deep Proptech Blue */
            --primary: #1d4ed8;
            --primary-hover: #1e40af;
            --primary-light: #eff6ff;
            --primary-border: #bfdbfe;
            
            /* Safaricom M-Pesa Emerald */
            --mpesa: #047857;
            --mpesa-hover: #065f46;
            --mpesa-light: #ecfdf5;
            --mpesa-border: #a7f3d0;

            --danger: #be123c;
            --danger-light: #fff1f2;
            --danger-border: #fecdd3;

            --warning: #b45309;
            --warning-light: #fffbeb;
            --warning-border: #fde68a;

            --info: #0284c7;
            --info-light: #f0f9ff;
            --info-border: #bae6fd;

            --purple: #7c3aed;
            --purple-light: #f5f3ff;
            --purple-border: #ddd6fe;

            /* Generous, Softly Rounded Geometry (De-Cluttered Feel) */
            --radius-xs: 6px;
            --radius-sm: 8px;
            --radius-md: 12px;
            --radius-lg: 16px;
            --radius-xl: 22px;
            --radius-pill: 9999px;

            --shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.04);
            --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.06), 0 1px 2px rgba(15, 23, 42, 0.04);
            --shadow-md: 0 4px 12px -2px rgba(15, 23, 42, 0.06), 0 2px 4px -2px rgba(15, 23, 42, 0.04);
            --shadow-lg: 0 12px 24px -4px rgba(15, 23, 42, 0.08), 0 4px 6px -4px rgba(15, 23, 42, 0.03);

            /* Chosen Permanent Default: Outfit (Headings) + Manrope (Body) + Space Mono (Code/Finances) */
            --font-heading: 'Outfit', sans-serif;
            --font-body: 'Manrope', sans-serif;
            --font-code: 'Space Mono', monospace;
        }

        /* LIVE FONT COMBINATION THEMES */
        body.font-theme-fintech {
            --font-heading: 'Plus Jakarta Sans', sans-serif;
            --font-body: 'DM Sans', sans-serif;
        }
        body.font-theme-proptech {
            --font-heading: 'Sora', sans-serif;
            --font-body: 'Nunito Sans', sans-serif;
        }
        body.font-theme-architectural {
            --font-heading: 'Urbanist', sans-serif;
            --font-body: 'Manrope', sans-serif;
        }
        body.font-theme-grotesque {
            --font-heading: 'Outfit', sans-serif;
            --font-body: 'Manrope', sans-serif;
        }

        * {
            box-sizing: border-box;
            margin: 0;
            padding: 0;
        }

        body {
            font-family: var(--font-body);
            background-color: var(--bg-canvas);
            color: var(--text-primary);
            display: flex;
            height: 100vh;
            overflow: hidden;
            -webkit-font-smoothing: antialiased;
            letter-spacing: -0.01em;
        }

        /* BESPOKE SVG UTILITIES */
        .icon {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            flex-shrink: 0;
            line-height: 1;
        }

        .icon svg {
            width: 100%;
            height: 100%;
            stroke: currentColor;
            stroke-width: 1.8;
            stroke-linecap: round;
            stroke-linejoin: round;
            fill: none;
        }

        /* SIDEBAR BACKDROP FOR MOBILE DRAWER */
        .sidebar-backdrop {
            display: none;
            position: fixed;
            inset: 0;
            background: rgba(15, 23, 42, 0.45);
            backdrop-filter: blur(4px);
            z-index: 1040;
            transition: opacity 0.25s ease;
        }

        .sidebar-backdrop.active {
            display: block;
        }

        /* SIDEBAR */
        aside.sidebar {
            width: 275px;
            background: var(--bg-sidebar);
            border-right: 1px solid var(--border-default);
            display: flex;
            flex-direction: column;
            flex-shrink: 0;
            z-index: 30;
            transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
        }

        .sidebar-header {
            padding: 16px 18px 12px;
            border-bottom: 1px solid var(--border-subtle);
        }

        .brand-badge {
            display: flex;
            align-items: center;
            justify-content: space-between;
        }

        .brand-logo-icon {
            width: 38px;
            height: 38px;
            background: #0f172a;
            border-radius: var(--radius-md);
            display: flex;
            align-items: center;
            justify-content: center;
            color: white;
            box-shadow: 0 4px 8px rgba(0,0,0,0.12);
        }

        .brand-info h1 {
            font-family: var(--font-heading);
            font-size: 16.5px;
            font-weight: 800;
            letter-spacing: -0.02em;
            color: var(--text-primary);
            line-height: 1.2;
        }

        .brand-pill {
            display: inline-block;
            font-family: var(--font-code);
            font-size: 8.5px;
            font-weight: 700;
            background: var(--primary-light);
            color: var(--primary);
            padding: 1px 6px;
            border-radius: 6px;
            margin-left: 4px;
            vertical-align: middle;
            border: 1px solid var(--primary-border);
        }

        .brand-info p {
            font-size: 11.5px;
            color: var(--text-muted);
            font-weight: 500;
        }

        /* Persona Switcher Selector in Sidebar */
        .role-banner {
            margin-top: 12px;
            padding: 8px 10px;
            border-radius: var(--radius-md);
            background: #f8fafc;
            border: 1px solid var(--border-default);
            display: flex;
            align-items: center;
            justify-content: space-between;
        }

        .role-label {
            font-size: 11px;
            font-weight: 700;
            text-transform: uppercase;
            letter-spacing: 0.04em;
            color: var(--text-muted);
        }

        .role-select {
            background: transparent;
            border: none;
            font-family: var(--font-heading);
            font-size: 12px;
            font-weight: 700;
            color: var(--primary);
            cursor: pointer;
            outline: none;
        }

        nav.sidebar-nav {
            padding: 12px;
            flex: 1;
            overflow-y: auto;
        }

        .nav-section-title {
            font-size: 10px;
            font-weight: 800;
            text-transform: uppercase;
            letter-spacing: 0.08em;
            color: var(--text-light);
            padding: 14px 10px 4px;
        }

        .nav-btn {
            width: 100%;
            display: flex;
            align-items: center;
            justify-content: space-between;
            padding: 9px 12px;
            border-radius: var(--radius-md);
            background: transparent;
            border: none;
            color: var(--text-secondary);
            font-family: var(--font-body);
            font-size: 13px;
            font-weight: 600;
            cursor: pointer;
            transition: all 0.15s;
            margin-bottom: 2px;
            text-align: left;
        }

        .nav-btn:hover {
            background: var(--bg-canvas);
            color: var(--text-primary);
        }

        .nav-btn.active {
            background: var(--primary-light);
            color: var(--primary);
            font-weight: 700;
        }

        .nav-btn.active .icon {
            color: var(--primary) !important;
        }

        .nav-badge {
            font-family: var(--font-code);
            font-size: 10.5px;
            font-weight: 700;
            padding: 2px 7px;
            border-radius: var(--radius-pill);
            background: #f1f5f9;
            color: var(--text-secondary);
        }

        .nav-btn.active .nav-badge {
            background: #dbeafe;
            color: var(--primary);
        }

        .sidebar-footer {
            padding: 14px 16px;
            border-top: 1px solid var(--border-subtle);
            background: #ffffff;
        }

        .user-card {
            display: flex;
            align-items: center;
            gap: 10px;
            padding: 8px 10px;
            border-radius: var(--radius-md);
            background: var(--bg-canvas);
            border: 1px solid var(--border-default);
        }

        .user-avatar {
            width: 32px;
            height: 32px;
            border-radius: 50%;
            background: #0f172a;
            color: white;
            font-family: var(--font-heading);
            font-weight: 800;
            font-size: 12px;
            display: flex;
            align-items: center;
            justify-content: center;
            flex-shrink: 0;
        }

        /* Main Workspace Container */
        .workspace-wrapper {
            flex: 1;
            display: flex;
            flex-direction: column;
            overflow: hidden;
            background: var(--bg-canvas);
            position: relative;
        }

        /* Top Header */
        header.app-topbar {
            height: 64px;
            background: var(--bg-surface);
            border-bottom: 1px solid var(--border-default);
            display: flex;
            align-items: center;
            justify-content: space-between;
            padding: 0 24px;
            flex-shrink: 0;
            z-index: 20;
        }

        .topbar-left {
            display: flex;
            align-items: center;
            gap: 12px;
        }

        .mobile-toggle-btn {
            display: none;
            width: 36px;
            height: 36px;
            border-radius: var(--radius-md);
            background: #f8fafc;
            border: 1px solid var(--border-default);
            color: var(--text-primary);
            cursor: pointer;
            align-items: center;
            justify-content: center;
        }

        .breadcrumb-trail {
            display: flex;
            align-items: center;
            gap: 8px;
            font-size: 13px;
            color: var(--text-muted);
            font-weight: 500;
        }

        .breadcrumb-trail .current-crumb {
            color: var(--text-primary);
            font-family: var(--font-heading);
            font-weight: 700;
            font-size: 14.5px;
        }

        .topbar-actions {
            display: flex;
            align-items: center;
            gap: 10px;
        }

        /* Interactive Typography Theme Selector */
        .font-selector-pill {
            display: flex;
            align-items: center;
            gap: 6px;
            background: #f8fafc;
            border: 1px solid var(--border-default);
            padding: 4px 10px;
            border-radius: var(--radius-pill);
        }

        .font-select-input {
            border: none;
            background: transparent;
            font-family: var(--font-heading);
            font-size: 11.5px;
            font-weight: 700;
            color: var(--primary);
            outline: none;
            cursor: pointer;
        }

        .search-container {
            position: relative;
        }

        .search-container input {
            height: 36px;
            width: 220px;
            padding: 0 12px 0 34px;
            font-family: var(--font-body);
            font-size: 12.5px;
            background: var(--bg-canvas);
            border: 1px solid var(--border-default);
            border-radius: var(--radius-pill);
            color: var(--text-primary);
            outline: none;
            transition: all 0.2s;
        }

        .search-container input:focus {
            background: #ffffff;
            border-color: var(--primary);
            box-shadow: 0 0 0 3px rgba(29, 78, 216, 0.1);
            width: 260px;
        }

        .search-container .search-icon {
            position: absolute;
            left: 11px;
            top: 50%;
            transform: translateY(-50%);
            pointer-events: none;
            color: var(--text-light);
        }

        /* Buttons */
        .btn {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            gap: 7px;
            height: 36px;
            padding: 0 14px;
            font-family: var(--font-body);
            font-size: 12.5px;
            font-weight: 700;
            border-radius: var(--radius-md);
            cursor: pointer;
            transition: all 0.15s;
            border: 1px solid transparent;
            text-decoration: none;
            white-space: nowrap;
        }

        .btn-sm {
            height: 32px;
            padding: 0 11px;
            font-size: 12px;
            border-radius: var(--radius-sm);
        }

        .btn-pill {
            border-radius: var(--radius-pill);
        }

        .btn-primary {
            background: var(--primary);
            color: #ffffff;
            border-color: var(--primary);
            box-shadow: 0 2px 4px rgba(29, 78, 216, 0.18);
        }

        .btn-primary:hover {
            background: var(--primary-hover);
            border-color: var(--primary-hover);
        }

        .btn-mpesa {
            background: var(--mpesa);
            color: #ffffff;
            border-color: var(--mpesa);
            box-shadow: 0 2px 4px rgba(4, 120, 87, 0.18);
        }

        .btn-mpesa:hover {
            background: var(--mpesa-hover);
        }

        .btn-secondary {
            background: #ffffff;
            color: var(--text-secondary);
            border-color: var(--border-default);
            box-shadow: var(--shadow-xs);
        }

        .btn-secondary:hover {
            background: var(--bg-canvas);
            color: var(--text-primary);
            border-color: var(--border-strong);
        }

        /* Scrollable Page Canvas with Airy Spacing */
        main.page-canvas {
            flex: 1;
            overflow-y: auto;
            padding: 24px 28px;
        }

        .tab-panel {
            display: none;
            animation: fadeIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
        }

        .tab-panel.active {
            display: block;
        }

        @keyframes fadeIn {
            from { opacity: 0; transform: translateY(6px); }
            to { opacity: 1; transform: translateY(0); }
        }

        /* Banner Cards */
        .system-status-banner {
            background: #ffffff;
            border: 1px solid #eef2f6;
            border-radius: var(--radius-lg);
            padding: 16px 20px;
            display: flex;
            align-items: center;
            justify-content: space-between;
            margin-bottom: 22px;
            box-shadow: var(--shadow-sm);
        }

        .status-left {
            display: flex;
            align-items: center;
            gap: 12px;
        }

        .status-pulse-badge {
            width: 38px;
            height: 38px;
            border-radius: var(--radius-md);
            background: var(--primary-light);
            color: var(--primary);
            display: flex;
            align-items: center;
            justify-content: center;
        }

        .status-text h2 {
            font-family: var(--font-heading);
            font-size: 14.5px;
            font-weight: 700;
            color: var(--text-primary);
        }

        .status-text p {
            font-size: 12.5px;
            color: var(--text-secondary);
            margin-top: 1px;
        }

        /* KPI Metric Tiles */
        .metrics-grid {
            display: grid;
            grid-template-columns: repeat(4, 1fr);
            gap: 18px;
            margin-bottom: 22px;
        }

        .metric-tile {
            background: var(--bg-surface);
            border: 1px solid #eef2f6;
            border-radius: var(--radius-lg);
            padding: 18px 20px;
            box-shadow: var(--shadow-sm);
            transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
        }

        .metric-tile:hover {
            box-shadow: var(--shadow-md);
            transform: translateY(-2px);
            border-color: var(--border-default);
        }

        .metric-top {
            display: flex;
            align-items: center;
            justify-content: space-between;
            margin-bottom: 8px;
        }

        .metric-label {
            font-size: 11px;
            font-weight: 700;
            text-transform: uppercase;
            letter-spacing: 0.05em;
            color: var(--text-muted);
        }

        .status-chip {
            font-family: var(--font-code);
            font-size: 10px;
            font-weight: 700;
            padding: 2.5px 8px;
            border-radius: var(--radius-pill);
            display: inline-flex;
            align-items: center;
            gap: 4px;
        }

        .chip-emerald {
            background: var(--mpesa-light);
            color: var(--mpesa);
            border: 1px solid var(--mpesa-border);
        }

        .chip-rose {
            background: var(--danger-light);
            color: var(--danger);
            border: 1px solid var(--danger-border);
        }

        .chip-amber {
            background: var(--warning-light);
            color: var(--warning);
            border: 1px solid var(--warning-border);
        }

        .chip-sky {
            background: var(--info-light);
            color: var(--info);
            border: 1px solid var(--info-border);
        }

        .chip-purple {
            background: var(--purple-light);
            color: var(--purple);
            border: 1px solid var(--purple-border);
        }

        .chip-slate {
            background: #f1f5f9;
            color: var(--text-secondary);
            border: 1px solid var(--border-default);
        }

        .metric-amount {
            font-family: var(--font-heading);
            font-size: 26px;
            font-weight: 800;
            color: var(--text-primary);
            letter-spacing: -0.03em;
            line-height: 1.15;
        }

        .metric-footer {
            font-size: 12px;
            color: var(--text-muted);
            margin-top: 6px;
        }

        /* Split Cards Grid with Generous Spacing */
        .two-column-split {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 20px;
            margin-bottom: 22px;
        }

        .three-column-grid {
            display: grid;
            grid-template-columns: 2fr 1fr 1fr;
            gap: 20px;
            margin-bottom: 22px;
        }

        .content-card {
            background: var(--bg-surface);
            border: 1px solid #eef2f6;
            border-radius: var(--radius-lg);
            box-shadow: var(--shadow-sm);
            overflow: hidden;
            transition: all 0.2s;
        }

        .content-card-header {
            padding: 16px 20px;
            border-bottom: 1px solid var(--border-subtle);
            display: flex;
            align-items: center;
            justify-content: space-between;
        }

        .card-heading {
            font-family: var(--font-heading);
            font-size: 14px;
            font-weight: 700;
            color: var(--text-primary);
            display: flex;
            align-items: center;
            gap: 8px;
        }

        /* SaaS Data Table with Breathable Row Spacing */
        .table-card {
            background: var(--bg-surface);
            border: 1px solid #eef2f6;
            border-radius: var(--radius-lg);
            box-shadow: var(--shadow-sm);
            overflow: hidden;
            margin-bottom: 22px;
        }

        .table-responsive {
            width: 100%;
            overflow-x: auto;
            -webkit-overflow-scrolling: touch;
        }

        .table-toolbar {
            padding: 14px 20px;
            border-bottom: 1px solid var(--border-subtle);
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 14px;
            background: #ffffff;
            flex-wrap: wrap;
        }

        .toolbar-left {
            display: flex;
            align-items: center;
            gap: 10px;
            flex-wrap: wrap;
        }

        .filter-select {
            height: 34px;
            padding: 0 12px;
            font-family: var(--font-body);
            font-size: 12px;
            background: var(--bg-canvas);
            border: 1px solid var(--border-default);
            border-radius: var(--radius-pill);
            color: var(--text-secondary);
            font-weight: 600;
            outline: none;
            cursor: pointer;
        }

        .data-table {
            width: 100%;
            border-collapse: collapse;
            text-align: left;
        }

        .data-table th {
            background: #f8fafc;
            padding: 12px 18px;
            font-family: var(--font-heading);
            font-size: 11px;
            font-weight: 700;
            text-transform: uppercase;
            letter-spacing: 0.05em;
            color: var(--text-muted);
            border-bottom: 1px solid var(--border-default);
            white-space: nowrap;
        }

        .data-table td {
            padding: 13px 18px;
            font-size: 13px;
            color: var(--text-secondary);
            border-bottom: 1px solid var(--border-subtle);
            vertical-align: middle;
        }

        .data-table tbody tr {
            transition: background 0.15s;
        }

        .data-table tbody tr:hover {
            background: #f8fafc;
        }

        .font-mono-val {
            font-family: var(--font-code);
            font-weight: 700;
            color: var(--text-primary);
        }

        /* Modals */
        .modal-overlay {
            position: fixed;
            inset: 0;
            background: rgba(15, 23, 42, 0.45);
            backdrop-filter: blur(6px);
            display: none;
            align-items: center;
            justify-content: center;
            z-index: 1000;
        }

        .modal-overlay.active {
            display: flex;
        }

        .modal-box {
            background: #ffffff;
            width: 520px;
            max-width: 92vw;
            border-radius: var(--radius-xl);
            border: 1px solid var(--border-default);
            box-shadow: var(--shadow-lg);
            overflow: hidden;
            animation: modalPop 0.25s cubic-bezier(0.16, 1, 0.3, 1);
        }

        @keyframes modalPop {
            from { opacity: 0; transform: scale(0.96) translateY(10px); }
            to { opacity: 1; transform: scale(1) translateY(0); }
        }

        .modal-top {
            padding: 18px 22px;
            border-bottom: 1px solid var(--border-subtle);
            display: flex;
            align-items: center;
            justify-content: space-between;
        }

        .modal-title {
            font-family: var(--font-heading);
            font-size: 16px;
            font-weight: 800;
            color: var(--text-primary);
            display: flex;
            align-items: center;
            gap: 8px;
        }

        .modal-close-btn {
            background: transparent;
            border: 1px solid var(--border-default);
            width: 30px;
            height: 30px;
            border-radius: 50%;
            cursor: pointer;
            color: var(--text-muted);
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 14px;
        }

        .modal-contents {
            padding: 22px;
        }

        .modal-bottom {
            padding: 14px 22px;
            background: #f8fafc;
            border-top: 1px solid var(--border-default);
            display: flex;
            align-items: center;
            justify-content: flex-end;
            gap: 10px;
        }

        .input-group-custom {
            margin-bottom: 15px;
        }

        .input-group-custom label {
            display: block;
            font-size: 12px;
            font-weight: 700;
            color: var(--text-primary);
            margin-bottom: 5px;
        }

        .input-custom {
            width: 100%;
            height: 38px;
            padding: 0 12px;
            font-family: var(--font-body);
            font-size: 13px;
            color: var(--text-primary);
            background: #ffffff;
            border: 1px solid var(--border-default);
            border-radius: var(--radius-md);
            outline: none;
            transition: all 0.15s;
        }

        .input-custom:focus {
            border-color: var(--primary);
            box-shadow: 0 0 0 3px rgba(29, 78, 216, 0.15);
        }

        textarea.input-custom {
            height: 80px;
            padding: 10px 12px;
            resize: vertical;
        }

        /* Toast Popup */
        .toast-popup {
            position: fixed;
            bottom: 24px;
            right: 24px;
            background: #ffffff;
            border-radius: var(--radius-lg);
            border: 1px solid var(--border-default);
            box-shadow: var(--shadow-lg);
            padding: 14px 18px;
            display: flex;
            align-items: center;
            gap: 12px;
            z-index: 2000;
            transform: translateY(100px);
            opacity: 0;
            transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
        }

        .toast-popup.visible {
            transform: translateY(0);
            opacity: 1;
        }

        /* ========================================================
           RESPONSIVE MEDIA QUERIES (MOBILE, TABLET & DESKTOP)
           ======================================================== */
        @media (max-width: 1280px) {
            .three-column-grid {
                grid-template-columns: 1fr;
            }
        }

        @media (max-width: 1024px) {
            /* Mobile Drawer Navigation */
            aside.sidebar {
                position: fixed;
                top: 0;
                bottom: 0;
                left: 0;
                width: 285px;
                transform: translateX(-100%);
                box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.3);
                z-index: 1050;
            }
            aside.sidebar.mobile-open {
                transform: translateX(0);
            }
            .mobile-toggle-btn {
                display: flex;
            }
            .metrics-grid {
                grid-template-columns: repeat(2, 1fr);
                gap: 14px;
            }
            .two-column-split {
                grid-template-columns: 1fr;
                gap: 16px;
            }
            main.page-canvas {
                padding: 18px 20px;
            }
        }

        @media (max-width: 768px) {
            header.app-topbar {
                padding: 0 12px;
                height: 56px;
                display: flex;
                align-items: center;
                justify-content: space-between;
                gap: 8px;
            }
            .topbar-left {
                display: flex;
                align-items: center;
                gap: 8px;
                min-width: 0;
                flex: 1;
                overflow: hidden;
            }
            .breadcrumb-trail {
                min-width: 0;
                overflow: hidden;
                white-space: nowrap;
            }
            .breadcrumb-trail span:not(.current-crumb) {
                display: none;
            }
            .breadcrumb-trail .current-crumb {
                font-size: 13.5px;
                white-space: nowrap;
                overflow: hidden;
                text-overflow: ellipsis;
                display: block;
            }
            .topbar-actions {
                display: flex;
                align-items: center;
                gap: 6px;
                flex-shrink: 0;
            }
            .topbar-actions .search-container,
            .topbar-actions .btn-secondary,
            .topbar-actions .btn-primary {
                display: none; /* Hide desktop search and batch buttons on mobile header */
            }
            .topbar-actions .btn-mpesa {
                height: 30px;
                padding: 0 8px;
                font-size: 11px;
            }
            .font-selector-pill {
                padding: 3px 6px;
                gap: 4px;
            }
            .font-selector-pill span {
                display: none; /* Hide label 'Font:' on mobile */
            }
            .font-select-input {
                max-width: 120px;
                font-size: 11px;
            }
            .metrics-grid {
                grid-template-columns: 1fr;
                gap: 12px;
            }
            .system-status-banner {
                flex-direction: column;
                align-items: flex-start;
                gap: 12px;
            }
            main.page-canvas {
                padding: 14px 12px;
            }
            .table-toolbar {
                padding: 12px 14px;
            }
            .content-card-header {
                padding: 14px 16px;
            }
            .metric-amount {
                font-size: 24px;
            }
        }

        /* PRINT STYLING FOR EXECUTIVE PDF REPORTS */
        @media print {
            body {
                background: #ffffff;
                color: #000000;
                overflow: visible;
                display: block;
            }
            aside.sidebar, header.app-topbar, .modal-overlay, .toast-popup, .topbar-actions, button {
                display: none !important;
            }
            .workspace-wrapper {
                overflow: visible;
            }
            main.page-canvas {
                padding: 0;
                overflow: visible;
            }
            .tab-panel {
                display: block !important;
            }
            .tab-panel:not(#view-reports) {
                display: none !important;
            }
            .table-card, .content-card, .metric-tile {
                border: 1px solid #ccc !important;
                box-shadow: none !important;
                page-break-inside: avoid;
            }
        }


/* ========================================================
   PRODUCTION POLISH
   ======================================================== */

/* Accessibility */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.skip-link { position: absolute; left: 12px; top: -48px; z-index: 3000; background: #0f172a; color: #fff; padding: 10px 16px; border-radius: var(--radius-md); font-weight: 700; text-decoration: none; transition: top 0.15s; }
.skip-link:focus { top: 12px; }
:where(a, button, input, select, textarea, [tabindex]):focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
#main:focus { outline: none; }
[hidden] { display: none !important; }
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* Sidebar: single-line labels, badges never wrap */
.nav-label { display: flex; align-items: center; gap: 10px; min-width: 0; }
.nav-label > span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-icon { width: 16px; height: 16px; flex-shrink: 0; color: var(--text-muted); }
.nav-btn .nav-badge { flex-shrink: 0; white-space: nowrap; margin-left: 8px; }
.user-name { font-size: 12.5px; font-weight: 700; color: var(--text-primary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-role { font-size: 11px; color: var(--text-muted); text-transform: capitalize; }
.signout-btn { width: 30px; height: 30px; display: flex; align-items: center; justify-content: center; border: 1px solid var(--border-default); background: #fff; border-radius: var(--radius-sm); color: var(--text-secondary); cursor: pointer; }
.signout-btn:hover { color: var(--danger); border-color: var(--danger); }

/* Top bar */
.page-title { font-family: var(--font-heading); font-size: 16px; font-weight: 700; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-left { min-width: 0; }
.topbar-actions .search-container { display: block; }
.search-container input { width: 240px; }
.banner-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* Forms & modals */
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-error { color: var(--danger); background: #fff1f2; border: 1px solid #fecdd3; border-radius: var(--radius-sm); padding: 9px 12px; font-size: 12.5px; font-weight: 600; margin: 4px 0 0; }
.modal-note { font-size: 12.5px; line-height: 1.55; color: var(--text-muted); margin: 0 0 14px; }
.modal-title { font-family: var(--font-heading); font-size: 15px; font-weight: 700; color: var(--text-primary); margin: 0; }
.modal-box { max-height: 92vh; overflow-y: auto; }
.btn:disabled { opacity: 0.6; cursor: not-allowed; }
.btn-block { width: 100%; border-radius: var(--radius-md); }
.card-pad { padding: 18px 20px; }
.content-card-narrow { max-width: 640px; }
.calc-box { background: #f8fafc; border: 1px solid var(--border-default); border-radius: var(--radius-md); padding: 14px; margin: 0 0 16px; }
.calc-box > div { display: flex; justify-content: space-between; font-size: 12.5px; margin-bottom: 5px; }
.calc-box dt, .calc-box dd { margin: 0; }
.calc-box .calc-total { font-size: 14px; font-weight: 700; border-top: 1px solid var(--border-default); padding-top: 6px; margin: 5px 0 0; }
.calc-box .calc-total dd { color: var(--primary); }

/* Toast */
.toast-popup { max-width: min(420px, calc(100vw - 32px)); }
.toast-icon { width: 18px; height: 18px; color: var(--mpesa); flex-shrink: 0; }
.toast-popup.is-error { border-color: #fecdd3; }
.toast-popup.is-error .toast-icon { color: var(--danger); }
.toast-head { font-size: 13px; font-weight: 700; color: var(--text-primary); }
.toast-desc { font-size: 12px; color: var(--text-muted); line-height: 1.45; }

/* Cards, lists, charts */
.chart-box { padding: 18px 20px; height: 265px; position: relative; }
.chart-box-donut { padding: 14px 18px; }
.chart-box-tall { height: 280px; }
.chart-empty { display: flex; align-items: center; justify-content: center; height: 100%; margin: 0; color: var(--text-muted); font-size: 13px; }
.list-pad { padding: 8px 20px; }
.list-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border-subtle); }
.list-row:last-child { border-bottom: 0; }
.list-row-main { display: flex; align-items: center; gap: 10px; min-width: 0; }
.thumb { width: 40px; height: 40px; border-radius: var(--radius-md); overflow: hidden; background: var(--primary-light); color: var(--primary); display: flex; align-items: center; justify-content: center; font-family: var(--font-heading); font-weight: 800; flex-shrink: 0; }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.row-title { font-weight: 700; font-size: 13.5px; color: var(--text-primary); }
.row-sub { font-size: 11.5px; color: var(--text-muted); }
.row-figures { text-align: right; flex-shrink: 0; }
.unit-suffix { font-size: 11px; font-weight: 400; color: var(--text-muted); margin-left: 2px; }
.empty-state { text-align: center; color: var(--text-muted); font-size: 13px; padding: 28px 12px !important; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cell-clamp { max-width: 260px; }
.cell-wrap { max-width: 340px; font-size: 12.5px; line-height: 1.45; }
.data-table tfoot th, .data-table tfoot td { background: #f1f5f9; border-top: 2px solid var(--border-default); font-weight: 800; color: var(--text-primary); text-transform: none; letter-spacing: 0; font-size: 13px; }
.data-table thead th { position: sticky; top: 0; z-index: 1; }
.statement { margin: 0 0 8px; }
.statement > div { display: flex; justify-content: space-between; padding: 9px 0; border-bottom: 1px solid var(--border-subtle); font-size: 13px; }
.statement dt, .statement dd { margin: 0; }
.statement .statement-total { font-weight: 800; font-size: 14.5px; color: var(--text-primary); }
.pay-steps { margin: 0 0 18px; padding-left: 20px; font-size: 13px; line-height: 1.9; color: var(--text-secondary); }
.subhead { font-family: var(--font-heading); font-size: 13px; margin: 6px 0 4px; color: var(--text-primary); }

/* Sign-in page */
.auth-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: var(--bg-canvas); padding: 20px; overflow: auto; }
.auth-card { width: 100%; max-width: 400px; background: #fff; border: 1px solid var(--border-default); border-radius: var(--radius-xl); box-shadow: var(--shadow-lg); padding: 32px 30px; }
.auth-card .brand-logo-icon { margin-bottom: 18px; }
.auth-card h1 { font-family: var(--font-heading); font-size: 22px; margin: 0 0 4px; color: var(--text-primary); }
.auth-sub { margin: 0 0 22px; font-size: 13px; color: var(--text-muted); }
.auth-remember { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--text-secondary); margin: 14px 0; }
.auth-submit { width: 100%; height: 42px; border-radius: var(--radius-md); justify-content: center; }

@media (max-width: 768px) {
    .topbar-actions .search-container { display: block; }
    .search-container input { width: 120px; }
    .search-container input:focus { width: 150px; }
    .form-row { grid-template-columns: 1fr; }
    .chart-box { height: 240px; }
    .toast-popup { left: 16px; right: 16px; bottom: 16px; }
}

.status-chip { white-space: nowrap; }
.metric-top { gap: 8px; }
.metric-label { min-width: 0; }

/* ========================================================
   PWA: install prompt, safe areas for notched phones
   ======================================================== */
.pwa-banner { position: fixed; left: 50%; bottom: calc(16px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 1500;
    width: min(460px, calc(100vw - 24px)); display: flex; align-items: center; gap: 12px; padding: 12px 14px;
    background: #fff; border: 1px solid var(--border-default); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); }
.pwa-banner img { border-radius: 10px; flex-shrink: 0; }
.pwa-banner p { flex: 1; margin: 0; font-size: 12.5px; line-height: 1.4; color: var(--text-secondary); font-weight: 600; }
.pwa-dismiss { width: 28px; height: 28px; border: 0; background: transparent; color: var(--text-muted); border-radius: 50%; cursor: pointer; flex-shrink: 0; }
.pwa-dismiss:hover { background: #f1f5f9; color: var(--text-primary); }
.pwa-sheet { position: fixed; inset: 0; z-index: 2500; background: rgba(15, 23, 42, 0.5); display: flex; align-items: flex-end; justify-content: center; padding: 16px; }
.pwa-sheet-box { width: min(440px, 100%); background: #fff; border-radius: var(--radius-xl); padding: 22px 22px calc(22px + env(safe-area-inset-bottom)); }
.pwa-sheet-box h3 { font-family: var(--font-heading); font-size: 17px; margin: 0 0 12px; }
.pwa-sheet-box ol { margin: 0 0 18px; padding-left: 20px; font-size: 13.5px; line-height: 1.9; color: var(--text-secondary); }
.install-btn { margin-bottom: 10px; }

@supports (padding: max(0px)) {
    header.app-topbar { padding-top: env(safe-area-inset-top); height: calc(64px + env(safe-area-inset-top)); }
    aside.sidebar { padding-top: env(safe-area-inset-top); }
    .toast-popup { bottom: calc(24px + env(safe-area-inset-bottom)); }
}
@media (display-mode: standalone) {
    body { overscroll-behavior-y: none; -webkit-tap-highlight-color: transparent; }
}
@media (max-width: 768px) {
    @supports (padding: max(0px)) { header.app-topbar { height: calc(56px + env(safe-area-inset-top)); } }
    .pwa-banner { bottom: calc(76px + env(safe-area-inset-bottom)); }
}
