        @import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800;900&display=swap');
        @import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@500;600;700;800;900&display=swap');
        @import url('https://fonts.googleapis.com/css2?family=Space+Mono:wght@400;700&display=swap');
        
        :root {
            --munno-blue: #0284C7; --munno-light: #E0F2FE; --slate-900: #0F172A; --slate-800: #1E293B; --slate-100: #F1F5F9; --slate-50: #F8FAFC; --border-color: #E2E8F0;
            --text-main: #475569; --text-muted: #94A3B8; --text-heading: #0F172A; --success: #059669; --danger: #DC2626; --warning: #D97706; --purple: #4F46E5;
            --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05); --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1); --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1);
        }

        * { box-sizing: border-box; margin: 0; padding: 0; font-family: 'Inter', system-ui, sans-serif; -webkit-font-smoothing: antialiased;}
        body { background-color: var(--slate-100); color: var(--text-main); display: flex; flex-direction: column; min-height: 100vh; font-size: 13px; overflow-x: hidden; }

        /* --- BOOT & LOGIN ANIMATION --- */
        #splash-screen { position: fixed; inset: 0; z-index: 999999; background: #0F172A; display: none; flex-direction: column; align-items: center; justify-content: center; color: white; transition: opacity 0.6s ease; opacity: 0; }
        .splash-brand { font-size: 80px; font-weight: 900; letter-spacing: 6px; color: white; animation: scaleUp 1.2s cubic-bezier(0.16, 1, 0.3, 1) forwards; text-align: center; line-height: 1;}
        .splash-brand span { color: var(--munno-blue); }
        .splash-sub { font-size: 14px; font-weight: 600; color: var(--text-muted); letter-spacing: 3px; margin-top: 12px; opacity: 0; animation: fadeIn 1s ease-out 0.8s forwards; text-transform: uppercase; text-align: center;}
        
        @keyframes scaleUp { 0% { transform: scale(0.9); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }
        @keyframes fadeIn { 0% { opacity: 0; transform: translateY(10px); } 100% { opacity: 1; transform: translateY(0); } }

        /* --- CELEBRATION BALLOONS --- */
        .balloon { position: fixed; bottom: -100px; width: 40px; height: 50px; background-color: var(--munno-blue); border-radius: 50% 50% 50% 50% / 40% 40% 60% 60%; z-index: 99999; animation: floatUp 4s ease-in forwards; opacity: 0.9; box-shadow: inset -5px -5px 10px rgba(0,0,0,0.2); }
        .balloon::before { content: ''; position: absolute; bottom: -8px; left: 50%; transform: translateX(-50%); width: 0; height: 0; border-left: 5px solid transparent; border-right: 5px solid transparent; border-bottom: 10px solid var(--munno-blue); }
        .balloon::after { content: ''; position: absolute; bottom: -40px; left: 50%; width: 1px; height: 40px; background: rgba(0,0,0,0.2); }
        @keyframes floatUp { 0% { transform: translateY(0) scale(1); opacity: 1; } 100% { transform: translateY(-120vh) scale(1.1) rotate(15deg); opacity: 0; } }

        /* --- SYSTEM CORE --- */
        #auth-portal { position: fixed; inset: 0; background: linear-gradient(135deg, var(--slate-900) 0%, #000000 100%); z-index: 99999; display: none; flex-direction: column; justify-content: center; align-items: center; color: white; transition: opacity 0.4s ease; opacity: 0; padding: 20px;}
        .auth-box { background: white; padding: 48px 40px; border-radius: 20px; width: 100%; max-width: 420px; box-shadow: var(--shadow-lg); color: var(--text-heading); text-align: center; position: relative;}
        .global-login-logo { max-height: 70px; margin: 0 auto 24px auto; display: none; object-fit: contain; }

        header.top-nav { position: fixed; top: 0; left: 0; right: 0; height: 72px; background-color: white; border-bottom: 1px solid var(--border-color); display: flex; align-items: center; justify-content: space-between; padding: 0 32px; z-index: 1500; box-shadow: var(--shadow-sm); }
        .nav-brand-wrapper { display: flex; align-items: center; height: 100%; gap: 16px;}
        .system-title { font-weight: 900; font-size: 1.25rem; color: var(--text-heading); letter-spacing: -0.03em; display: flex; flex-direction: row; gap: 8px; align-items: center;}
        .role-badge { background: var(--munno-light); color: var(--munno-blue); font-size: 0.65rem; padding: 4px 8px; border-radius: 12px; font-weight: 800; text-transform: uppercase; margin-top: 2px; display: inline-block; width: max-content;}
        
        nav.nav-links-wrapper { display: flex; gap: 8px; align-items: center; height: 100%; }
        
        .nav-btn { background: transparent; border: none; padding: 8px 12px; font-size: 13px; font-weight: 600; color: var(--text-main); cursor: pointer; border-radius: 6px; transition: all 0.2s; white-space: nowrap;}
        .nav-btn:hover { background-color: var(--slate-50); color: var(--munno-blue); }

        .nav-folder { position: relative; align-items: center; height: 100%; padding: 0 4px; }
        .folder-trigger-btn { background: transparent; border: none; padding: 8px 12px; font-size: 13px; font-weight: 600; color: var(--text-main); cursor: pointer; border-radius: 6px; transition: all 0.2s; display: flex; align-items: center; gap: 6px; white-space: nowrap;}
        .folder-dropdown-content { visibility: hidden; opacity: 0; position: absolute; top: 100%; left: 0; background-color: white; min-width: 240px; box-shadow: var(--shadow-lg); z-index: 2000; border: 1px solid var(--border-color); border-radius: 12px; padding: 8px; transform: translateY(10px); transition: all 0.2s; }
        .folder-dropdown-content.show { visibility: visible; opacity: 1; transform: translateY(0); }
        .folder-dropdown-content button { width: 100%; text-align: left; background: none; border: none; padding: 12px 14px; font-size: 13px; font-weight: 500; color: var(--text-main); border-radius: 8px; cursor: pointer; transition: all 0.15s; display: flex; align-items: center; gap: 8px; margin-bottom: 2px;}
        .folder-dropdown-content button:hover { background-color: var(--slate-50); color: var(--text-heading); }
        .menu-divider { height: 1px; background-color: var(--border-color); margin: 6px 0; }

        .inbox-btn { background: white; border: 1px solid var(--border-color); color: var(--text-heading); padding: 8px 16px; border-radius: 20px; font-weight: 600; cursor: pointer; display: flex; align-items: center; gap: 8px; font-size: 13px; box-shadow: var(--shadow-sm);}
        .inbox-btn.has-alerts { border-color: var(--danger); }
        .inbox-badge { background: var(--danger); color: white; font-size: 11px; font-weight: 800; padding: 2px 6px; border-radius: 10px; display: none; }
        .inbox-btn.has-alerts .inbox-badge { display: inline-block; }
        
        #inbox-modal { display: none; position: fixed; top: 80px; right: 32px; width: 420px; background: white; border: 1px solid var(--border-color); border-radius: 16px; box-shadow: var(--shadow-lg); z-index: 3000; padding: 0; overflow: hidden; max-height: 80vh; flex-direction: column;}
        .inbox-header { display:flex; justify-content:space-between; align-items:center; padding: 16px 20px; border-bottom: 1px solid var(--border-color); background: var(--slate-50); font-weight: 700;}
        .inbox-tabs { display: flex; border-bottom: 1px solid var(--border-color); }
        .inbox-tab { flex: 1; text-align: center; padding: 12px; font-weight: 600; cursor: pointer; color: var(--text-muted); background: var(--slate-50); transition: all 0.2s;}
        .inbox-tab.active { background: white; color: var(--munno-blue); border-bottom: 2px solid var(--munno-blue); }
        #inbox-list, #inbox-chat { padding: 12px; overflow-y: auto; flex: 1; height: 400px; display: flex; flex-direction: column; }
        .inbox-item { padding: 16px; border: 1px solid var(--border-color); border-radius: 12px; margin-bottom: 8px; cursor: pointer; background: white;}
        .inbox-item:hover { border-color: var(--munno-blue); }
        
        .chat-msg { padding: 10px 14px; border-radius: 12px; margin-bottom: 8px; max-width: 85%; font-size: 13px; line-height: 1.4; word-wrap: break-word;}
        .chat-msg.sent { background: var(--munno-blue); color: white; align-self: flex-end; border-bottom-right-radius: 2px;}
        .chat-msg.recv { background: var(--slate-100); color: var(--text-heading); align-self: flex-start; border-bottom-left-radius: 2px;}
        .chat-msg img, .chat-msg video { max-width: 100%; border-radius: 8px; margin-top: 8px; }
        .chat-sender-name { font-size: 10px; opacity: 0.7; margin-bottom: 4px; display: block; font-weight: 700;}

        main { flex: 1; margin-top: 72px; padding: 40px; min-height: calc(100vh - 72px); max-width: 1400px; margin-left: auto; margin-right: auto; width: 100%; }
        .view-header { display: flex; justify-content: space-between; align-items: flex-end; margin-bottom: 32px; padding-bottom: 24px; border-bottom: 1px solid var(--border-color); }
        .view-header h1 { font-size: 26px; font-weight: 800; color: var(--text-heading); letter-spacing: -0.03em; }
        
        .header-account-card { display: flex; gap: 24px; text-align: right; }
        .bal-block label { font-size: 11px; text-transform: uppercase; font-weight: 700; color: var(--text-muted); }
        .bal-block div { font-size: 20px; font-weight: 800; color: var(--munno-blue); font-family: 'Inter', monospace; margin-top: 4px; }
        .bal-block.hq div { color: var(--purple); }

        .card { background-color: white; border: 1px solid var(--border-color); border-radius: 16px; padding: 24px; margin-bottom: 24px; box-shadow: var(--shadow-sm); }
        .card-header { font-size: 15px; font-weight: 700; color: var(--text-heading); margin-bottom: 20px; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--slate-50); padding-bottom: 12px; }
        .split-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; align-items: start; }
        .form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; }
        .form-group { margin-bottom: 16px; width: 100%; }
        .form-group label { display: block; font-size: 12px; font-weight: 600; color: var(--text-heading); margin-bottom: 6px; }
        .form-control { width: 100%; padding: 10px 12px; border: 1px solid var(--border-color); background-color: white; border-radius: 8px; font-size: 13px; outline: none; transition: all 0.2s; }
        .form-control:focus { border-color: var(--munno-blue); box-shadow: 0 0 0 3px var(--munno-light); }
        .form-control:disabled { background-color: var(--slate-50); color: var(--text-muted); }

        .btn { background-color: var(--munno-blue); color: white; border: none; padding: 10px 16px; font-size: 13px; font-weight: 600; border-radius: 8px; cursor: pointer; transition: all 0.2s; display: inline-flex; justify-content: center; align-items: center; gap: 6px; }
        .btn:hover { opacity: 0.9; transform: translateY(-1px); box-shadow: var(--shadow-md); }
        .btn-success { background-color: var(--success); }
        .btn-danger { background-color: var(--danger); }
        .btn-warning { background-color: var(--warning); }
        .btn-secondary { background-color: white; border: 1px solid var(--border-color); color: var(--text-heading); box-shadow: var(--shadow-sm); }
        .btn-secondary:hover { background-color: var(--slate-50); }

        .table-responsive { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; margin-bottom: 16px; border-radius: 8px;}
        table { width: 100%; border-collapse: separate; border-spacing: 0; text-align: left; font-size: 13px; min-width: 600px; }
        th { padding: 12px 16px; background-color: var(--slate-50); border-bottom: 1px solid var(--border-color); color: var(--text-heading); font-weight: 700; font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em;}
        td { padding: 14px 16px; border-bottom: 1px solid var(--slate-50); color: var(--text-main); vertical-align: middle; }
        .text-right { text-align: right; }
        .text-center { text-align: center; }
        .font-mono { font-family: 'Inter', monospace; font-variant-numeric: tabular-nums; }
        .val-inflow { color: var(--success); font-weight: 700; }
        .val-outflow { color: var(--danger); font-weight: 700; }
        .status-tag { padding: 4px 10px; border-radius: 12px; font-size: 11px; font-weight: 700; text-transform: uppercase; display: inline-block; }
        .status-draft { background: var(--slate-100); color: var(--text-main); }
        .status-pending { background: #FEF3C7; color: var(--warning); }
        .status-active { background: #D1FAE5; color: var(--success); }
        .status-rejected { background: #FEE2E2; color: var(--danger); }
        .pill { padding: 4px 10px; border-radius: 16px; font-size: 11px; font-weight: 700; background-color: var(--slate-100); color: var(--slate-800); border: 1px solid var(--border-color); display: inline-block;}
        .pill.sum-pill { background-color: var(--slate-800); color: white; border-color: var(--slate-900); }

        .pocket-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 20px; margin-bottom: 24px; }
        .pocket-card { background-color: white; border: 1px solid var(--border-color); border-radius: 12px; padding: 20px; box-shadow: var(--shadow-sm);}
        .pocket-card.central { border-top: 4px solid var(--purple); }
        .pocket-card h3 { font-size: 13px; font-weight: 700; color: var(--text-heading); }
        .pocket-card .amount { font-size: 20px; font-weight: 800; color: var(--text-heading); font-family: 'Inter', monospace; margin-top: 8px;}

        .view-panel { display: none; }
        .view-panel.active-panel { display: block; animation: fadeIn 0.3s ease; }

        .modal-overlay { position: fixed; inset: 0; background: rgba(15, 23, 42, 0.8); z-index: 5000; display: none; justify-content: center; align-items: center; padding: 20px;}
        .modal-box { background: white; padding: 32px; border-radius: 16px; width: 100%; max-width: 450px; box-shadow: var(--shadow-lg); max-height: 90vh; overflow-y: auto;}

        /* --- MODERNIZED PRINT STATIONERY --- */
        .formal-doc-wrapper { position: relative; background: white; border: 1px solid var(--border-color); border-radius: 16px; padding: 48px; margin: 0 auto 32px auto; box-shadow: var(--shadow-md); max-width: 900px; padding-bottom: 80px; }
        .formal-doc-wrapper * { font-family: 'Montserrat', sans-serif; }
        
        .elegant-header { text-align: center; border-bottom: 4px double var(--slate-900); padding-bottom: 24px; margin-bottom: 32px; position: relative; }
        .elegant-header::after { content: ''; position: absolute; bottom: -8px; left: 10%; right: 10%; border-bottom: 1px solid var(--slate-300); }
        .elegant-header .doc-comp-name { font-size: 28px; font-weight: 900; color: var(--text-heading); text-transform: uppercase; letter-spacing: 2px; margin-bottom: 12px; }
        
        .doc-footer { position: absolute; bottom: 24px; left: 0; right: 0; text-align: center; font-size: 10px; font-weight: 700; color: #94A3B8; text-transform: uppercase; letter-spacing: 0.05em; border-top: 1px solid var(--border-color); padding-top: 16px; margin: 0 48px; }
        
        .modern-doc-pill { background: var(--slate-900); color: white; padding: 6px 16px; border-radius: 20px; font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: 2px; display: inline-block; margin-bottom: 8px;}
        .doc-section-title { font-size: 12px; font-weight: 800; border-left: 4px solid var(--munno-blue); background: linear-gradient(90deg, var(--slate-50) 0%, transparent 100%); padding: 8px 16px; margin-bottom: 16px; color: var(--text-heading); text-transform: uppercase; letter-spacing: 0.05em;}
        
        .formal-table { width: 100%; border-collapse: collapse; margin-bottom: 24px; border: 1px solid var(--border-color); min-width: 100%;}
        .formal-table th, .formal-table td { border: 1px solid var(--border-color); padding: 12px 14px; font-size: 12px; color: var(--text-heading); }
        .formal-table th { background: var(--slate-50); font-weight: 800; text-transform: uppercase; font-size: 11px;}
        
        .signature-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 48px; margin-top: 40px; }
        .sig-box .title { font-weight: 800; font-size: 12px; margin-bottom: 40px; text-transform: uppercase; color: var(--text-muted);}
        .sig-line { border-top: 2px solid var(--slate-900); padding-top: 8px; font-weight: 700; font-size: 13px; text-transform: uppercase;}
        
        .action-bar { display: flex; gap: 12px; justify-content: flex-end; padding-top: 24px; border-top: 1px dashed var(--border-color); margin-top: 32px; flex-wrap: wrap;}
        .chart-container { position: relative; height: 300px; width: 100%; padding: 16px; }
        
        /* Live Pad for Bank Instructions */
        #bank-instruction-letter { background: #FFFBEB; border: 2px solid #FDE68A; padding: 20px; border-radius: 8px; box-shadow: inset 0 2px 4px rgba(0,0,0,0.05); color: #1E293B; cursor: text; transition: all 0.2s; font-family: 'Inter', sans-serif; }
        #bank-instruction-letter:focus { outline: none; border-color: #F59E0B; background: #FFF; }

        /* --- KPI RIBBON --- */
        .kpi-ribbon { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; margin-bottom: 24px; }
        .kpi-card { color: white; border: none; border-radius: 16px; padding: 20px; box-shadow: 0 10px 24px -14px rgba(15,23,42,0.55); position: relative; overflow: hidden; }
        .kpi-card::after { content: ''; position: absolute; right: -40px; top: -40px; width: 130px; height: 130px; border-radius: 50%; background: rgba(255,255,255,0.10); }
        .kpi-card h3 { font-size: 10px; letter-spacing: 1.4px; text-transform: uppercase; font-weight: 700; color: rgba(255,255,255,0.82); margin: 0 0 10px; }
        .kpi-card .amount { font-family: 'Space Mono', monospace; font-size: 23px; font-weight: 900; color: white; line-height: 1.15; word-break: break-word; }
        .kpi-card .kpi-sub { margin-top: 8px; font-size: 11px; font-weight: 600; color: rgba(255,255,255,0.80); }

        /* --- BACK / HOME NAVIGATION --- */
        .view-header-left { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; min-width: 0; }
        .nav-back-btn { padding: 8px 14px; font-size: 12px; border-radius: 10px; white-space: nowrap; }

        /* --- PAYSLIPS (two tear-off copies per sheet) --- */
        .payslip-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 10px; font-size: 12px; font-weight: 700; color: var(--text-muted); flex-wrap: wrap; }
        .payslip-sheet { background: white; border-radius: 14px; padding: 8px; box-shadow: 0 12px 30px -20px rgba(15,23,42,0.5); }
        .payslip-copy { position: relative; padding: 28px 34px !important; margin: 0 !important; box-shadow: none !important; border: 1.5px solid var(--slate-800); border-radius: 10px; }
        .payslip-copy-tag { position: absolute; top: 14px; right: 18px; font-size: 9px; letter-spacing: 2px; text-transform: uppercase; font-weight: 800; color: var(--text-muted); border: 1px solid var(--border-color); border-radius: 999px; padding: 3px 10px; }
        .payslip-head { margin-bottom: 18px; padding-bottom: 12px; }
        .payslip-meta { display: flex; justify-content: space-between; gap: 20px; margin-bottom: 16px; flex-wrap: wrap; }
        .payslip-meta .psl-k { display: block; font-size: 9px; letter-spacing: 1.5px; text-transform: uppercase; color: var(--text-muted); font-weight: 700; }
        .payslip-meta .psl-name { display: block; font-size: 16px; font-weight: 800; text-transform: uppercase; color: var(--munno-blue); letter-spacing: 0.5px; }
        .payslip-meta .psl-v { display: block; font-size: 14px; font-weight: 800; }
        .payslip-meta .psl-role { display: block; font-size: 11px; color: var(--text-muted); font-weight: 600; }
        .payslip-table th { background: var(--slate-100); font-size: 10px; letter-spacing: 1.5px; text-transform: uppercase; }
        .payslip-net { background: var(--slate-900); color: white; padding: 14px 18px; border-radius: 8px; display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 14px; }
        .payslip-net span:first-child { font-weight: 800; text-transform: uppercase; font-size: 11px; letter-spacing: 1.5px; }
        .payslip-net span:last-child { font-size: 19px; font-weight: 900; }
        .payslip-foot { margin-top: 14px; font-size: 10px; color: var(--text-muted); text-align: center; }
        .payslip-sign { display: flex; gap: 40px; margin: 26px 0 10px; }
        .psl-sigline { flex: 1; border-top: 1px solid var(--slate-800); padding-top: 5px; font-size: 9px; letter-spacing: 1.2px; text-transform: uppercase; font-weight: 700; color: var(--text-muted); }
        .payslip-cut-line { display: block; border-top: 2px dashed #94A3B8; position: relative; margin: 22px 0; }
        .payslip-cut-line span { position: absolute; top: -9px; left: 50%; transform: translateX(-50%); background: white; padding: 0 12px; color: #94A3B8; font-size: 10px; font-weight: 700; letter-spacing: 1px; white-space: nowrap; }
        .payslip-security-hash { font-family: monospace; font-size: 8.5px; color: var(--text-muted); text-align: center; margin-top: 8px; letter-spacing: 1.2px; }


        /* Mobile Native App Bottom Nav */
        .mobile-bottom-nav { display: none; position: fixed; bottom: 0; left: 0; right: 0; background: white; border-top: 1px solid var(--border-color); z-index: 9999; justify-content: space-around; padding: 10px 0; padding-bottom: env(safe-area-inset-bottom, 10px); box-shadow: 0 -2px 10px rgba(0,0,0,0.05); }
        .mobile-nav-btn { display: flex; flex-direction: column; align-items: center; justify-content: center; background: none; border: none; color: var(--text-muted); font-size: 10px; font-weight: 700; gap: 4px; padding: 8px; width: 20%; cursor: pointer;}
        .mobile-nav-btn.active { color: var(--munno-blue); }
        .mobile-nav-btn svg { width: 22px; height: 22px; fill: currentColor; }

        @media (max-width: 992px) {
            .split-grid { grid-template-columns: 1fr; }
            .header-account-card { flex-direction: column; gap: 12px; text-align: left; }
            .view-header { flex-direction: column; align-items: flex-start; gap: 16px; }
        }
        @media (max-width: 768px) {
            header.top-nav { padding: 16px; position: relative; box-shadow: none; border-bottom: none; background: transparent; height: auto; align-items: flex-start; flex-direction: column;}
            .nav-brand-wrapper { margin-bottom: 0; width: 100%; justify-content: space-between; }
            .nav-links-wrapper { display: none !important; } /* Hide top links, use bottom nav */
            .mobile-bottom-nav { display: flex; }
            
            main { margin-top: 0; padding: 16px; width: 100%; padding-bottom: 90px;} /* Room for bottom nav */
            .view-header { margin-top: 10px; flex-direction: column; align-items: flex-start; gap: 16px; }
            
            /* Native app card styling */
            .card { border-radius: 20px; box-shadow: 0 4px 15px rgba(0,0,0,0.03); border: none; padding: 20px;}
            .form-row { grid-template-columns: 1fr; }
            .form-control { border-radius: 12px; padding: 14px; background: var(--slate-50); border: 1px solid transparent; }
            .form-control:focus { background: white; border-color: var(--munno-blue); }
            .btn { border-radius: 12px; padding: 14px; font-size: 14px; }
            
            .auth-box { padding: 32px 24px; max-width: 90%; margin: 20px auto; border-radius: 24px;}
            .formal-doc-wrapper { padding: 24px 16px; margin: 10px auto; max-width: 100%; }
            .signature-grid { grid-template-columns: 1fr; gap: 24px; }
            #inbox-modal { right: 16px; left: 16px; width: auto; top: 120px;}
            .pocket-grid { grid-template-columns: 1fr 1fr; gap: 12px;}
            .modal-box { max-width: 90%; padding: 24px; margin: 16px; border-radius: 24px;}

            /* Premium mobile refinements */
            .view-header { display: grid; grid-template-columns: minmax(0,1fr); gap: 12px; width: 100%; }
            .view-header h1 { font-size: 20px; line-height: 1.25; margin: 0; }
            .view-header p { font-size: 12px; margin: 2px 0 0; }
            .view-header-left { width: 100%; }
            .header-account-card { width: 100%; border-radius: 16px; padding: 16px; }
            .kpi-ribbon { grid-template-columns: 1fr 1fr; gap: 12px; }
            .kpi-card { padding: 16px; border-radius: 18px; }
            .kpi-card .amount { font-size: 17px; }
            .kpi-card .kpi-sub { font-size: 10px; }
            .card-header { flex-direction: column; align-items: flex-start; gap: 4px; font-size: 13px; }
            .table-responsive { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 0 -4px; }
            .formal-table { min-width: 560px; }
            .formal-table td, .formal-table th { font-size: 11.5px; padding: 8px 10px; }
            .btn-sm { padding: 9px 12px; font-size: 11px; border-radius: 10px; }
            .payslip-sheet { padding: 0; box-shadow: none; }
            .payslip-copy { padding: 18px 14px !important; }
            .payslip-meta { gap: 12px; }
            .payslip-meta .text-right { text-align: left; }
            .payslip-sign { flex-direction: column; gap: 22px; }
            .document-logo-output { max-width: 180px !important; max-height: 84px !important; }
            .chart-container { height: 240px; padding: 0; }
        }
        @media (max-width: 480px) {
            .pocket-grid { grid-template-columns: 1fr; }
            .kpi-ribbon { grid-template-columns: 1fr; }
            .kpi-card .amount { font-size: 20px; }
            .doc-footer { margin: 0 16px; font-size: 9px; }
            .nav-back-btn { flex: 1; text-align: center; }
        }


        /* --- PRINT OVERRIDES --- */
        @media print {
            @page { margin: 1cm; size: A4 portrait; }
            body { background: white; margin:0; padding:0; -webkit-print-color-adjust: exact; color-adjust: exact; overflow: visible;}
            header.top-nav, .mobile-bottom-nav, .view-header, .no-print, nav, #inbox-modal, .card-header, .form-group:not(.print-include) { display: none !important; }
            main { margin: 0; padding: 0; max-width: 100%; overflow: visible;}
            .card { border: none; box-shadow: none; padding: 0; margin:0; }
            .formal-doc-wrapper { border: none; box-shadow: none; padding: 0; margin: 0; max-width: 100%; padding-bottom: 60px;}
            
            .formal-table th { background-color: white !important; color: black !important; border-bottom: 2px solid black !important; }
            .formal-table td { border-color: #CBD5E1 !important; color: black !important; }
            .formal-table tfoot tr, .formal-table tfoot td { background-color: white !important; color: black !important; border-top: 2px solid black !important; font-weight: bold; }
            
            .modern-doc-pill { background-color: transparent !important; color: black !important; border: 1px solid black !important; }
            .doc-section-title { background: transparent !important; border-left-color: black !important; color: black !important; }
            .pill.sum-pill { background: transparent !important; color: black !important; border: 1px solid black !important; }
            .print-ink-saver { background: white !important; color: black !important; border: 2px solid black !important; box-shadow: none !important; }
            #bank-instruction-letter { border: none !important; background: transparent !important; padding: 0 !important; box-shadow: none !important; }
            
            /* The Cool Bank Font for Payslip figures */
            .bank-font, body.print-payslips .formal-table td.font-mono, body.print-payslips .sum-pill { font-family: 'Space Mono', monospace !important; font-weight: 700; letter-spacing: 1px;}

            tr[style*="background: var(--slate-800)"],
            tr[style*="background: var(--slate-100)"],
            tr[style*="background: var(--slate-50)"],
            tr[style*="background: var(--munno-light)"],
            tr[style*="background: var(--munno-blue)"] { background-color: white !important; color: black !important; border-top: 1px solid black !important; border-bottom: 1px solid black !important;}
            td[style*="color: white"], th[style*="color: white"], td[style*="color: var(--purple)"] { color: black !important; }
            
            body.print-memo .formal-doc-wrapper { padding: 10px !important; padding-bottom: 40px !important;}
            body.print-memo .doc-footer { bottom: 10px; margin: 0 10px; }
            body.print-memo .formal-table { margin-bottom: 12px; }
            body.print-memo .formal-table td, body.print-memo .formal-table th { padding: 5px 8px; font-size: 11px;}
            body.print-memo .doc-section-title { padding: 4px 12px; margin-bottom: 8px; font-size: 11px;}
            body.print-memo .signature-grid { margin-top: 20px; gap: 24px; }
            body.print-memo .sig-box .title { margin-bottom: 24px; }
            
            body.print-bank-letter .doc-footer { display: none !important; }
            
            /* One sheet per employee: two identical copies, tear line between them. */
            .payslip-page-wrapper { page-break-after: always; break-after: page; }
            .payslip-sheet { display: flex; flex-direction: column; justify-content: space-between; height: 100%; padding: 0; box-shadow: none; gap: 0; }
            .payslip-copy { border: 1px solid #94A3B8 !important; border-radius: 6px; padding: 18px 22px !important; page-break-inside: avoid; break-inside: avoid; }
            .payslip-copy-tag { border-color: #94A3B8 !important; color: #475569 !important; }
            .payslip-net { background: white !important; color: black !important; border: 2px solid black !important; }
            .payslip-cut-line { display: block; border-top: 2px dashed #94A3B8; position: relative; margin: 14px 0; }
            .payslip-cut-line span { background: white; color: #64748B; font-size: 9px; }
            .payslip-toolbar { display: none !important; }

            body.print-payslip-one .payslip-page-wrapper:not(.payslip-solo) { display: none !important; }
            body.print-audit .view-panel:not(#panel-audit-trail) { display: none !important; }
            body.print-audit #panel-audit-trail { display: block !important; }
            body.print-audit .no-print { display: none !important; }
            body.print-audit .formal-table td, body.print-audit .formal-table th { font-size: 10px; padding: 4px 6px; }
            body.print-payslips .view-panel:not(#panel-payroll):not(#panel-payslip-archive) { display: none !important; }
            body.print-payslips #panel-payroll, body.print-payslips #panel-payslip-archive { display: block !important; }
            body.print-payslips #panel-payslip-archive .card { display: none !important; }
            body.print-payslips #payroll-bank-target { display: none !important; }
            body.print-payslips #payroll-payslips-target { display: block !important; }


            body.print-bank-letter .view-panel:not(#panel-payroll) { display: none !important; }
            body.print-bank-letter #panel-payroll { display: block !important; }
            body.print-bank-letter #payroll-payslips-target { display: none !important; }
            body.print-bank-letter #payroll-bank-target { display: block !important; }

            body.print-budget .view-panel:not(#panel-ops-budget) { display: none !important; }
            body.print-budget #panel-ops-budget { display: block !important; }
            body.print-req .view-panel:not(#panel-requisition) { display: none !important; }
            body.print-req #panel-requisition { display: block !important; }
            body.print-acc .view-panel:not(#panel-accountability) { display: none !important; }
            body.print-acc #panel-accountability { display: block !important; }
            body.print-statement .view-panel:not(#panel-statements) { display: none !important; }
            body.print-statement #panel-statements { display: block !important; }
            body.print-pl .view-panel:not(#panel-ops-pl) { display: none !important; }
            body.print-pl #panel-ops-pl { display: block !important; }
            body.print-budget-summary .view-panel:not(#panel-budget-summary) { display: none !important; }
            body.print-budget-summary #panel-budget-summary { display: block !important; }
            body.print-shareholder .view-panel:not(#panel-shareholders) { display: none !important; }
            body.print-shareholder #panel-shareholders { display: block !important; }
            body.print-arch-memo .view-panel:not(#panel-ops-archive) { display: none !important; }
            body.print-arch-memo #panel-ops-archive { display: block !important; }
        }
/* ===== Document Archive ===== */
.arch-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.arch-chip {
  border: 1px solid var(--border, #e2e8f0); background: #fff; color: var(--text-muted, #64748b);
  padding: 7px 14px; border-radius: 999px; font-size: 12px; font-weight: 700; cursor: pointer;
  display: inline-flex; align-items: center; gap: 7px; transition: all .15s ease; letter-spacing: .2px;
}
.arch-chip:hover { border-color: var(--munno-blue, #0284C7); color: var(--munno-blue, #0284C7); }
.arch-chip.active { background: var(--munno-blue, #0284C7); border-color: var(--munno-blue, #0284C7); color: #fff; box-shadow: 0 4px 10px rgba(2,132,199,.25); }
.arch-chip-count { background: rgba(15,23,42,.08); border-radius: 999px; padding: 1px 7px; font-size: 10px; }
.arch-chip.active .arch-chip-count { background: rgba(255,255,255,.25); }
.arch-result-summary {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px;
  font-size: 12px; color: var(--text-muted, #64748b); margin-bottom: 12px;
  border-top: 1px solid var(--border, #e2e8f0); padding-top: 12px;
}
.arch-mark { background: #FEF08A; color: inherit; padding: 0 2px; border-radius: 3px; }
.arch-status {
  display: inline-block; padding: 3px 9px; border-radius: 999px; font-size: 10px;
  font-weight: 800; text-transform: uppercase; letter-spacing: .4px; background: #F1F5F9; color: #475569;
}
.arch-status-approved, .arch-status-posted, .arch-status-audited { background: #DCFCE7; color: #15803D; }
.arch-status-rejected { background: #FEE2E2; color: #B91C1C; }
.arch-status-pendingapproval, .arch-status-pendingaudit, .arch-status-accountedpendingaudit { background: #FEF3C7; color: #B45309; }
.arch-retrieved-note { font-size: 11px; color: var(--text-muted, #64748b); margin-top: 8px; letter-spacing: .3px; }

@media (max-width: 768px) {
  .arch-table thead { display: none; }
  .arch-table, .arch-table tbody, .arch-table tr, .arch-table td { display: block; width: 100%; }
  .arch-table tr {
    border: 1px solid var(--border, #e2e8f0); border-radius: 14px; padding: 12px 14px;
    margin-bottom: 12px; background: #fff; box-shadow: 0 2px 8px rgba(15,23,42,.05);
  }
  .arch-table td { border: none !important; padding: 3px 0; text-align: left !important; }
  .arch-table td:last-child { padding-top: 10px; }
  .arch-chip { flex: 1 1 auto; justify-content: center; }
}

/* ================= ENTERPRISE LAYER ================= */
/* Global search */
.global-search-btn { padding: 8px 12px; display:inline-flex; align-items:center; gap:8px; }
.gs-kbd { font-size: 10px; border:1px solid var(--border-color); border-radius:4px; padding:1px 5px; color: var(--text-muted); }
#global-search-overlay { display:none; position:fixed; inset:0; background: rgba(15,23,42,.55); backdrop-filter: blur(3px); z-index: 4000; align-items:flex-start; justify-content:center; padding: 8vh 16px; }
.gs-panel { width: min(760px, 100%); background: #fff; border-radius: 16px; box-shadow: 0 24px 70px rgba(15,23,42,.35); overflow:hidden; display:flex; flex-direction:column; max-height: 76vh; }
.gs-bar { display:flex; gap:10px; padding:16px; border-bottom:1px solid var(--border-color); }
.gs-results { overflow-y:auto; padding: 8px 0 16px; }
.gs-hint { padding: 24px; text-align:center; color: var(--text-muted); font-size: 13px; }
.gs-group-label { font-size:10px; font-weight:800; letter-spacing:.1em; text-transform:uppercase; color:var(--text-muted); padding: 12px 18px 6px; }
.gs-row { display:flex; justify-content:space-between; align-items:center; gap:12px; padding:10px 18px; border-bottom:1px solid var(--slate-50); }
.gs-row:hover { background: var(--slate-50); }
.gs-title { font-size:13px; font-weight:700; }
.gs-sub { font-size:11px; color: var(--text-muted); }
.gs-row-right { display:flex; align-items:center; gap:10px; font-size:12px; white-space:nowrap; }

/* Timeline modal */
.modal-backdrop { position:fixed; inset:0; background: rgba(15,23,42,.55); z-index: 4000; display:flex; align-items:center; justify-content:center; padding:16px; }
.modal-card { background:#fff; width:min(560px,100%); border-radius:14px; box-shadow:0 24px 60px rgba(15,23,42,.35); max-height:80vh; display:flex; flex-direction:column; }
.modal-head { display:flex; justify-content:space-between; gap:12px; align-items:flex-start; padding:18px; border-bottom:1px solid var(--border-color); font-weight:700; font-size:13px; }
.tl-sub { font-weight:500; font-size:11px; color:var(--text-muted); }
.tl-body { padding:18px 22px; overflow-y:auto; }
.tl-item { position:relative; padding: 0 0 20px 22px; border-left:2px solid var(--border-color); }
.tl-item:last-child { border-left-color: transparent; }
.tl-dot { position:absolute; left:-7px; top:2px; width:12px; height:12px; border-radius:50%; background: var(--munno-blue); box-shadow:0 0 0 3px #fff; }
.tl-action { font-size:12px; font-weight:800; letter-spacing:.04em; text-transform:uppercase; }
.tl-meta { font-size:11px; color:var(--text-muted); }
.tl-detail { font-size:12px; margin-top:3px; }

/* Month-end close */
.mc-fac { margin-bottom: 24px; }
.mc-fac-name { font-size:13px; font-weight:800; margin-bottom:10px; }
.mc-grid { display:grid; grid-template-columns: repeat(auto-fill, minmax(220px,1fr)); gap:12px; }
.mc-cell { border:1px solid var(--border-color); border-radius:12px; padding:14px; background:#fff; }
.mc-cell.closed { background: var(--slate-50); border-color: var(--slate-800); }
.mc-month { font-weight:800; font-size:13px; margin-bottom:6px; }
.mc-nums { display:flex; justify-content:space-between; font-size:11px; color:var(--text-muted); }
.mc-net { font-size:12px; font-weight:700; margin: 6px 0; }
.mc-net.neg { color: var(--danger); }
.mc-state { font-size:11px; color:var(--text-muted); margin-bottom:10px; }

/* Connection banner */
.connection-banner { position:fixed; bottom:16px; left:16px; right:16px; z-index:3500; display:flex; align-items:center; gap:10px; padding:12px 16px; border-radius:12px; font-size:12px; font-weight:600; box-shadow: 0 12px 32px rgba(15,23,42,.18); }
.connection-banner.offline { background:#FEF3C7; color:#92400E; border:1px solid #FCD34D; }
.connection-banner.syncing { background:#DBEAFE; color:#1E3A8A; border:1px solid #93C5FD; }
.cb-dot { width:9px; height:9px; border-radius:50%; background: currentColor; animation: cbPulse 1.4s infinite; }
@keyframes cbPulse { 0%,100% { opacity:1; } 50% { opacity:.25; } }

/* Role / period locking */
.lock-banner { display:flex; align-items:center; gap:10px; background:#F1F5F9; border:1px solid var(--border-color); border-left:4px solid var(--slate-800); border-radius:10px; padding:12px 16px; font-size:12px; font-weight:600; margin-bottom:16px; }
.lock-ico { font-size:14px; }

/* Payslip acknowledgement */
.payslip-ack { margin-top:12px; border:1px dashed var(--border-color); border-radius:8px; padding:10px 12px; }
.psl-ack-text { font-size:10.5px; line-height:1.5; margin-bottom:14px; }
.psl-ack-lines { display:grid; grid-template-columns:1fr 1fr; gap:24px; }

@media (max-width: 768px) {
  .global-search-btn .gs-kbd { display:none; }
  .gs-panel { max-height: 86vh; }
  .mc-grid { grid-template-columns: 1fr; }
  .connection-banner { bottom: 76px; }
}

/* ================= MOBILE FULL MENU ================= */
.mobile-menu-sheet { position: fixed; inset: 0; background: rgba(15,23,42,.55); backdrop-filter: blur(3px); z-index: 9998; display: none; align-items: flex-end; }
.mobile-menu-sheet .mm-panel { background:#fff; width:100%; max-height:82vh; border-radius: 24px 24px 0 0; display:flex; flex-direction:column; box-shadow: 0 -12px 40px rgba(15,23,42,.28); }
.mm-head { display:flex; justify-content:space-between; align-items:center; padding:18px 20px; border-bottom:1px solid var(--border-color); font-weight:800; font-size:14px; }
.mm-body { overflow-y:auto; padding: 8px 12px 96px; -webkit-overflow-scrolling: touch; }
.mm-group-label { font-size:10px; font-weight:800; letter-spacing:.1em; text-transform:uppercase; color:var(--text-muted); padding: 16px 8px 6px; }
.mm-item { display:block; width:100%; text-align:left; background:var(--slate-50); border:1px solid transparent; border-radius:14px; padding:14px 16px; margin-bottom:8px; font-size:14px; font-weight:600; color:var(--slate-900); cursor:pointer; }
.mm-item:active { background:#E2E8F0; }

/* ================= COMPARATIVE ANALYSIS ================= */
.comp-kpi-grid { display:grid; grid-template-columns: repeat(auto-fit, minmax(200px,1fr)); gap:14px; margin-bottom:20px; }
.comp-kpi { border:1px solid var(--border-color); border-radius:16px; padding:16px; background:#fff; }
.comp-kpi h4 { font-size:10px; letter-spacing:.09em; text-transform:uppercase; color:var(--text-muted); margin:0 0 8px; font-weight:800; }
.comp-kpi .v { font-size:20px; font-weight:800; font-variant-numeric: tabular-nums; }
.comp-kpi .s { font-size:11px; color:var(--text-muted); margin-top:4px; }
.comp-kpi .v.neg { color: var(--danger); }
.comp-kpi .v.pos { color: #15803D; }
.comp-delta-up { color:#15803D; font-weight:700; }
.comp-delta-down { color: var(--danger); font-weight:700; }
.spark-cell { white-space:nowrap; font-size:11px; letter-spacing:1px; }
@media (max-width: 768px) {
  .comp-kpi-grid { grid-template-columns: 1fr 1fr; gap:10px; }
  .comp-kpi { padding:14px; border-radius:14px; }
  .comp-kpi .v { font-size:16px; }
  .mobile-bottom-nav .mobile-nav-btn { width: auto; flex: 1 1 0; }
  .nav-folder, .folder-dropdown-content { max-width: 100%; }
  .kpi-ribbon { grid-template-columns: 1fr 1fr; }
  .modal-box, .modal-card, .gs-panel { max-height: 84vh; overflow-y: auto; }
  .form-row > div, .form-group { min-width: 0; }
  select.form-control, input.form-control { font-size: 16px; } /* stops iOS zoom */
  .card { overflow-x: hidden; }
  .doc-section-title { font-size: 12px; }
}
