        :root { --primary: #0033A0; --secondary: #C8102E; --belt-yellow: #f1c40f; --belt-green: #2ecc71; --belt-blue: #3498db; --belt-red: #e74c3c; --belt-black: #1e293b; }
        body { font-family: 'Inter', -apple-system, sans-serif; background: #f1f5f9; margin: 0; color: #334155; padding-bottom: calc(40px + env(safe-area-inset-bottom)); -webkit-tap-highlight-color: transparent;}
        
        #loginOverlay { position: fixed; inset: 0; background: radial-gradient(circle at top right, var(--primary), #001540); display: flex; justify-content: center; align-items: center; z-index: 9999; }
        @media (max-width: 639px) {
            #loginOverlay {
                align-items: flex-start;
                overflow-y: auto;
                padding-top: max(env(safe-area-inset-top, 0px), 20px);
                padding-bottom: 20px;
            }
            #loginOverlay .login-card:not(.pp-wide) {
                margin: auto;
                width: 92%;
            }
            #loginPane_admin {
                padding: 18px 20px 22px !important;
            }
            #loginPane_admin h2 {
                font-size: 0.9rem !important;
                margin-bottom: 14px !important;
                line-height: 1.35 !important;
            }
            .login-tabs button {
                font-size: 0.82rem !important;
                padding-top: 10px !important;
                padding-bottom: 10px !important;
            }
        }
        .app-container { display: none; }
        
        .tabs-wrapper { position: sticky; top: 0; z-index: 50; background: rgba(255, 255, 255, 0.95); backdrop-filter: blur(12px); padding-top: 12px; margin-bottom: 20px; border-bottom: 1px solid #e2e8f0; margin-left: -1rem; margin-right: -1rem; padding-left: 1rem; padding-right: 1rem; }
        @media (min-width: 768px) { .tabs-wrapper { margin-left: 0; margin-right: 0; padding-left: 0; padding-right: 0; border-radius: 0 0 12px 12px; } }
        
        .tabs-nav { display: flex; gap: 6px; overflow-x: auto; scroll-behavior: smooth; -webkit-overflow-scrolling: touch; padding-bottom: 12px; scrollbar-width: none; }
        .tabs-nav::-webkit-scrollbar { display: none; }
        .tab-btn { padding: 8px 16px; font-weight: 600; color: #64748b; border-radius: 9999px; cursor: pointer; transition: all 0.2s ease; white-space: nowrap; border: 1px solid #f1f5f9; font-size: 0.9rem; background: #f8fafc; }
        .tab-btn:hover { color: var(--primary); background: #e2e8f0; border-color: #cbd5e1; }
        .tab-btn.active { color: white; background: var(--primary); font-weight: 700; border-color: var(--primary); box-shadow: 0 4px 12px rgba(0, 51, 160, 0.2); }
        .tab-content { display: none; animation: fadeIn 0.3s ease; }
        .tab-content.active { display: block; }
        
        @keyframes fadeIn { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }
        @keyframes slideUpSheet { from { transform: translateY(100%); } to { transform: translateY(0); } }

        input, select, textarea { border: 1.5px solid #cbd5e1; padding: 10px 14px; border-radius: 10px; width: 100%; outline: none; transition: all 0.2s; background: #fff; font-size: 16px !important; color: #1e293b; }
        input:focus, select:focus, textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(0,51,160,0.15); }
        input:disabled, select:disabled { background: #f1f5f9; color: #94a3b8; cursor: not-allowed; border-color: #e2e8f0; }
        
        .table-wrapper { overflow-x: auto; overflow-y: auto; max-height: 70vh; -webkit-overflow-scrolling: touch; border-radius: 12px; width: 100%; }
        .table-wrapper::-webkit-scrollbar { height: 8px; width: 8px; }
        .table-wrapper::-webkit-scrollbar-thumb { background-color: #cbd5e1; border-radius: 10px; border: 2px solid #fff; }
        table { width: 100%; border-collapse: separate; border-spacing: 0; min-width: max-content; }
        th { background: #f8fafc; color: #475569; font-size: 0.72rem; padding: 9px 10px; text-align: left; border-bottom: 2px solid #e2e8f0; text-transform: uppercase; white-space: nowrap; font-weight: 800; position: sticky; top: 0; z-index: 10; }
        td { padding: 8px 10px; border-bottom: 1px solid #f1f5f9; font-size: 0.85rem; vertical-align: middle; color: #334155; white-space: nowrap; }
        tr:hover td { background: #f8fafc; }
        
        .name-link { color: var(--primary); font-weight: 700; cursor: pointer; transition: 0.2s; }
        .name-link:hover { text-decoration: underline; color: #001540; }
        .badge { padding: 4px 10px; border-radius: 6px; font-size: 0.75rem; font-weight: 700; display: inline-block; white-space: nowrap; }
        .badge-active { background: #dcfce7; color: #166534; border: 1px solid #bbf7d0; }
        .badge-quit { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }
        
        .modal { display: none; position: fixed; inset: 0; background: rgba(15, 23, 42, 0.7); z-index: 10000; padding: 0; backdrop-filter: blur(5px); align-items: flex-end; justify-content: center; }
        .modal-content { background: white; width: 100%; max-width: 650px; border-radius: 20px 20px 0 0; padding: 20px; box-shadow: 0 -10px 40px rgba(0,0,0,0.2); max-height: 85vh; overflow-y: auto; position: relative; animation: slideUpSheet 0.3s cubic-bezier(0.16, 1, 0.3, 1); padding-bottom: calc(20px + env(safe-area-inset-bottom)); }
        @media (min-width: 768px) { .modal { padding: 20px; align-items: center; } .modal-content { border-radius: 20px; animation: fadeIn 0.2s; padding-bottom: 20px; } }
        
        .autocomplete-items { position: absolute; border: 1px solid #e2e8f0; z-index: 99; top: 100%; left: 0; right: 0; background: #fff; max-height: 250px; overflow-y: auto; display: none; box-shadow: 0 10px 20px -5px rgba(0,0,0,0.1); border-radius: 0 0 10px 10px; border-top: none; }
        .autocomplete-items div { padding: 12px 14px; cursor: pointer; border-bottom: 1px solid #f1f5f9; font-size: 0.95rem; display: flex; justify-content: space-between; align-items: center; }
        .autocomplete-items div:hover { background-color: #f0f4ff; }
        
        .toast { visibility: hidden; min-width: 250px; background-color: #10b981; color: #fff; text-align: center; border-radius: 10px; padding: 14px 20px; position: fixed; z-index: 10001; right: 20px; bottom: calc(20px + env(safe-area-inset-bottom)); transform: translateY(100px); transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1); font-size: 0.95rem; font-weight: bold; box-shadow: 0 10px 20px rgba(0,0,0,0.15); }
        .toast.show { visibility: visible; transform: translateY(0); }
        .toast.loading { background-color: #f59e0b; }
        /* ── Nhắc nhở cuối tháng ── */
        #monthlyReminder { display:none; align-items:center; justify-content:space-between; gap:12px; background:linear-gradient(135deg,#fffbeb,#fef3c7); border:1.5px solid #f59e0b; border-radius:14px; padding:13px 16px; margin-bottom:14px; box-shadow:0 2px 12px rgba(245,158,11,0.18); flex-wrap:wrap; }
        #monthlyReminder .mr-left { display:flex; align-items:center; gap:11px; min-width:0; flex:1; }
        #monthlyReminder .mr-icon { font-size:1.7rem; flex-shrink:0; }
        #monthlyReminder .mr-title { font-size:0.85rem; font-weight:800; color:#92400e; line-height:1.3; }
        #monthlyReminder .mr-sub { font-size:0.72rem; color:#b45309; font-weight:600; margin-top:2px; }
        #monthlyReminder .mr-actions { display:flex; gap:8px; flex-shrink:0; flex-wrap:wrap; }
        #monthlyReminder .mr-btn-main { background:linear-gradient(135deg,#f59e0b,#d97706); color:#fff; font-size:0.8rem; font-weight:800; border:none; border-radius:10px; padding:9px 16px; cursor:pointer; white-space:nowrap; box-shadow:0 3px 10px rgba(245,158,11,0.4); transition:opacity 0.2s; }
        #monthlyReminder .mr-btn-main:hover { opacity:0.88; }
        #monthlyReminder .mr-btn-skip { background:#fff; color:#92400e; font-size:0.78rem; font-weight:700; border:1.5px solid #fcd34d; border-radius:10px; padding:9px 13px; cursor:pointer; white-space:nowrap; transition:background 0.2s; }
        #monthlyReminder .mr-btn-skip:hover { background:#fef9c3; }
        
        #receiptTemplate { position: absolute; left: -9999px; visibility: hidden; width: 400px; background: white; padding: 30px; border-radius: 16px; border: 2px solid #0033A0; box-sizing: border-box; font-family: 'Inter', sans-serif;}
        .action-btns { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
        .btn-sm { padding: 6px 10px; font-size: 0.75rem; font-weight: 700; border-radius: 6px; display: inline-flex; align-items: center; justify-content: center; transition: all 0.2s; border: 1px solid transparent; cursor: pointer; }

        @media (max-width: 767px) {
            body { padding-bottom: 60px; }
            .app-container { padding: 10px 14px; border-radius: 0; box-shadow: none; border: none; }
            .tab-btn { padding: 7px 13px; font-size: 0.82rem; }
            th { padding: 9px 7px; font-size: 0.68rem; }
            td { padding: 9px 7px; font-size: 0.84rem; }
            .modal-content { padding: 20px 14px; }
            .stat-card { padding: 14px; border-radius: 16px; }
            .stat-card h3 { font-size: 0.65rem; }
            .stat-card p { font-size: 1.15rem; }
            #receiptModal .modal-content { padding: 20px 14px !important; }
            .desktop-action-btns { display: none !important; }
            .mobile-menu-btn { display: flex !important; }
        }
        @media (min-width: 768px) {
            .mobile-menu-btn { display: none !important; }
            .desktop-action-btns { display: flex !important; }
        }
        .mobile-menu-btn { display: none; align-items: center; justify-content: center; }
        
        #mobileMenuSheet { display: none; position: fixed; inset: 0; background: rgba(15,23,42,0.55); z-index: 9997; align-items: flex-end; justify-content: center; backdrop-filter: blur(4px); }
        #mobileMenuSheet.open { display: flex; }
        #mobileMenuSheetContent { background: #fff; width: 100%; max-width: 520px; border-radius: 22px 22px 0 0; padding: 8px 16px 0; padding-bottom: calc(16px + env(safe-area-inset-bottom)); animation: slideUpSheet 0.3s cubic-bezier(0.16, 1, 0.3, 1); }
        .mms-handle { width: 40px; height: 5px; background: #e2e8f0; border-radius: 99px; margin: 8px auto 14px; }
        .mms-btn { display: flex; align-items: center; gap: 12px; width: 100%; padding: 13px 14px; border-radius: 12px; font-weight: 700; font-size: 0.92rem; cursor: pointer; border: none; transition: background 0.15s; margin-bottom: 8px; text-align: left; }
        .mms-divider { height: 1px; background: #f1f5f9; margin: 4px 0 10px; }
        
        .loading-spinner { border: 3px solid rgba(255, 255, 255, 0.3); border-top: 3px solid #fff; border-radius: 50%; width: 20px; height: 20px; animation: spin 1s linear infinite; display: inline-block; vertical-align: middle; }
        @keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

        /* Pull to Refresh */
        #pullToRefreshIndicator { position: fixed; top: -80px; left: 50%; transform: translateX(-50%); z-index: 9990; background: white; border-radius: 50px; padding: 10px 22px; box-shadow: 0 6px 24px rgba(0,51,160,0.13); display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 0.85rem; color: var(--primary); transition: top 0.25s cubic-bezier(0.16,1,0.3,1); border: 1.5px solid #dbeafe; pointer-events: none; white-space: nowrap; }
        #pullToRefreshIndicator.ptr-visible { top: 14px; }
        .ptr-spinner { width: 18px; height: 18px; border: 2.5px solid #dbeafe; border-top-color: var(--primary); border-radius: 50%; flex-shrink: 0; }
        .ptr-spinner.ptr-spin { animation: spin 0.7s linear infinite; }
        .ptr-arrow { font-size: 1.1rem; transition: transform 0.3s ease; display: inline-block; flex-shrink: 0; }
        .ptr-arrow.ptr-ready { transform: rotate(180deg); }

        /* ══════════════════════════════════════════════
           MOBILE CARD REDESIGN v2 — CSS Grid Cards
           ══════════════════════════════════════════════ */

        /* ── Gradient mobile header bar ──────────────── */
        .mobile-header-bar { display: none; }
        @media (max-width: 767px) {
            .mobile-header-bar {
                display: flex; flex-direction: column;
                background: linear-gradient(135deg, #0033A0 0%, #1a56db 60%, #1e40af 100%);
                margin: -10px -14px 12px; padding: 14px 16px 12px;
                border-radius: 0 0 22px 22px;
                box-shadow: 0 4px 20px rgba(0,51,160,0.25);
            }
            .mobile-header-bar .mhb-title-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
            .mobile-header-bar .mhb-title { color: rgba(255,255,255,0.96); font-size: 1rem; font-weight: 900; text-transform: uppercase; letter-spacing: 0.03em; line-height: 1.2; max-width: calc(100% - 56px); }
            .mobile-header-bar .mhb-subtitle { color: rgba(255,255,255,0.65); font-size: 0.62rem; font-weight: 600; margin-top: 2px; }
            .mobile-header-bar .mhb-menu-btn { width: 42px; height: 42px; background: rgba(255,255,255,0.15); border: 1.5px solid rgba(255,255,255,0.25); border-radius: 12px; color: #fff; font-size: 1.2rem; display: flex; align-items: center; justify-content: center; flex-shrink: 0; cursor: pointer; }
            .mobile-header-bar .mhb-stats { display: flex; gap: 7px; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
            .mobile-header-bar .mhb-stats::-webkit-scrollbar { display: none; }
            .mobile-header-bar .mhb-pill { display: flex; align-items: center; gap: 5px; background: rgba(255,255,255,0.14); border: 1px solid rgba(255,255,255,0.22); border-radius: 999px; padding: 5px 11px 5px 8px; white-space: nowrap; flex-shrink: 0; }
            .mobile-header-bar .mhb-pill-icon { font-size: 0.95rem; }
            .mobile-header-bar .mhb-pill-text { color: rgba(255,255,255,0.9); font-size: 0.7rem; font-weight: 700; line-height: 1; }
            .mobile-header-bar .mhb-pill-val { color: #fff; font-size: 0.8rem; font-weight: 900; }
            .mobile-header-original { display: none !important; }
        }
        @media (min-width: 768px) {
            .mobile-header-bar { display: none !important; }
            .mobile-header-original { display: flex !important; }
        }

        /* ── Base: remove scrollable table, use card flow ──── */
        @media (max-width: 767px) {
            #tab_tx .table-wrapper, #tab_debt .table-wrapper,
            #tab_active .table-wrapper, #tab_quit .table-wrapper { overflow: unset !important; max-height: none !important; }

            #tbl_tx, #tbl_debt, #tbl_active, #tbl_quit,
            #tbl_uniform_tx, #tbl_exp { min-width: unset !important; }

            /* Hide all thead */
            #tbl_tx thead tr, #tbl_debt thead tr, #tbl_active thead tr,
            #tbl_quit thead tr, #tbl_uniform_tx thead tr, #tbl_exp thead tr { display: none !important; }

            /* ── txList (Học Phí) ── 2-line card ───── */
            #tbl_tx tbody tr {
                display: grid !important;
                grid-template-columns: 1fr auto;
                grid-template-rows: auto auto;
                background: #fff; border-radius: 11px !important;
                margin: 0 0 5px !important; border: 1px solid #e8edf5 !important;
                padding: 7px 10px !important;
                box-shadow: 0 1px 3px rgba(0,0,0,0.04) !important;
                gap: 2px 6px;
            }
            #tbl_tx tbody td { display: block !important; padding: 0 !important; border: none !important; white-space: normal !important; font-size: 0.82rem; }
            #tbl_tx tbody td.col-branch { display: none !important; }
            /* date — row2 left (show kỳ tháng inline) */
            #tbl_tx tbody td:first-child { grid-column: 1; grid-row: 2; color: #94a3b8; font-size: 0.68rem !important; display: flex !important; align-items: center; gap: 4px; }
            /* month badge — inline after date (row2 left alongside date) */
            #tbl_tx tbody td:nth-last-child(5) { grid-column: 1; grid-row: 2; font-size: 0.68rem !important; padding-left: 2px; }
            /* name — row1 left */
            #tbl_tx tbody td:nth-last-child(4) { grid-column: 1; grid-row: 1; font-size: 0.92rem !important; font-weight: 800 !important; color: #0033A0; }
            /* type badge — hidden */
            #tbl_tx tbody td:nth-last-child(3) { display: none !important; }
            /* amount — row1 right */
            #tbl_tx tbody td:nth-last-child(2) { grid-column: 2; grid-row: 1; text-align: right; font-weight: 900 !important; font-size: 0.88rem !important; }
            /* actions — row2 RIGHT (same row as date) — no separate row3 */
            #tbl_tx tbody td:last-child {
                grid-column: 2; grid-row: 2;
                display: flex !important; gap: 4px; flex-wrap: nowrap;
                padding: 0 !important; margin: 0; border: none !important;
                align-items: center; justify-content: flex-end;
            }
            #tbl_tx .btn-sm { padding: 4px 7px !important; font-size: 0.7rem !important; border-radius: 7px !important; white-space: nowrap; }

            /* ── debtList (Báo Nợ) ── redesigned card ─── */
            #tbl_debt tbody tr {
                display: grid !important;
                grid-template-columns: 1fr auto;
                grid-template-rows: auto auto auto;
                background: #fff; border-radius: 11px !important;
                margin: 0 0 6px !important; border: 1px solid #e8edf5 !important;
                padding: 8px 10px 6px !important;
                box-shadow: 0 1px 3px rgba(0,0,0,0.04) !important;
                gap: 0 6px;
            }
            #tbl_debt tbody tr[style*="background:#fff1f2"] { background: #fff1f2 !important; border-color: #fecaca !important; }
            #tbl_debt tbody td { display: none !important; padding: 0 !important; border: none !important; white-space: normal !important; }
            #tbl_debt tbody td.col-branch { display: none !important; }
            /* count badge — row1 right col */
            #tbl_debt tbody td:first-child { display: flex !important; grid-column: 2; grid-row: 1; align-items: flex-start; justify-content: flex-end; padding-top: 1px !important; }
            /* months label — row2 left, small */
            #tbl_debt tbody td:nth-child(2) { display: block !important; grid-column: 1 / -1; grid-row: 2; font-size: 0.62rem !important; color: #94a3b8; padding: 1px 0 3px !important; line-height: 1.4; }
            /* name — row1 left, primary */
            #tbl_debt tbody td.name-link { display: flex !important; grid-column: 1; grid-row: 1; font-size: 0.92rem !important; font-weight: 800 !important; color: #0033A0; align-items: center; overflow: hidden; padding-right: 4px !important; }
            /* actions — row3 full width */
            #tbl_debt tbody td:last-child {
                display: flex !important; grid-column: 1 / -1; grid-row: 3;
                gap: 5px; flex-wrap: nowrap;
                padding-top: 6px !important; margin-top: 2px;
                border-top: 1px solid #f1f5f9;
            }
            #tbl_debt .btn-sm { flex: 1; min-width: 0; padding: 6px 4px !important; font-size: 0.68rem !important; border-radius: 8px !important; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 700 !important; }

            /* ── activeList ── compact card ──────────── */
            #tbl_active tbody tr {
                display: grid !important;
                grid-template-columns: 1fr auto;
                grid-template-rows: auto auto;
                background: #fff; border-radius: 11px !important;
                margin: 0 0 5px !important; border: 1px solid #e8edf5 !important;
                padding: 7px 10px !important;
                box-shadow: 0 1px 3px rgba(0,0,0,0.04) !important;
                gap: 2px 5px;
            }
            /* hide all by default, re-show needed ones */
            #tbl_active tbody td { display: none !important; padding: 0 !important; border: none !important; white-space: normal !important; }
            /* name — row1 left */
            #tbl_active tbody td:first-child { display: block !important; grid-column: 1; grid-row: 1; font-size: 0.93rem !important; font-weight: 800 !important; color: #0033A0; }
            /* belt — row1 right */
            #tbl_active tbody td:nth-child(3) { display: block !important; grid-column: 2; grid-row: 1; text-align: right; }
            /* paidBadge — row2 left */
            #tbl_active tbody td:nth-last-child(4) { display: block !important; grid-column: 1; grid-row: 2; font-size: 0.78rem; }
            /* phone — hide (show only paidBadge + edit btn on row2) */
            #tbl_active tbody td:nth-last-child(3) { display: none !important; }
            /* edit btn — row2 RIGHT (alongside paidBadge, no row3) */
            #tbl_active tbody td:last-child {
                display: flex !important; grid-column: 2; grid-row: 2;
                align-items: center; justify-content: flex-end;
                padding: 0 !important; margin: 0; border: none !important;
            }
            #tbl_active .btn-sm { padding: 4px 9px !important; font-size: 0.73rem !important; border-radius: 7px !important; white-space: nowrap; }

            /* ── quitList ── simple 2-line ─────────── */
            #tbl_quit tbody tr {
                display: grid !important;
                grid-template-columns: 1fr auto;
                grid-template-rows: auto auto;
                background: #fff; border-radius: 11px !important;
                margin: 0 0 5px !important; border: 1px solid #e8edf5 !important;
                padding: 7px 10px !important;
                box-shadow: 0 1px 3px rgba(0,0,0,0.04) !important;
                gap: 2px 5px;
            }
            #tbl_quit tbody td { display: none !important; padding: 0 !important; border: none !important; white-space: normal !important; }
            #tbl_quit tbody td:first-child { display: block !important; grid-column: 1; grid-row: 1; font-size: 0.97rem !important; font-weight: 800 !important; color: #334155; }
            #tbl_quit tbody td:nth-child(3) { display: block !important; grid-column: 2; grid-row: 1; text-align: right; }
            #tbl_quit tbody td:last-child { display: block !important; grid-column: 1 / -1; grid-row: 2; padding-top: 7px !important; margin-top: 3px; border-top: 1px solid #f1f5f9; }

            /* ── uniformTxList ── clean 3-row card ──── */
            #tbl_uniform_tx { min-width: unset !important; }
            #tbl_uniform_tx tbody tr {
                display: grid !important; background: #fff;
                border-radius: 12px !important; margin: 0 0 7px !important;
                border: 1px solid #e2e8f0 !important; padding: 9px 11px !important;
                box-shadow: 0 1px 3px rgba(0,0,0,0.04) !important;
                grid-template-columns: 1fr auto !important;
                grid-template-rows: auto auto auto !important;
                gap: 1px 8px !important;
            }
            #tbl_uniform_tx tbody tr.inv-unpaid-row {
                border-left: 4px solid #f97316 !important;
                background: #fff7ed !important;
            }
            #tbl_uniform_tx tbody td {
                display: block !important; padding: 0 !important;
                border: none !important; white-space: normal !important;
            }
            /* name + NỢ badge — row 1 left (primary) */
            #tbl_uniform_tx tbody td:nth-child(2) { grid-column: 1; grid-row: 1; font-size: 0.93rem !important; font-weight: 800 !important; color: #1e293b; }
            /* amount — row 1 right (bold colored) */
            #tbl_uniform_tx tbody td:nth-child(5) { grid-column: 2; grid-row: 1; text-align: right; font-size: 1rem !important; font-weight: 900 !important; }
            /* cat/size badges — row 2 left */
            #tbl_uniform_tx tbody td:nth-child(4) { grid-column: 1; grid-row: 2; font-size: 0.78rem; }
            /* type badge — row 2 right */
            #tbl_uniform_tx tbody td:nth-child(3) { grid-column: 2; grid-row: 2; text-align: right; }
            /* date — row 3 left (small gray) */
            #tbl_uniform_tx tbody td:nth-child(1) { grid-column: 1; grid-row: 3; font-size: 0.7rem !important; color: #94a3b8; }
            /* actions — row 4, full width */
            #tbl_uniform_tx .action-btns { grid-column: 1 / span 2 !important; grid-row: 4 !important; display: flex !important; gap: 5px; padding-top: 6px !important; border-top: 1px solid #f1f5f9; margin-top: 2px; }
            #tbl_uniform_tx .btn-sm { flex: 1; padding: 6px 4px !important; font-size: 0.7rem !important; border-radius: 8px !important; font-weight: 700 !important; text-align: center; white-space: nowrap; }

            /* ── expenseList ── clean 2-row card ────── */
            #tbl_exp { min-width: unset !important; }
            #tbl_exp tbody tr {
                display: grid !important; background: #fff;
                border-radius: 11px !important; margin: 0 0 6px !important;
                border: 1px solid #e2e8f0 !important; padding: 8px 10px !important;
                box-shadow: 0 1px 3px rgba(0,0,0,0.04) !important;
                grid-template-columns: 1fr auto !important;
                grid-template-rows: auto auto !important;
                gap: 1px 6px !important;
            }
            #tbl_exp tbody td { display: block !important; padding: 0 !important; border: none !important; white-space: normal !important; }
            #tbl_exp tbody td.col-branch { display: none !important; }
            /* date — row 2 left (small gray) */
            #tbl_exp tbody td:first-child { grid-column: 1; grid-row: 2; font-size: 0.7rem !important; color: #94a3b8; }
            /* description — row 1 left */
            #tbl_exp tbody td:nth-last-child(3) { grid-column: 1; grid-row: 1; font-size: 0.88rem !important; font-weight: 700 !important; }
            /* amount — row 1 right */
            #tbl_exp tbody td:nth-last-child(2) { grid-column: 2; grid-row: 1; text-align: right; font-weight: 900 !important; color: #dc2626; }
            /* actions — row 2 right */
            #tbl_exp .action-btns { grid-column: 2 !important; grid-row: 2 !important; display: flex !important; gap: 4px; justify-content: flex-end; }

            /* ── Inventory form mobile ───────────────── */
            #inventoryForm {
                grid-template-columns: 1fr 1fr !important;
                padding: 10px !important; gap: 8px !important;
            }
            #inventoryForm select, #inventoryForm input { padding: 9px 10px !important; font-size: 14px !important; }
            #inventoryForm #inv_size_wrap { grid-column: span 2 !important; }
            #inventoryForm #inv_desc { grid-column: span 2 !important; }
            #inventoryForm #inv_unpaid_wrap { grid-column: span 2 !important; }
            #inventoryForm button[type="submit"] { grid-column: span 2 !important; padding: 10px !important; font-size: 0.85rem !important; }

            /* ── Inventory stock table mobile ────────── */
            #tbl_inventory { min-width: unset !important; }
            #tbl_inventory thead { display: none !important; }
            #tbl_inventory tbody tr {
                display: grid !important;
                grid-template-columns: 1fr auto auto auto !important;
                grid-template-rows: auto auto !important;
                align-items: center; gap: 1px 8px;
                background: #fff; border-radius: 10px !important;
                margin: 0 0 6px !important; border: 1px solid #e2e8f0 !important;
                padding: 8px 10px !important;
            }
            #tbl_inventory tbody td { display: block !important; border: none !important; padding: 0 !important; white-space: nowrap; }
            /* cat badge — row 2, col 1 (secondary small) */
            #tbl_inventory tbody td:nth-child(1) { grid-column: 1; grid-row: 2; font-size: 0.6rem !important; }
            /* size — row 1, col 1 (bold primary) */
            #tbl_inventory tbody td:nth-child(2) { grid-column: 1; grid-row: 1; font-size: 0.9rem !important; font-weight: 800 !important; color: #1e40af; }
            /* nhập — col 2, both rows centered */
            #tbl_inventory tbody td:nth-child(3) { grid-column: 2; grid-row: 1 / span 2; display: flex !important; align-items: center; font-size: 0.78rem !important; }
            /* xuất — col 3, both rows centered */
            #tbl_inventory tbody td:nth-child(4) { grid-column: 3; grid-row: 1 / span 2; display: flex !important; align-items: center; font-size: 0.78rem !important; }
            /* tồn — col 4, both rows centered (large bold) */
            #tbl_inventory tbody td:nth-child(5) { grid-column: 4; grid-row: 1 / span 2; display: flex !important; align-items: center; font-size: 1.1rem !important; font-weight: 900 !important; }

            /* ── Exam list (Thi Đai) ── card like Báo Nợ */
            #tab_exam .table-wrapper { overflow: unset !important; max-height: none !important; }
            #tbl_exam_list { min-width: unset !important; }
            #tbl_exam_list thead tr { display: none !important; }
            #tbl_exam_list tbody tr {
                display: grid !important;
                grid-template-columns: auto 1fr auto;
                grid-template-rows: auto auto;
                background: #fff; border-radius: 11px !important;
                margin: 0 0 6px !important; border: 1px solid #e8edf5 !important;
                padding: 8px 10px 6px !important;
                box-shadow: 0 1px 3px rgba(0,0,0,0.04) !important;
                gap: 1px 6px;
            }
            #tbl_exam_list tbody td { display: none !important; padding: 0 !important; border: none !important; white-space: normal !important; }
            /* colspan separator row (vừa thăng đai) */
            #tbl_exam_list tbody td[colspan] { display: block !important; grid-column: 1 / -1; padding: 4px 0 !important; font-size: 0.7rem !important; }
            /* checkbox — row 1, col 1 */
            #tbl_exam_list tbody td:first-child { display: flex !important; grid-column: 1; grid-row: 1; align-items: center; }
            /* name — row 1, col 2 */
            #tbl_exam_list tbody td.name-link { display: block !important; grid-column: 2; grid-row: 1; font-size: 0.92rem !important; font-weight: 800 !important; color: #0033A0; }
            /* branch — keep hidden */
            #tbl_exam_list tbody td.col-branch { display: none !important; }
            /* belt — row 1, col 3 (right) */
            #tbl_exam_list tbody td:nth-last-child(3) { display: block !important; grid-column: 3; grid-row: 1; text-align: right; }
            /* payment status — row 2, span cols 1-2 */
            #tbl_exam_list tbody td:nth-last-child(2) { display: block !important; grid-column: 1 / span 2; grid-row: 2; font-size: 0.82rem; padding-top: 5px !important; border-top: 1px solid #f1f5f9; margin-top: 2px; }
            /* action btn — row 2, col 3 */
            #tbl_exam_list tbody td:last-child { display: flex !important; grid-column: 3; grid-row: 2; align-items: center; justify-content: flex-end; padding-top: 5px !important; border-top: 1px solid #f1f5f9; margin-top: 2px; }
            #tbl_exam_list .btn-sm { padding: 6px 10px !important; font-size: 0.72rem !important; border-radius: 8px !important; font-weight: 700 !important; white-space: nowrap; }

            /* ── Exam expense table ── compact 2-row card */
            #tbl_exam_expense { min-width: unset !important; }
            #tbl_exam_expense thead tr { display: none !important; }
            #tbl_exam_expense tbody tr {
                display: grid !important;
                grid-template-columns: 1fr auto;
                grid-template-rows: auto auto;
                background: #fff; border-radius: 10px !important;
                margin: 0 0 5px !important; border: 1px solid #fde8d8 !important;
                padding: 7px 10px !important; gap: 1px 6px;
            }
            #tbl_exam_expense tbody td { display: block !important; padding: 0 !important; border: none !important; white-space: normal !important; }
            /* date — row 2 left */
            #tbl_exam_expense tbody td:first-child { grid-column: 1; grid-row: 2; font-size: 0.7rem !important; color: #94a3b8; }
            /* description — row 1 left */
            #tbl_exam_expense tbody td:nth-child(2) { grid-column: 1; grid-row: 1; font-size: 0.88rem !important; font-weight: 700 !important; }
            /* amount — row 1 right */
            #tbl_exam_expense tbody td:nth-child(3) { grid-column: 2; grid-row: 1; text-align: right; font-weight: 900 !important; color: #dc2626; }
            /* action — row 2 right */
            #tbl_exam_expense tbody td:last-child { grid-column: 2; grid-row: 2; display: flex !important; justify-content: flex-end; }

            /* ── Filter area compact ─────────────────── */
            #filterArea { grid-template-columns: 1fr 1fr !important; padding: 10px 12px !important; gap: 8px !important; }
            #filterArea > div:last-child { grid-column: span 2 !important; }

            /* ── Tab buttons ─────────────────────────── */
            .tab-btn { padding: 7px 12px !important; font-size: 0.8rem !important; }

            /* ── Stat summaries compact ──────────────── */
            #tab_tx .bg-blue-50\/50, #tab_debt .bg-amber-50 { padding: 6px 10px !important; gap: 6px !important; margin-bottom: 10px !important; }
            #tab_tx .bg-blue-50\/50 .block, #tab_debt .bg-amber-50 .block { font-size: 0.9rem !important; }
            #tab_tx .bg-blue-50\/50 .text-xs, #tab_debt .bg-amber-50 .text-xs { font-size: 0.6rem !important; }

            /* ── Transaction form compact ────────────── */
            #transactionForm { padding: 8px !important; gap: 6px !important; margin-bottom: 10px !important; }
            #transactionForm input, #transactionForm select { padding: 8px 10px !important; font-size: 14px !important; }
            #transactionForm button[type="submit"] { padding: 8px !important; font-size: 0.8rem !important; }

            /* ── Mobile tbl_tx cards tighter ────────── */
            #tbl_tx tbody tr { padding: 5px 8px !important; margin: 0 0 4px !important; }

            /* ── Action buttons in tab headers ────────── */
            #tab_tx .flex.gap-2.w-full, #tab_debt .flex.gap-2.flex-wrap { gap: 5px !important; }
            #tab_active .flex.gap-2.w-full { gap: 5px !important; flex-wrap: wrap !important; }
            #tab_active .flex.gap-2.w-full button { font-size: 0.75rem !important; padding: 8px 10px !important; }
        }


        /* ══ PARENT PORTAL v3 — NO-SCROLL OPTIMISED ══ */
        #loginOverlay .login-card { transition: max-width 0.35s cubic-bezier(0.16,1,0.3,1), width 0.35s; }

        /* Desktop: card rộng 2 cột */
        #loginOverlay .login-card.pp-wide {
            max-width: 820px !important;
            width: 95vw !important;
        }
        /* Layout 2 cột */
        .pp-layout { display: flex; flex-direction: column; }

        @media (min-width: 640px) {
            .pp-layout { flex-direction: row; align-items: stretch; }
            .pp-form-col {
                width: 290px; min-width: 260px; flex-shrink: 0;
                border-right: 1px solid #f1f5f9;
                display: flex; flex-direction: column; justify-content: center;
            }
            .pp-results-col {
                flex: 1; overflow-y: auto;
                max-height: calc(100vh - 120px);
                padding: 16px 18px;
            }
            .pp-results-col::-webkit-scrollbar { width: 5px; }
            .pp-results-col::-webkit-scrollbar-thumb { background:#cbd5e1; border-radius:5px; }
        }

        /* Mobile: card full-screen, form nhỏ gọn trên, result cuộn nhẹ dưới */
        @media (max-width: 639px) {
            #loginOverlay .login-card.pp-wide {
                width: 100vw !important; max-width: 100vw !important;
                border-radius: 0 !important;
                height: 100dvh; height: 100vh;
                display: flex; flex-direction: column;
                overflow: hidden;
            }
            #loginOverlay .login-card.pp-wide > .login-tabs { flex-shrink: 0; }
            #loginOverlay .login-card.pp-wide #loginPane_parent {
                flex: 1; overflow: hidden; display: flex; flex-direction: column;
            }
            #loginOverlay .login-card.pp-wide .pp-layout {
                flex: 1; overflow: hidden;
            }
            .pp-form-col {
                flex-shrink: 0;
                padding: 12px 16px 10px !important;
            }
            .pp-results-col {
                flex: 1;
                overflow-y: auto;
                -webkit-overflow-scrolling: touch;
                padding: 10px 16px 14px;
            }
            .pp-results-col::-webkit-scrollbar { display: none; }
        }

        /* Placeholder */
        .pp-placeholder {
            display: flex; flex-direction: column;
            align-items: center; justify-content: center;
            height: 100%; min-height: 200px;
            color: #cbd5e1; gap: 8px; text-align: center;
        }
        .pp-placeholder svg { opacity: 0.3; }