:root {
    --bg: #f5f7fb;
    --panel: #ffffff;
    --text: #172033;
    --muted: #6b7280;
    --line: #e5e7eb;
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --success: #059669;
    --warning: #d97706;
    --danger: #dc2626;
    --soft-blue: #eff6ff;
    --shadow: 0 18px 45px rgba(15, 23, 42, .08);
    --radius: 18px;
}

* { box-sizing: border-box; }
body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
}
a { color: var(--primary); text-decoration: none; }
button, input, select, textarea { font: inherit; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 280px 1fr; }
.sidebar {
    position: sticky; top: 0; height: 100vh; padding: 22px;
    background: linear-gradient(180deg, #0f172a 0%, #111827 100%);
    color: #fff; display: flex; flex-direction: column; gap: 24px;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-logo {
    width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center;
    background: linear-gradient(135deg, #60a5fa, #22c55e); font-size: 22px;
}
.brand-logo.big { width: 64px; height: 64px; font-size: 34px; margin-bottom: 12px; }
.brand span, .sidebar-footer small { display: block; color: #aab2c5; font-size: 13px; margin-top: 2px; }
.menu { display: flex; flex-direction: column; gap: 8px; }
.menu a {
    color: #cbd5e1; padding: 12px 14px; border-radius: 14px; transition: .2s;
}
.menu a:hover, .menu a.active { background: rgba(255,255,255,.11); color: #fff; }
.sidebar-footer { margin-top: auto; padding: 14px; border-radius: 14px; background: rgba(255,255,255,.08); }
.sidebar-footer span { display: block; font-weight: 700; }

.main { padding: 28px; min-width: 0; }
.topbar { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 24px; }
.topbar h1 { margin: 0 0 6px; font-size: 30px; letter-spacing: -.02em; }
.topbar p { margin: 0; color: var(--muted); }
.top-actions, .inline-actions, .row-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.row-actions form, .top-actions form { margin: 0; }

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    min-height: 38px; padding: 9px 14px; border: 0; border-radius: 12px;
    cursor: pointer; font-weight: 700; white-space: nowrap;
    transition: transform .12s ease, box-shadow .12s ease, background .12s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary { background: var(--primary); color: #fff; box-shadow: 0 10px 20px rgba(37, 99, 235, .22); }
.btn-primary:hover { background: var(--primary-dark); }
.btn-light { background: #eef2ff; color: #26314d; }
.btn-success { background: #dcfce7; color: #166534; }
.btn-warning { background: #fef3c7; color: #92400e; }
.btn-danger { background: #fee2e2; color: #991b1b; }
.btn-outline-danger { background: #fff; color: var(--danger); border: 1px solid #fecaca; }
.btn-full { width: 100%; }

.panel, .stat-card {
    background: var(--panel); border: 1px solid rgba(226, 232, 240, .86);
    border-radius: var(--radius); box-shadow: var(--shadow);
}
.panel { padding: 20px; margin-bottom: 22px; }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 16px; }
.panel-head h2, .panel h2 { margin: 0; font-size: 19px; }

.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 22px; }
.stats-grid.small { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.stat-card { padding: 20px; }
.stat-card span { color: var(--muted); font-weight: 700; font-size: 14px; }
.stat-card strong { display: block; margin: 8px 0 4px; font-size: 28px; letter-spacing: -.03em; }
.stat-card small { color: var(--muted); }
.stat-card.warning { background: linear-gradient(180deg, #fff 0%, #fffbeb 100%); }
.stat-card.danger { background: linear-gradient(180deg, #fff 0%, #fef2f2 100%); }

.grid-2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 22px; align-items: start; }
/* Bảng dữ liệu: cuộn ngang/dọc thân thiện khi có nhiều dữ liệu */
.table-wrap {
    position: relative;
    width: 100%;
    max-width: 100%;
    max-height: min(68vh, 640px);
    overflow: auto;
    border: 1px solid rgba(226, 232, 240, .92);
    border-radius: 16px;
    background: #fff;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: #94a3b8 #eef2ff;
}
.table-wrap::-webkit-scrollbar { width: 10px; height: 10px; }
.table-wrap::-webkit-scrollbar-track { background: #eef2ff; border-radius: 999px; }
.table-wrap::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #93c5fd, #64748b);
    border-radius: 999px;
    border: 2px solid #eef2ff;
}
.table-wrap::-webkit-scrollbar-thumb:hover { background: linear-gradient(135deg, #60a5fa, #475569); }
.table-scroll-hint {
    display: none;
    align-items: center;
    gap: 8px;
    margin: 0 0 10px;
    padding: 9px 12px;
    border-radius: 12px;
    background: #eff6ff;
    color: #1e40af;
    font-size: 13px;
    font-weight: 800;
    border: 1px solid #bfdbfe;
}
.table-wrap.has-horizontal-scroll + .table-scroll-hint,
.table-scroll-hint.is-visible { display: inline-flex; }
.table-wrap.is-scrolled-x::before,
.table-wrap.has-horizontal-scroll::after {
    content: "";
    position: sticky;
    top: 0;
    bottom: 0;
    width: 18px;
    pointer-events: none;
    z-index: 4;
}
.table-wrap.has-horizontal-scroll::after {
    float: right;
    right: 0;
    background: linear-gradient(90deg, rgba(255,255,255,0), rgba(15, 23, 42, .08));
}
table { width: 100%; border-collapse: separate; border-spacing: 0; min-width: 760px; }
th, td { padding: 13px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
th {
    position: sticky;
    top: 0;
    z-index: 3;
    color: #48556a;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: .04em;
    background: #f8fafc;
    box-shadow: 0 1px 0 var(--line);
}
.table-wrap td, .table-wrap th { white-space: nowrap; }
.table-wrap td { background: #fff; }
.table-wrap tr:hover td { background: #f8fafc; }
.table-wrap .row-actions, .table-wrap .inline-actions { white-space: normal; }
td small { color: var(--muted); }
.empty { text-align: center; color: var(--muted); padding: 26px !important; }

.badge { display: inline-flex; align-items: center; padding: 6px 10px; border-radius: 999px; font-size: 12px; font-weight: 800; }
.badge-available { background: #dcfce7; color: #166534; }
.badge-occupied, .badge-active, .badge-admin { background: #dbeafe; color: #1e40af; }
.badge-maintenance, .badge-partial, .badge-staff { background: #fef3c7; color: #92400e; }
.badge-ended, .badge-unpaid { background: #f1f5f9; color: #475569; }
.badge-overdue { background: #fee2e2; color: #991b1b; }
.badge-paid { background: #d1fae5; color: #065f46; }

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.form-grid.one-col { grid-template-columns: 1fr; }
.field { display: flex; flex-direction: column; gap: 7px; }
.field.full, .form-actions.full, .calc-box.full { grid-column: 1 / -1; }
label { font-weight: 800; color: #344054; }
input, select, textarea {
    width: 100%; border: 1px solid #d8dee9; background: #fff; border-radius: 12px;
    padding: 11px 12px; outline: none; color: var(--text);
}
input:focus, select:focus, textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 4px rgba(37, 99, 235, .10); }
textarea { resize: vertical; }
.field small, .hint { color: var(--muted); font-size: 13px; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; }
.filters { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.filters input, .filters select { width: auto; min-width: 150px; }
.calc-box {
    display: flex; justify-content: space-between; align-items: center; padding: 16px;
    background: var(--soft-blue); border: 1px dashed #93c5fd; border-radius: 16px;
}
.calc-box span { font-weight: 800; color: #1d4ed8; }
.calc-box strong { font-size: 24px; color: #1e3a8a; }

.flash-wrap { margin-bottom: 18px; }
.flash-login { position: fixed; top: 18px; left: 50%; transform: translateX(-50%); z-index: 2; min-width: 320px; }
.flash { padding: 13px 15px; border-radius: 14px; margin-bottom: 8px; font-weight: 700; border: 1px solid transparent; }
.flash-success { background: #ecfdf5; color: #065f46; border-color: #a7f3d0; }
.flash-warning { background: #fffbeb; color: #92400e; border-color: #fde68a; }
.flash-danger { background: #fef2f2; color: #991b1b; border-color: #fecaca; }

.login-page {
    min-height: 100vh; display: grid; place-items: center; padding: 28px;
    background: radial-gradient(circle at top left, rgba(37, 99, 235, .25), transparent 38%),
                linear-gradient(135deg, #0f172a, #1e293b 52%, #0f766e);
}
.login-card { width: min(960px, 100%); display: grid; grid-template-columns: 1.1fr .9fr; gap: 20px; align-items: stretch; }
.login-hero, .login-form { border-radius: 28px; padding: 34px; box-shadow: 0 30px 80px rgba(0,0,0,.24); }
.login-hero { color: #fff; background: rgba(255,255,255,.10); border: 1px solid rgba(255,255,255,.16); backdrop-filter: blur(14px); }
.login-hero h1 { margin: 0 0 10px; font-size: 38px; }
.login-hero p { color: #dbeafe; font-size: 18px; line-height: 1.55; }
.login-form { background: #fff; display: flex; flex-direction: column; gap: 12px; }
.login-form h2 { margin: 0 0 8px; font-size: 28px; }
.profile-card { max-width: 520px; }
.status-list { display: grid; gap: 12px; }
.status-list div { display: flex; justify-content: space-between; align-items: center; padding: 14px; border: 1px solid var(--line); border-radius: 14px; }
.empty-state { text-align: center; padding: 60px 24px; }

@media (max-width: 1100px) {
    .app-shell { grid-template-columns: 1fr; }
    .sidebar { position: relative; height: auto; border-radius: 0 0 26px 26px; }
    .menu { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); }
    .sidebar-footer { margin-top: 0; }
    .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .grid-2, .login-card { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
    .main { padding: 18px; }
    .topbar, .panel-head.stack-mobile { flex-direction: column; align-items: stretch; }
    .top-actions, .inline-actions, .filters { align-items: stretch; }
    .menu { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .stats-grid, .stats-grid.small { grid-template-columns: 1fr; }
    .form-grid { grid-template-columns: 1fr; }
    .login-page { padding: 14px; }
    .login-hero, .login-form { padding: 24px; }
    .filters input, .filters select, .filters button { width: 100%; }
}

.section-eyebrow {
    display: inline-flex; align-items: center; gap: 6px; margin-bottom: 8px;
    color: var(--primary); font-size: 12px; font-weight: 900; text-transform: uppercase; letter-spacing: .08em;
}
.qr-preview, .qr-section {
    display: grid; grid-template-columns: minmax(0, 1fr) 240px; gap: 20px; align-items: center;
    padding: 18px; border: 1px solid #bfdbfe; border-radius: 18px;
    background: linear-gradient(135deg, #eff6ff 0%, #ffffff 62%);
}
.qr-preview h2, .qr-section h2 { margin: 0 0 8px; font-size: 20px; }
.qr-preview p, .qr-section p { margin: 0 0 14px; color: var(--muted); line-height: 1.55; }
.qr-preview img, .qr-card img {
    width: 220px; max-width: 100%; border-radius: 18px; background: #fff;
    border: 1px solid var(--line); padding: 10px; box-shadow: 0 14px 30px rgba(15, 23, 42, .10);
}
.qr-meta {
    display: flex; flex-direction: column; gap: 4px; padding: 12px 14px; margin: 0 0 14px;
    background: #fff; border: 1px solid var(--line); border-radius: 14px;
}
.qr-meta strong { font-size: 22px; color: #0f172a; }
.qr-meta small { color: var(--muted); overflow-wrap: anywhere; }
.qr-card { display: grid; justify-items: center; gap: 10px; text-align: center; }
.qr-card.centered { min-height: 360px; align-content: center; }
.qr-card strong { font-size: 22px; }
.qr-card span { color: var(--muted); overflow-wrap: anywhere; }
.qr-empty, .paid-notice {
    display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
    padding: 15px 16px; border-radius: 16px; border: 1px dashed #93c5fd; background: #eff6ff;
}
.qr-empty strong, .paid-notice strong { color: #1e40af; }
.qr-empty span, .paid-notice span { color: var(--muted); }

@media (max-width: 720px) {
    .qr-preview, .qr-section { grid-template-columns: 1fr; text-align: left; }
    .qr-preview img, .qr-card img { width: 100%; max-width: 280px; justify-self: center; }
}


.print-toolbar {
    max-width: 980px; margin: 22px auto 14px; padding: 0 12px;
    display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap;
}
.print-page { background: #e5e7eb; }
.invoice-paper {
    width: min(980px, calc(100% - 24px)); margin: 0 auto 32px; padding: 34px;
    background: #fff; border-radius: 18px; box-shadow: 0 20px 60px rgba(15, 23, 42, .14);
}
.invoice-print-head {
    display: flex; justify-content: space-between; align-items: flex-start; gap: 20px;
    padding-bottom: 20px; border-bottom: 3px solid #0f172a;
}
.invoice-print-head h1 { margin: 0 0 8px; font-size: 30px; letter-spacing: -.02em; }
.invoice-print-head p { margin: 0; color: var(--muted); }
.invoice-print-status { display: grid; gap: 10px; justify-items: end; }
.invoice-print-status small { color: var(--muted); }
.invoice-info-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin: 22px 0; }
.invoice-info-box {
    border: 1px solid var(--line); border-radius: 16px; padding: 16px; background: #f8fafc;
}
.invoice-info-box h3, .invoice-note-box h3 { margin: 0 0 12px; font-size: 16px; }
.invoice-info-box p { margin: 8px 0; display: flex; justify-content: space-between; gap: 16px; }
.invoice-info-box span { color: var(--muted); }
.invoice-info-box strong { text-align: right; overflow-wrap: anywhere; }
.invoice-print-section h2, .invoice-qr-print h2 { margin: 0 0 14px; font-size: 20px; }
.print-table { min-width: 0; }
.print-table th, .print-table td { padding: 11px 10px; }
.invoice-print-bottom {
    display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(280px, .8fr); gap: 18px; margin-top: 22px;
}
.invoice-note-box { border: 1px solid var(--line); border-radius: 16px; padding: 16px; }
.invoice-note-box p { margin: 0; color: var(--muted); line-height: 1.55; }
.payment-print-list { margin: 0; padding-left: 18px; color: var(--muted); line-height: 1.7; }
.invoice-summary-card { border: 1px solid var(--line); border-radius: 16px; overflow: hidden; align-self: start; }
.invoice-summary-card div { display: flex; justify-content: space-between; gap: 18px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.invoice-summary-card div:last-child { border-bottom: 0; }
.invoice-summary-card span { color: var(--muted); font-weight: 800; }
.invoice-summary-card strong { font-size: 18px; }
.invoice-summary-card .summary-due { background: #eff6ff; }
.invoice-summary-card .summary-due strong { color: #1d4ed8; font-size: 24px; }
.invoice-qr-print {
    display: grid; grid-template-columns: minmax(0, 1fr) 240px; gap: 18px; align-items: center;
    margin-top: 22px; padding: 18px; border: 2px dashed #93c5fd; border-radius: 18px; background: #eff6ff;
}
.invoice-qr-print p { margin: 0 0 12px; color: var(--muted); line-height: 1.55; }
.bank-print-info { font-size: 14px; color: #334155 !important; }
.print-qr-meta { margin-bottom: 12px; }
.print-qr-card img { width: 220px; box-shadow: none; }
.invoice-signatures { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin-top: 34px; }
.invoice-signatures div { min-height: 110px; text-align: center; padding-top: 12px; }
.invoice-signatures span { display: block; color: var(--muted); margin-top: 6px; }
.print-toolbar-screen { margin-bottom: 16px; }

@media print {
    @page { size: A4; margin: 12mm; }
    :root { --shadow: none; }
    body.print-page { background: #fff; }
    .no-print, .print-toolbar { display: none !important; }
    .invoice-paper { width: 100%; margin: 0; padding: 0; border-radius: 0; box-shadow: none; }
    .invoice-print-head { padding-bottom: 14px; }
    .invoice-print-head h1 { font-size: 24px; }
    .invoice-info-grid { margin: 16px 0; gap: 10px; }
    .invoice-info-box, .invoice-note-box, .invoice-summary-card, .invoice-qr-print { break-inside: avoid; }
    table { min-width: 0; }
    th, td { padding: 8px 7px; }
    .invoice-print-bottom { grid-template-columns: 1fr 280px; gap: 12px; margin-top: 16px; }
    .invoice-qr-print { margin-top: 16px; padding: 12px; grid-template-columns: 1fr 190px; }
    .print-qr-card img { width: 180px; padding: 6px; }
    .invoice-signatures { margin-top: 22px; }
    .invoice-signatures div { min-height: 84px; }
    a { color: inherit; }
}

@media (max-width: 720px) {
    .invoice-paper { padding: 22px; }
    .invoice-print-head, .invoice-info-box p { flex-direction: column; }
    .invoice-print-status { justify-items: start; }
    .invoice-info-grid, .invoice-print-bottom, .invoice-qr-print, .invoice-signatures { grid-template-columns: 1fr; }
    .invoice-info-box strong { text-align: left; }
    .print-table { min-width: 720px; }
}

.badge-tenant { background: #ede9fe; color: #5b21b6; }

.tenant-picker-toolbar {
    display: flex; align-items: center; gap: 12px; margin-bottom: 12px; flex-wrap: wrap;
}
.tenant-picker-toolbar input { flex: 1 1 260px; }
.tenant-count-pill {
    display: inline-flex; align-items: center; gap: 6px; padding: 10px 12px;
    border-radius: 999px; background: #ecfdf5; color: #065f46; font-weight: 800;
    border: 1px solid #a7f3d0;
}
.tenant-picker-grid {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px;
    max-height: 360px; overflow: auto; padding: 4px;
}
.tenant-card {
    display: flex; align-items: center; gap: 12px; padding: 12px;
    border: 1px solid var(--line); border-radius: 16px; background: #fff; cursor: pointer;
    transition: .18s ease;
}
.tenant-card:hover { border-color: #93c5fd; transform: translateY(-1px); box-shadow: 0 12px 24px rgba(15, 23, 42, .08); }
.tenant-card input { width: auto; accent-color: var(--primary); }
.tenant-avatar {
    width: 38px; height: 38px; border-radius: 14px; display: grid; place-items: center;
    background: #eff6ff; color: #1d4ed8; font-weight: 900;
}
.tenant-card-info { display: grid; gap: 3px; min-width: 0; }
.tenant-card-info strong, .tenant-card-info small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tenant-card-info small { color: var(--muted); }
.occupant-list { display: grid; gap: 4px; }
.occupant-list small { color: var(--muted); max-width: 280px; display: block; overflow-wrap: anywhere; }
.calc-note {
    display: grid; gap: 5px; padding: 13px 14px; border-radius: 16px; border: 1px solid #a7f3d0; background: #ecfdf5;
}
.calc-note strong { color: #047857; }
.calc-note span { font-size: 20px; font-weight: 900; color: #064e3b; }
.calc-note small { color: #047857; }
.image-preview-link { display: inline-flex; margin-top: 8px; color: var(--primary); font-weight: 800; text-decoration: none; }

.auth-links { text-align: center; font-weight: 800; }
.auth-narrow { width: min(860px, 100%); }
.secure-link-box, .secure-link-panel {
    display: grid; gap: 10px; padding: 14px; border-radius: 16px;
    border: 1px dashed #93c5fd; background: #eff6ff;
}
.secure-link-box strong, .secure-link-panel h2 { color: #1e40af; }
.secure-link-box small { color: var(--muted); line-height: 1.45; }
.check-row {
    display: inline-flex; align-items: center; gap: 10px; font-weight: 800;
    color: #344054; padding: 10px 0;
}
.check-row input { width: auto; accent-color: var(--primary); }

/* =========================
   Visual refresh 2026: Trân Ánh Liên
   ========================= */
:root {
    --bg: #eef7f4;
    --panel: #ffffff;
    --text: #102033;
    --muted: #667085;
    --line: #dbe7e4;
    --primary: #0f766e;
    --primary-dark: #0b5f59;
    --success: #059669;
    --warning: #d97706;
    --danger: #dc2626;
    --soft-blue: #ecfeff;
    --soft-mint: #ecfdf5;
    --zalo: #0068ff;
    --shadow: 0 20px 50px rgba(15, 118, 110, .12);
    --shadow-strong: 0 30px 90px rgba(15, 23, 42, .22);
    --radius: 22px;
}

html { scroll-behavior: smooth; }
body {
    background:
        radial-gradient(circle at 15% -10%, rgba(20, 184, 166, .18), transparent 34%),
        radial-gradient(circle at 100% 0%, rgba(59, 130, 246, .14), transparent 28%),
        linear-gradient(180deg, #f7fffc 0%, #eef7f4 48%, #f6f8ff 100%);
}

body.menu-open { overflow: hidden; }
.mobile-overlay { display: none; }
.app-shell { grid-template-columns: 300px minmax(0, 1fr); }
.sidebar {
    background:
        radial-gradient(circle at 15% 0%, rgba(45, 212, 191, .22), transparent 30%),
        linear-gradient(180deg, #063b3b 0%, #0f172a 58%, #111827 100%);
    border-right: 1px solid rgba(255,255,255,.08);
    box-shadow: 14px 0 55px rgba(15, 23, 42, .22);
    overflow-y: auto;
    scrollbar-width: thin;
}
.sidebar-topline {
    height: 5px;
    border-radius: 999px;
    background: linear-gradient(90deg, #2dd4bf, #60a5fa, #a78bfa);
    box-shadow: 0 8px 24px rgba(45, 212, 191, .30);
}
.brand-logo {
    background: linear-gradient(135deg, #2dd4bf 0%, #0ea5e9 55%, #8b5cf6 100%);
    box-shadow: 0 16px 32px rgba(45, 212, 191, .22);
}
.brand strong { font-size: 18px; letter-spacing: -.01em; }
.menu a {
    display: flex; align-items: center; gap: 10px;
    min-height: 46px;
    border: 1px solid transparent;
    color: #d6e8ef;
    font-weight: 800;
}
.menu a span { width: 24px; text-align: center; }
.menu a:hover, .menu a.active {
    background: rgba(255,255,255,.12);
    color: #fff;
    border-color: rgba(255,255,255,.14);
    box-shadow: inset 0 0 0 1px rgba(255,255,255,.04), 0 12px 28px rgba(0,0,0,.16);
}

.menu-divider {
    height: 1px;
    margin: 10px 0;
    background: rgba(255,255,255,.12);
}
.menu a.menu-zalo-link {
    color: #fff;
    background: linear-gradient(135deg, rgba(0,104,255,.96), rgba(14,165,233,.88));
    border-color: rgba(255,255,255,.18);
    box-shadow: 0 14px 30px rgba(0,104,255,.20);
}
.menu a.menu-zalo-link:hover {
    background: linear-gradient(135deg, #0057d9, #0284c7);
    transform: translateY(-1px);
}
.sidebar-footer {
    border: 1px solid rgba(255,255,255,.12);
    background: rgba(255,255,255,.10);
    backdrop-filter: blur(14px);
}
.zalo-card {
    display: grid; gap: 10px;
    padding: 15px;
    border-radius: 22px;
    background: linear-gradient(135deg, rgba(0,104,255,.18), rgba(45,212,191,.12));
    border: 1px solid rgba(255,255,255,.14);
    color: #fff;
}
.zalo-card strong { display: block; font-size: 15px; }
.zalo-card span { color: #cdeafd; font-size: 13px; line-height: 1.45; }
.zalo-icon {
    width: 42px; height: 42px; border-radius: 16px;
    display: grid; place-items: center;
    background: rgba(255,255,255,.14);
}

.main { padding: 30px; }
.topbar {
    align-items: center;
    padding: 18px;
    border: 1px solid rgba(219, 231, 228, .92);
    border-radius: 28px;
    background: rgba(255,255,255,.82);
    box-shadow: var(--shadow);
    backdrop-filter: blur(18px);
}
.topbar-title { min-width: 0; }
.topbar-chip, .hero-badge {
    display: inline-flex; align-items: center; gap: 7px;
    padding: 6px 10px;
    border-radius: 999px;
    color: #0f766e;
    background: #ccfbf1;
    border: 1px solid #99f6e4;
    font-size: 12px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: .06em;
    margin-bottom: 8px;
}
.topbar h1 { font-size: clamp(24px, 3vw, 34px); color: #0f172a; }
.top-actions { justify-content: flex-end; }
.menu-toggle {
    display: none;
    width: 44px; height: 44px;
    border: 0;
    border-radius: 15px;
    background: #0f766e;
    color: #fff;
    font-size: 22px;
    font-weight: 900;
    cursor: pointer;
    box-shadow: 0 14px 25px rgba(15, 118, 110, .25);
}
.btn { border-radius: 14px; min-height: 42px; }
.btn-primary {
    background: linear-gradient(135deg, #0f766e, #0ea5e9);
    box-shadow: 0 14px 28px rgba(14, 165, 233, .24);
}
.btn-primary:hover { background: linear-gradient(135deg, #0b5f59, #0284c7); }
.btn-light { background: #f0fdfa; color: #134e4a; border: 1px solid #ccfbf1; }
.btn-zalo {
    background: linear-gradient(135deg, #0068ff, #0099ff);
    color: #fff;
    box-shadow: 0 14px 28px rgba(0,104,255,.22);
}
.btn-zalo:hover { color: #fff; filter: brightness(.98); }

.post-login-zalo-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin: 18px 0;
    padding: 16px 18px;
    border-radius: 24px;
    color: #fff;
    background:
        radial-gradient(circle at 12% 0%, rgba(255,255,255,.26), transparent 32%),
        linear-gradient(135deg, #0068ff 0%, #0ea5e9 48%, #0f766e 100%);
    box-shadow: 0 18px 42px rgba(0, 104, 255, .20);
    overflow: hidden;
}
.post-login-zalo-main {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}
.post-login-zalo-icon {
    width: 48px;
    height: 48px;
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    border-radius: 18px;
    background: rgba(255,255,255,.18);
    box-shadow: inset 0 0 0 1px rgba(255,255,255,.20);
    font-size: 24px;
}
.post-login-zalo-banner strong {
    display: block;
    font-size: 17px;
    line-height: 1.2;
}
.post-login-zalo-banner span {
    display: block;
    margin-top: 4px;
    color: rgba(255,255,255,.86);
    line-height: 1.45;
}
.post-login-zalo-btn {
    flex: 0 0 auto;
    background: #fff;
    color: #0057d9;
    box-shadow: 0 14px 28px rgba(15, 23, 42, .18);
}
.post-login-zalo-btn:hover { color: #0057d9; }

.panel, .stat-card {
    border-color: rgba(219, 231, 228, .92);
    box-shadow: var(--shadow);
}
.panel-refresh { overflow: hidden; }
.panel-head a:not(.btn) { font-weight: 900; }
.dashboard-hero, .tenant-welcome-card {
    position: relative;
    overflow: hidden;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(240px, 340px);
    align-items: center;
    gap: 22px;
    margin-bottom: 22px;
    padding: clamp(22px, 4vw, 34px);
    border-radius: 30px;
    color: #fff;
    background:
        radial-gradient(circle at 90% 10%, rgba(255,255,255,.22), transparent 26%),
        linear-gradient(135deg, #0f766e 0%, #0f172a 62%, #312e81 100%);
    box-shadow: var(--shadow-strong);
}
.dashboard-hero::after, .tenant-welcome-card::after {
    content: "";
    position: absolute;
    width: 220px; height: 220px;
    right: -70px; bottom: -100px;
    background: rgba(45, 212, 191, .22);
    border-radius: 999px;
}
.dashboard-hero > *, .tenant-welcome-card > * { position: relative; z-index: 1; }
.dashboard-hero h2, .tenant-welcome-card h2 {
    margin: 0 0 10px;
    font-size: clamp(26px, 4vw, 42px);
    line-height: 1.05;
    letter-spacing: -.04em;
}
.dashboard-hero p, .tenant-welcome-card p {
    margin: 0;
    color: #dbeafe;
    max-width: 760px;
    line-height: 1.65;
}
.hero-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 20px; }
.hero-mini-card {
    padding: 22px;
    border-radius: 26px;
    background: rgba(255,255,255,.12);
    border: 1px solid rgba(255,255,255,.18);
    backdrop-filter: blur(16px);
}
.hero-mini-card span { color: #c7f9f4; font-weight: 800; }
.hero-mini-card strong { display: block; margin: 8px 0 2px; font-size: clamp(26px, 4vw, 36px); letter-spacing: -.04em; }
.hero-mini-card small { color: #dbeafe; }
.stats-grid-refresh { gap: 18px; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.stat-card-refresh {
    position: relative;
    overflow: hidden;
    min-height: 142px;
    border: 0;
}
.stat-card-refresh::before {
    content: "";
    position: absolute;
    width: 110px; height: 110px;
    right: -38px; top: -38px;
    border-radius: 999px;
    background: rgba(255,255,255,.52);
}
.stat-card-refresh span, .stat-card-refresh strong, .stat-card-refresh small { position: relative; z-index: 1; }
.stat-card-refresh strong { color: #0f172a; }
.stat-blue { background: linear-gradient(135deg, #dbeafe, #ffffff); }
.stat-green { background: linear-gradient(135deg, #dcfce7, #ffffff); }
.stat-teal { background: linear-gradient(135deg, #ccfbf1, #ffffff); }
.stat-purple { background: linear-gradient(135deg, #ede9fe, #ffffff); }
.stat-orange { background: linear-gradient(135deg, #ffedd5, #ffffff); }
.dashboard-grid .panel { min-height: 100%; }

/* Login refresh */
.login-page-refresh {
    position: relative;
    overflow: hidden;
    min-height: 100svh;
    padding: clamp(16px, 4vw, 38px);
    background:
        radial-gradient(circle at 10% 15%, rgba(45, 212, 191, .36), transparent 28%),
        radial-gradient(circle at 85% 10%, rgba(59, 130, 246, .30), transparent 30%),
        linear-gradient(135deg, #062e2e 0%, #0f172a 52%, #102a5c 100%);
}
.login-glow {
    position: absolute;
    border-radius: 999px;
    filter: blur(10px);
    opacity: .68;
    pointer-events: none;
}
.login-glow-1 { width: 260px; height: 260px; background: rgba(45, 212, 191, .28); left: -70px; bottom: 8%; }
.login-glow-2 { width: 220px; height: 220px; background: rgba(96, 165, 250, .25); right: -50px; top: 16%; }
.login-card-refresh {
    position: relative;
    z-index: 1;
    width: min(1120px, 100%);
    grid-template-columns: minmax(0, 1.14fr) minmax(360px, .86fr);
    gap: 22px;
}
.login-hero-refresh, .login-form-refresh {
    border-radius: 34px;
    padding: clamp(24px, 4vw, 42px);
    box-shadow: var(--shadow-strong);
}
.login-hero-refresh {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 590px;
    background:
        linear-gradient(135deg, rgba(255,255,255,.15), rgba(255,255,255,.06)),
        radial-gradient(circle at 86% 12%, rgba(45,212,191,.25), transparent 25%);
    border: 1px solid rgba(255,255,255,.20);
    backdrop-filter: blur(18px);
}
.login-brand-row { display: grid; gap: 18px; }
.login-eyebrow {
    display: inline-flex;
    padding: 7px 11px;
    border-radius: 999px;
    background: rgba(204,251,241,.16);
    color: #a7f3d0;
    font-size: 12px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: .08em;
    margin-bottom: 12px;
}
.login-hero-refresh h1 {
    max-width: 720px;
    margin: 0;
    font-size: clamp(34px, 5vw, 58px);
    line-height: 1.02;
    letter-spacing: -.05em;
}
.login-hero-refresh p { max-width: 720px; color: #dbeafe; }

.login-intro-meta {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    margin-top: 22px;
}
.login-intro-meta div {
    padding: 14px 15px;
    border-radius: 20px;
    background: rgba(255,255,255,.10);
    border: 1px solid rgba(255,255,255,.15);
    box-shadow: inset 0 1px 0 rgba(255,255,255,.08);
}
.login-intro-meta span {
    display: block;
    margin-bottom: 5px;
    color: #a7f3d0;
    font-size: 12px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: .06em;
}
.login-intro-meta strong {
    display: block;
    color: #fff;
    font-size: 14px;
    line-height: 1.35;
}

.login-feature-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    margin: 26px 0;
}
.login-feature-grid div {
    padding: 15px;
    border-radius: 20px;
    background: rgba(255,255,255,.10);
    border: 1px solid rgba(255,255,255,.14);
}
.login-feature-grid strong { display: block; margin-bottom: 6px; }
.login-feature-grid span { display: block; color: #cdeafd; font-size: 13px; line-height: 1.45; }
.zalo-login-link {
    display: flex; align-items: center; gap: 12px;
    margin-top: auto;
    padding: 16px;
    border-radius: 22px;
    color: #fff;
    background: linear-gradient(135deg, rgba(0,104,255,.92), rgba(45,212,191,.58));
    border: 1px solid rgba(255,255,255,.22);
}
.zalo-login-link span {
    width: 42px; height: 42px;
    display: grid; place-items: center;
    border-radius: 16px;
    background: rgba(255,255,255,.16);
    flex: 0 0 auto;
}
.login-form-refresh {
    justify-content: center;
    gap: 13px;
    background: rgba(255,255,255,.96);
}
.login-form-head { text-align: center; margin-bottom: 8px; }
.login-icon {
    width: 58px; height: 58px;
    display: grid; place-items: center;
    margin: 0 auto 12px;
    border-radius: 20px;
    background: #ccfbf1;
    color: #0f766e;
    font-size: 26px;
}
.login-form-head h2 { margin: 0 0 6px; font-size: 32px; }
.login-form-head p { margin: 0; color: var(--muted); line-height: 1.5; }
.login-form-refresh input {
    min-height: 48px;
    border-radius: 16px;
    background: #f8fffd;
}
.btn-login { min-height: 50px; margin-top: 6px; font-size: 16px; }
.login-bottom-row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    font-weight: 900;
}
.login-default-hint {
    margin: 8px 0 0;
    padding: 12px;
    border-radius: 16px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
}

.tenant-welcome-card {
    grid-template-columns: minmax(0, 1fr) auto;
    padding: 26px;
}
.tenant-welcome-card h2 { font-size: clamp(24px, 3.4vw, 36px); }

@media (max-width: 1100px) {
    .app-shell { display: block; }
    .main { padding: 18px; }
    .menu-toggle { display: inline-grid; place-items: center; flex: 0 0 auto; }
    .topbar {
        position: sticky;
        top: 10px;
        z-index: 20;
        align-items: flex-start;
    }
    .top-actions { margin-left: auto; }
    .sidebar {
        position: fixed;
        inset: 0 auto 0 0;
        width: min(86vw, 330px);
        height: 100svh;
        z-index: 40;
        border-radius: 0 28px 28px 0;
        transform: translateX(-105%);
        transition: transform .24s ease;
    }
    body.menu-open .sidebar { transform: translateX(0); }
    .mobile-overlay {
        position: fixed;
        inset: 0;
        z-index: 35;
        background: rgba(15, 23, 42, .55);
        backdrop-filter: blur(3px);
    }
    body.menu-open .mobile-overlay { display: block; }
    .menu { display: flex; grid-template-columns: none; }
    .sidebar-footer { margin-top: 0; }
    .top-zalo { display: none; }
    .dashboard-hero { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
    .topbar {
        display: grid;
        grid-template-columns: auto minmax(0, 1fr);
        gap: 12px;
        padding: 14px;
        border-radius: 22px;
    }
    .topbar-title { grid-column: 2; }
    .top-actions {
        grid-column: 1 / -1;
        width: 100%;
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }
    .top-actions .btn, .top-actions form, .top-actions button { width: 100%; }
    .topbar h1 { font-size: 24px; }
    .topbar p { font-size: 14px; }
    .dashboard-hero, .tenant-welcome-card {
        grid-template-columns: 1fr;
        padding: 22px;
        border-radius: 24px;
    }
    .hero-actions { display: grid; grid-template-columns: 1fr; }
    .hero-actions .btn, .tenant-welcome-card .btn { width: 100%; }
    .post-login-zalo-banner {
        align-items: stretch;
        flex-direction: column;
        border-radius: 22px;
        margin: 14px 0;
        padding: 14px;
    }
    .post-login-zalo-main { align-items: flex-start; }
    .post-login-zalo-btn { width: 100%; justify-content: center; }
    .stat-card-refresh { min-height: 120px; }
    .panel { padding: 16px; border-radius: 20px; }
    .login-card-refresh { grid-template-columns: 1fr; }
    .login-hero-refresh { min-height: auto; }
    .login-intro-meta { grid-template-columns: 1fr; }
    .login-feature-grid { grid-template-columns: 1fr; }
    .login-bottom-row { justify-content: center; text-align: center; }
}

@media (max-width: 560px) {
    .main { padding: 12px; }
    .login-page-refresh { padding: 12px; align-items: start; }
    .login-hero-refresh, .login-form-refresh { border-radius: 24px; padding: 20px; }
    .login-hero-refresh h1 { font-size: 34px; }
    .login-hero-refresh p { font-size: 15px; }
    .brand-logo.big { width: 56px; height: 56px; font-size: 30px; }
    .flash-login { width: calc(100% - 24px); min-width: 0; }
    .mobile-table-card { overflow: visible; }

    .mobile-table-card {
        max-height: none;
        border: 0;
        border-radius: 0;
        background: transparent;
    }
    .table-scroll-hint {
        display: inline-flex;
        width: 100%;
        justify-content: center;
        margin-bottom: 8px;
    }
    .mobile-table-card table, .mobile-table-card thead, .mobile-table-card tbody, .mobile-table-card tr, .mobile-table-card th, .mobile-table-card td {
        display: block;
        min-width: 0;
        width: 100%;
    }
    .mobile-table-card thead { display: none; }
    .mobile-table-card tr {
        margin-bottom: 12px;
        padding: 12px;
        border: 1px solid var(--line);
        border-radius: 16px;
        background: #fff;
        box-shadow: 0 10px 24px rgba(15, 23, 42, .06);
    }
    .mobile-table-card td {
        display: flex;
        justify-content: space-between;
        gap: 12px;
        padding: 9px 0;
        border-bottom: 1px dashed #e2e8f0;
        text-align: right;
    }
    .mobile-table-card td:last-child { border-bottom: 0; }
    .mobile-table-card td::before {
        content: attr(data-label);
        color: var(--muted);
        font-weight: 900;
        text-align: left;
    }
    .mobile-table-card .empty { text-align: center; display: block; }
    .mobile-table-card .empty::before { content: none; }
}

/* Payment confirmation workflow */
.badge-payment_pending, .badge-pending { background: #dbeafe; color: #1d4ed8; }
.badge-payment_failed, .badge-rejected { background: #fee2e2; color: #991b1b; }
.badge-approved { background: #d1fae5; color: #065f46; }
.process-notice { border-left: 5px solid #2563eb; background: linear-gradient(135deg, #eff6ff, #ffffff); display: grid; gap: 6px; }
.failed-notice { border-left: 5px solid #dc2626; background: linear-gradient(135deg, #fef2f2, #ffffff); display: grid; gap: 6px; }
.payment-request-panel { margin-top: 18px; }
.admin-review-box { display: grid; gap: 10px; min-width: 220px; }
.admin-review-box form { display: grid; gap: 8px; padding: 10px; border: 1px solid var(--line); border-radius: 14px; background: #fff; }
.admin-review-box input { width: 100%; min-height: 38px; border-radius: 10px; border: 1px solid var(--line); padding: 8px 10px; }
.compact-review { margin-top: 10px; }
.urgent-panel { border: 1px solid rgba(37, 99, 235, .18); box-shadow: 0 18px 45px rgba(37, 99, 235, .10); }
@media (max-width: 720px) {
    .admin-review-box { min-width: 100%; }
    .admin-review-box form { padding: 10px; }
}

/* Login minimal update */
.login-card-minimal {
    width: min(1000px, 100%);
    grid-template-columns: minmax(0, 1fr) minmax(350px, .82fr);
    align-items: center;
}
.login-hero-minimal {
    min-height: 520px;
    justify-content: center;
    text-align: center;
}
.login-minimal-content {
    width: 100%;
    max-width: 620px;
    margin: 0 auto;
    display: grid;
    justify-items: center;
    gap: 18px;
}
.login-hero-minimal .brand-logo.big {
    margin: 0 auto 2px;
    width: 78px;
    height: 78px;
    border-radius: 26px;
    font-size: 40px;
    box-shadow: 0 20px 46px rgba(34, 197, 94, .24);
}
.login-hero-minimal h1 {
    max-width: 620px;
    text-align: center;
    font-size: clamp(42px, 6vw, 68px);
}
.login-intro-meta-minimal {
    width: 100%;
    max-width: 620px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-top: 8px;
}
.login-intro-meta-minimal div {
    text-align: left;
    padding: 18px;
}
.login-form-minimal {
    min-height: 480px;
}
.login-bottom-row-minimal {
    justify-content: center;
}

@media (max-width: 760px) {
    .login-card-minimal { grid-template-columns: 1fr; }
    .login-hero-minimal {
        min-height: auto;
        padding-top: 28px;
        padding-bottom: 28px;
    }
    .login-hero-minimal h1 {
        font-size: clamp(34px, 10vw, 48px);
    }
    .login-intro-meta-minimal { grid-template-columns: 1fr; }
    .login-intro-meta-minimal div { text-align: center; }
    .login-form-minimal { min-height: auto; }
}

@media (max-width: 420px) {
    .login-hero-minimal .brand-logo.big {
        width: 64px;
        height: 64px;
        border-radius: 22px;
        font-size: 34px;
    }
    .login-hero-minimal h1 { font-size: 32px; }
}


/* Mobile compact topbar after login */
@media (max-width: 760px) {
    .main {
        padding: 10px 10px 16px;
    }
    .topbar {
        display: grid;
        grid-template-columns: 40px minmax(0, 1fr) auto;
        align-items: center;
        gap: 8px;
        padding: 8px 10px;
        border-radius: 18px;
        margin-bottom: 10px;
        top: 6px;
        min-height: 56px;
    }
    .menu-toggle {
        width: 40px;
        height: 40px;
        border-radius: 13px;
        font-size: 20px;
        box-shadow: 0 10px 20px rgba(15, 118, 110, .20);
    }
    .topbar-title {
        grid-column: auto;
        min-width: 0;
    }
    .topbar-chip {
        display: none;
    }
    .topbar h1 {
        margin: 0;
        font-size: 17px;
        line-height: 1.15;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    .topbar p {
        display: none;
    }
    .top-actions {
        grid-column: auto;
        width: auto;
        display: flex;
        flex-wrap: nowrap;
        align-items: center;
        justify-content: flex-end;
        gap: 6px;
        margin-left: 0;
    }
    .top-actions form {
        width: auto;
        display: block;
        margin: 0;
    }
    .top-actions .btn,
    .top-actions button {
        width: 38px;
        min-width: 38px;
        height: 38px;
        min-height: 38px;
        padding: 0;
        border-radius: 13px;
        font-size: 0;
        box-shadow: none;
    }
    .top-action-profile::before {
        content: "👤";
        font-size: 17px;
        line-height: 1;
    }
    .top-action-logout::before {
        content: "⏻";
        font-size: 16px;
        line-height: 1;
    }
    .post-login-zalo-banner {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        align-items: center;
        gap: 8px;
        margin: 8px 0 12px;
        padding: 9px 10px;
        border-radius: 16px;
    }
    .post-login-zalo-main {
        align-items: center;
        gap: 8px;
        min-width: 0;
    }
    .post-login-zalo-icon {
        width: 34px;
        height: 34px;
        border-radius: 12px;
        font-size: 18px;
    }
    .post-login-zalo-banner strong {
        font-size: 14px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    .post-login-zalo-banner span {
        display: none;
    }
    .post-login-zalo-btn {
        width: auto;
        min-height: 34px;
        padding: 7px 10px;
        border-radius: 12px;
        font-size: 12px;
        box-shadow: none;
    }
}

@media (max-width: 380px) {
    .topbar {
        grid-template-columns: 38px minmax(0, 1fr) auto;
        padding: 7px 8px;
        gap: 6px;
    }
    .menu-toggle,
    .top-actions .btn,
    .top-actions button {
        width: 36px;
        min-width: 36px;
        height: 36px;
        min-height: 36px;
    }
    .topbar h1 {
        font-size: 16px;
    }
    .post-login-zalo-btn {
        font-size: 0;
        width: 42px;
        padding: 0;
    }
    .post-login-zalo-btn::after {
        content: "Zalo";
        font-size: 12px;
    }
}

.upload-warning {
    grid-column: 1 / -1;
    display: none;
    padding: 10px 12px;
    border-radius: 12px;
    background: #eefaf7;
    color: #0f766e;
    font-weight: 700;
    border: 1px solid rgba(15, 118, 110, .18);
}
.upload-warning:not(:empty) {
    display: block;
}
.upload-warning.is-error {
    background: #fff1f2;
    color: #be123c;
    border-color: rgba(190, 18, 60, .24);
}

/* Trang xem ảnh CCCD/CMND cho admin/nhân viên */
.tenant-id-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 18px;
}
.tenant-id-header h2 { margin: 0 0 10px; font-size: 26px; }
.tenant-id-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.tenant-id-meta span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 11px;
    border-radius: 999px;
    background: #f8fafc;
    border: 1px solid var(--line);
    color: #334155;
    font-weight: 800;
    font-size: 13px;
}
.id-card-viewer-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
    align-items: start;
}
.id-card-viewer-card {
    display: grid;
    gap: 14px;
}
.id-card-viewer-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
}
.id-card-viewer-head strong { display: block; font-size: 17px; }
.id-card-viewer-head small { display: block; margin-top: 4px; color: var(--muted); }
.id-card-photo-button {
    width: 100%;
    padding: 0;
    border: 0;
    background: #f8fafc;
    border-radius: 18px;
    overflow: hidden;
    cursor: zoom-in;
    box-shadow: inset 0 0 0 1px var(--line);
}
.id-card-photo-button img {
    width: 100%;
    min-height: 260px;
    max-height: 520px;
    object-fit: contain;
    display: block;
    background: linear-gradient(135deg, #f8fafc, #eef2ff);
    padding: 10px;
}
.id-card-viewer-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}
.id-card-empty {
    min-height: 260px;
    display: grid;
    place-items: center;
    text-align: center;
    color: var(--muted);
    border: 2px dashed #cbd5e1;
    border-radius: 18px;
    background: #f8fafc;
    font-weight: 800;
}
.image-lightbox[hidden] { display: none; }
.image-lightbox {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: grid;
    place-items: center;
    padding: 22px;
}
.image-lightbox-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, .82);
    backdrop-filter: blur(4px);
}
.image-lightbox-dialog {
    position: relative;
    width: min(1100px, 100%);
    max-height: calc(100vh - 44px);
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    gap: 12px;
    padding: 14px;
    border-radius: 22px;
    background: #fff;
    box-shadow: 0 30px 90px rgba(0, 0, 0, .35);
}
.image-lightbox-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.image-lightbox-head strong { overflow-wrap: anywhere; }
.image-lightbox-dialog img {
    width: 100%;
    height: 100%;
    max-height: calc(100vh - 140px);
    object-fit: contain;
    border-radius: 16px;
    background: #f8fafc;
    border: 1px solid var(--line);
}
body.image-preview-open { overflow: hidden; }

@media (max-width: 780px) {
    .tenant-id-header { flex-direction: column; align-items: stretch; }
    .id-card-viewer-grid { grid-template-columns: 1fr; }
    .id-card-viewer-head { flex-direction: column; align-items: stretch; }
    .id-card-viewer-head .btn,
    .id-card-viewer-actions .btn { width: 100%; }
    .id-card-photo-button img { min-height: 220px; max-height: 420px; }
    .image-lightbox { padding: 10px; }
    .image-lightbox-dialog { max-height: calc(100vh - 20px); border-radius: 18px; }
    .image-lightbox-head { align-items: flex-start; }
    .image-lightbox-head .btn { min-height: 38px; padding-inline: 12px; }
}

/* Bắt buộc đổi mật khẩu trước khi sử dụng hệ thống */
.password-change-lock .main {
    background: radial-gradient(circle at top left, rgba(37, 99, 235, .08), transparent 34%), var(--bg);
}
.menu-lock-note {
    margin: 4px 2px 0;
    padding: 12px 14px;
    border-radius: 14px;
    background: rgba(251, 191, 36, .14);
    border: 1px solid rgba(251, 191, 36, .28);
    color: #fde68a;
    font-size: 13px;
    line-height: 1.45;
    font-weight: 700;
}
.force-password-box {
    max-width: 760px;
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 14px;
    align-items: start;
    border-color: rgba(245, 158, 11, .35);
    background: linear-gradient(135deg, #fffbeb, #ffffff 58%);
}
.force-password-icon {
    width: 48px;
    height: 48px;
    border-radius: 16px;
    display: grid;
    place-items: center;
    background: #fef3c7;
    color: #92400e;
    font-size: 24px;
}
.force-password-box h2 {
    margin: 0 0 6px;
    color: #92400e;
}
.force-password-box p {
    margin: 0;
    color: #78350f;
    line-height: 1.55;
}
.password-change-lock .profile-card {
    max-width: 760px;
    border-color: rgba(37, 99, 235, .18);
}
.password-change-lock .post-login-zalo-banner,
.password-change-lock .zalo-card { display: none; }

@media (max-width: 780px) {
    .force-password-box {
        grid-template-columns: 1fr;
        text-align: left;
    }
    .force-password-icon {
        width: 44px;
        height: 44px;
        font-size: 22px;
    }
    .menu-lock-note {
        font-size: 12.5px;
        padding: 10px 12px;
    }
}

/* Popup/toast thông báo thân thiện */
.flash-wrap, .flash-login {
    position: fixed;
    top: 18px;
    right: 18px;
    left: auto;
    transform: none;
    z-index: 10000;
    width: min(420px, calc(100vw - 32px));
    display: grid;
    gap: 10px;
    margin: 0;
}
.toast-pop {
    position: relative;
    margin: 0;
    padding: 14px 44px 14px 16px;
    border-radius: 18px;
    box-shadow: 0 18px 45px rgba(15, 23, 42, .18);
    animation: toast-in .28s ease-out both;
}
.toast-close {
    position: absolute;
    right: 10px;
    top: 8px;
    width: 28px;
    height: 28px;
    border: 0;
    border-radius: 999px;
    background: rgba(15, 23, 42, .08);
    cursor: pointer;
    font-weight: 900;
}
.toast-hide { animation: toast-out .25s ease-in forwards; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-8px) scale(.98); } to { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(-8px) scale(.98); } }

.menu a { position: relative; }
.menu-badge {
    margin-left: auto;
    min-width: 22px;
    height: 22px;
    padding: 0 7px;
    display: inline-grid;
    place-items: center;
    border-radius: 999px;
    background: #ef4444;
    color: #fff;
    font-size: 12px;
}
.badge-light { background: #f1f5f9; color: #334155; }
.badge-normal { background: #e0f2fe; color: #075985; }
.badge-important { background: #fef3c7; color: #92400e; }
.badge-urgent { background: #fee2e2; color: #991b1b; }
.badge-open { background: #dbeafe; color: #1e40af; }
.badge-in_progress { background: #fef3c7; color: #92400e; }
.badge-resolved { background: #dcfce7; color: #166534; }
.badge-closed { background: #f1f5f9; color: #475569; }

.age-rule-note {
    padding: 13px 14px;
    border: 1px dashed #93c5fd;
    border-radius: 16px;
    background: #eff6ff;
    color: #1e40af;
    display: grid;
    gap: 4px;
}
.age-rule-note span { color: #334155; line-height: 1.45; }
.age-id-field[hidden] { display: none !important; }
.quick-actions-row { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 22px; }

.notification-list { display: grid; gap: 14px; }
.notification-card {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 16px;
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: #fff;
}
.notification-card.unread { border-color: #93c5fd; background: linear-gradient(135deg, #eff6ff, #fff 65%); }
.notification-card.priority-urgent { border-color: #fecaca; }
.notification-title-row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.notification-card h3 { margin: 0 0 8px; font-size: 20px; }
.notification-card p { margin: 0 0 10px; color: #334155; line-height: 1.6; white-space: pre-wrap; }
.notification-card small { color: var(--muted); }
.notification-actions { align-self: start; justify-content: flex-end; }

.issue-description {
    margin-top: 16px;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: #f8fafc;
}
.issue-description h3 { margin: 0 0 8px; }
.issue-description p { margin: 0; white-space: pre-wrap; line-height: 1.6; color: #334155; }
.issue-description.admin-note { background: #ecfdf5; border-color: #a7f3d0; }

@media (max-width: 720px) {
    .flash-wrap, .flash-login { top: 10px; right: 10px; width: calc(100vw - 20px); }
    .notification-card { grid-template-columns: 1fr; }
    .notification-actions { justify-content: stretch; }
    .notification-actions .btn, .notification-actions form, .quick-actions-row .btn { width: 100%; }
}
.menu a { display: flex; align-items: center; gap: 8px; }

/* Popup thông báo nghiệp vụ mới */
.notify-toast-wrap {
    position: fixed;
    right: 18px;
    top: 92px;
    z-index: 1200;
    display: grid;
    gap: 12px;
    width: min(420px, calc(100vw - 28px));
    pointer-events: none;
}
.notify-toast {
    position: relative;
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr);
    gap: 12px;
    padding: 16px 16px 14px;
    border-radius: 20px;
    background: rgba(255,255,255,.96);
    border: 1px solid rgba(203, 213, 225, .92);
    box-shadow: 0 22px 70px rgba(15, 23, 42, .20);
    pointer-events: auto;
    animation: notifySlideIn .28s ease both;
    overflow: hidden;
}
.notify-toast::before {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    width: 6px;
    background: linear-gradient(180deg, #0f766e, #38bdf8);
}
.notify-toast.notify-urgent::before { background: linear-gradient(180deg, #dc2626, #f97316); }
.notify-toast.notify-important::before { background: linear-gradient(180deg, #d97706, #facc15); }
.notify-icon {
    width: 44px;
    height: 44px;
    border-radius: 16px;
    display: grid;
    place-items: center;
    background: #ecfeff;
    font-size: 22px;
}
.notify-body { min-width: 0; padding-right: 22px; }
.notify-body strong { display: block; color: #0f172a; font-size: 15px; line-height: 1.35; }
.notify-body p { margin: 6px 0 10px; color: #475569; line-height: 1.45; font-size: 13px; }
.notify-actions { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.notify-actions a { font-weight: 900; color: var(--primary); }
.notify-actions small { color: var(--muted); font-size: 12px; }
.notify-close {
    position: absolute;
    right: 10px;
    top: 10px;
    width: 28px;
    height: 28px;
    border: 0;
    border-radius: 999px;
    background: #f1f5f9;
    color: #475569;
    cursor: pointer;
    font-weight: 900;
}
@keyframes notifySlideIn {
    from { opacity: 0; transform: translateY(-8px) translateX(18px); }
    to { opacity: 1; transform: translateY(0) translateX(0); }
}
.notification-card h3 a { color: inherit; }
.notification-read-link { display: inline-flex; margin-top: 8px; font-weight: 900; }
.notification-detail-content {
    margin-top: 18px;
    padding: 18px;
    border-radius: 18px;
    border: 1px solid var(--line);
    background: #f8fafc;
    color: #1f2937;
    line-height: 1.75;
    white-space: normal;
}
.badge-login-success { background: #d1fae5; color: #065f46; }
.badge-login-failed { background: #fee2e2; color: #991b1b; }
.badge-login-inactive, .badge-login-locked { background: #fef3c7; color: #92400e; }
@media (max-width: 720px) {
    .notify-toast-wrap {
        left: 14px;
        right: 14px;
        top: 74px;
        width: auto;
    }
    .notify-toast { grid-template-columns: 38px minmax(0, 1fr); padding: 14px; }
    .notify-icon { width: 38px; height: 38px; border-radius: 14px; }
}

/* Báo cáo phòng theo mã số */
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.report-room-summary .panel-head { margin-bottom: 10px; }
.room-status-card { position: relative; overflow: hidden; }
.room-status-card::after {
    content: ""; position: absolute; inset: auto -40px -50px auto; width: 130px; height: 130px;
    border-radius: 999px; background: rgba(37, 99, 235, .08); pointer-events: none;
}
.occupied-card { background: linear-gradient(135deg, #eff6ff, #fff); }
.available-card { background: linear-gradient(135deg, #ecfdf5, #fff); }
.maintenance-card { background: linear-gradient(135deg, #fffbeb, #fff); }
.room-number-list { margin: 0; color: #334155; font-weight: 800; line-height: 1.7; overflow-wrap: anywhere; }
@media (max-width: 980px) { .grid-3 { grid-template-columns: 1fr; } }

/* Hiệu ứng thao tác toàn website + trạng thái đang tải */
:root {
    --motion-fast: 140ms;
    --motion-normal: 240ms;
    --motion-slow: 420ms;
    --ease-out: cubic-bezier(.2, .8, .2, 1);
}

html { scroll-behavior: smooth; }
body { overflow-x: hidden; }
body.ui-ready .main,
body.ui-ready .login-card { animation: pageFadeUp .34s var(--ease-out) both; }
body.ui-ready .panel,
body.ui-ready .stat-card,
body.ui-ready .notification-card,
body.ui-ready .issue-description,
body.ui-ready .room-status-card,
body.ui-ready .login-form,
body.ui-ready .login-hero {
    animation: softEnter .36s var(--ease-out) both;
}

.btn,
.menu a,
.panel,
.stat-card,
.notification-card,
.issue-description,
.status-list div,
.table-wrap,
.badge,
input,
select,
textarea,
.id-card-photo-button,
.tenant-card,
.room-status-card {
    transition-property: transform, box-shadow, background-color, border-color, color, opacity, filter;
    transition-duration: var(--motion-normal);
    transition-timing-function: var(--ease-out);
}

.panel:hover,
.stat-card:hover,
.notification-card:hover,
.room-status-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 22px 55px rgba(15, 23, 42, .11);
}

.menu a:hover { transform: translateX(3px); }
.menu a.active { box-shadow: inset 4px 0 0 rgba(96, 165, 250, .92); }
.btn:active { transform: translateY(0) scale(.985); }
.btn:focus-visible,
.menu a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 3px solid rgba(37, 99, 235, .22);
    outline-offset: 2px;
}
.table-wrap tbody tr { transition: transform var(--motion-fast) var(--ease-out), background-color var(--motion-fast) var(--ease-out); }
.table-wrap tbody tr:hover { transform: translateX(2px); }
.table-wrap tbody tr:hover td { background: #f8fbff; }

.loading-overlay {
    position: fixed;
    inset: 0;
    z-index: 20000;
    display: grid;
    place-items: center;
    padding: 22px;
    background: rgba(15, 23, 42, .46);
    backdrop-filter: blur(7px);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity var(--motion-normal) ease, visibility var(--motion-normal) ease;
}
.loading-overlay.is-visible {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}
.loading-dialog {
    width: min(360px, calc(100vw - 32px));
    border-radius: 26px;
    background: rgba(255, 255, 255, .96);
    border: 1px solid rgba(226, 232, 240, .92);
    box-shadow: 0 32px 90px rgba(15, 23, 42, .26);
    padding: 28px 24px;
    text-align: center;
    transform: translateY(8px) scale(.98);
    transition: transform var(--motion-normal) var(--ease-out);
}
.loading-overlay.is-visible .loading-dialog { transform: translateY(0) scale(1); }
.loading-spinner {
    width: 54px;
    height: 54px;
    margin: 0 auto 14px;
    border-radius: 999px;
    border: 5px solid #dbeafe;
    border-top-color: var(--primary);
    animation: spin .78s linear infinite;
}
.loading-dialog strong {
    display: block;
    font-size: 18px;
    color: #0f172a;
    margin-bottom: 6px;
}
.loading-dialog span {
    display: block;
    color: var(--muted);
    line-height: 1.45;
}
body.is-loading { cursor: wait; }
body.is-loading .btn,
body.is-loading button,
form.is-submitting button[type="submit"] {
    cursor: wait;
}
form.is-submitting button[type="submit"] {
    opacity: .78;
    filter: saturate(.85);
}
.form-actions .btn.is-clicked,
.btn.is-clicked {
    position: relative;
    overflow: hidden;
}
.btn.is-clicked::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,.34), transparent);
    transform: translateX(-100%);
    animation: shimmer 900ms ease infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes shimmer { to { transform: translateX(100%); } }
@keyframes pageFadeUp {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes softEnter {
    from { opacity: 0; transform: translateY(8px) scale(.995); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

@media (max-width: 720px) {
    body.ui-ready .panel,
    body.ui-ready .stat-card,
    body.ui-ready .notification-card { animation-duration: .24s; }
    .panel:hover,
    .stat-card:hover,
    .notification-card:hover,
    .room-status-card:hover,
    .table-wrap tbody tr:hover,
    .menu a:hover { transform: none; }
    .loading-dialog { border-radius: 22px; padding: 24px 18px; }
    .loading-spinner { width: 48px; height: 48px; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: .001ms !important;
        animation-iteration-count: 1 !important;
        scroll-behavior: auto !important;
        transition-duration: .001ms !important;
    }
}

/* Liên hệ hỗ trợ sau khi đăng nhập */
.menu a.menu-support-phone {
    color: #ecfdf5;
    background: linear-gradient(135deg, rgba(5, 150, 105, .96), rgba(13, 148, 136, .88));
    border-color: rgba(255,255,255,.18);
    box-shadow: 0 14px 30px rgba(5,150,105,.18);
}
.menu a.menu-support-phone:hover {
    background: linear-gradient(135deg, #047857, #0f766e);
    transform: translateY(-1px);
}
.menu a.menu-support-phone b {
    margin-left: auto;
    font-size: 12px;
    padding: 4px 8px;
    border-radius: 999px;
    background: rgba(255,255,255,.16);
    color: #fff;
}

/* Nút cuộn lên đầu trang cho điện thoại */
.scroll-top-btn {
    position: fixed;
    right: 16px;
    bottom: calc(18px + env(safe-area-inset-bottom, 0px));
    z-index: 12000;
    width: 48px;
    height: 48px;
    border: 0;
    border-radius: 999px;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, var(--primary), #0f766e);
    color: #fff;
    font-weight: 900;
    font-size: 20px;
    box-shadow: 0 18px 38px rgba(15, 23, 42, .24);
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px) scale(.96);
    transition: opacity .2s ease, visibility .2s ease, transform .2s ease;
    cursor: pointer;
}
.scroll-top-btn.is-visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}
.scroll-top-btn:active { transform: translateY(1px) scale(.96); }

@media (min-width: 769px) {
    .scroll-top-btn { display: none; }
}

@media (max-width: 420px) {
    .menu a.menu-support-phone {
        align-items: flex-start;
        flex-wrap: wrap;
        line-height: 1.2;
    }
    .menu a.menu-support-phone b {
        margin-left: 34px;
        width: fit-content;
    }
    .scroll-top-btn {
        right: 14px;
        bottom: calc(14px + env(safe-area-inset-bottom, 0px));
        width: 44px;
        height: 44px;
        font-size: 18px;
    }
}

/* Popup/toast luôn bám theo màn hình khi cuộn */
.toast-fixed-viewport,
.flash-wrap,
.flash-login,
.notify-toast-wrap {
    position: fixed !important;
    transform: translateZ(0);
    will-change: transform;
    backface-visibility: hidden;
}
.flash-wrap,
.flash-login {
    z-index: 30000;
    pointer-events: none;
}
.flash-wrap .toast-pop,
.flash-login .toast-pop,
.notify-toast-wrap .notify-toast {
    pointer-events: auto;
}
.notify-toast-wrap {
    z-index: 30010;
}
@media (max-width: 720px) {
    .flash-wrap,
    .flash-login {
        top: calc(10px + env(safe-area-inset-top, 0px));
        right: 10px;
        width: calc(100vw - 20px);
    }
    .notify-toast-wrap {
        top: calc(72px + env(safe-area-inset-top, 0px));
    }
}

/* Khóa thân thiện khi khách thuê chưa hoàn thiện hồ sơ */
.tenant-profile-lock .menu-zalo-link,
.tenant-profile-lock .post-login-zalo-banner,
.tenant-profile-lock .zalo-card {
    display: none !important;
}
.profile-gate-hero {
    display: grid;
    grid-template-columns: 64px minmax(0, 1fr);
    gap: 16px;
    align-items: center;
    margin-bottom: 18px;
    padding: 20px;
    border-radius: 24px;
    background: linear-gradient(135deg, #eff6ff, #ecfdf5);
    border: 1px solid rgba(59, 130, 246, .22);
    box-shadow: var(--shadow);
}
.profile-gate-icon {
    width: 64px;
    height: 64px;
    border-radius: 22px;
    display: grid;
    place-items: center;
    color: #fff;
    font-size: 30px;
    background: linear-gradient(135deg, var(--primary), #0f766e);
    box-shadow: 0 18px 32px rgba(37, 99, 235, .20);
}
.profile-gate-hero span {
    display: inline-flex;
    margin-bottom: 6px;
    color: var(--primary);
    font-size: 12px;
    font-weight: 900;
    letter-spacing: .08em;
    text-transform: uppercase;
}
.profile-gate-hero h2 {
    margin: 0 0 8px;
    font-size: 22px;
    color: #0f172a;
}
.profile-gate-hero p {
    margin: 0;
    color: #475569;
    line-height: 1.55;
}
@media (max-width: 720px) {
    .profile-gate-hero {
        grid-template-columns: 1fr;
        padding: 18px;
        border-radius: 20px;
    }
    .profile-gate-icon {
        width: 52px;
        height: 52px;
        border-radius: 18px;
        font-size: 25px;
    }
    .profile-gate-hero h2 {
        font-size: 19px;
    }
}

/* Footer website: hiển thị gọn, rõ ràng trên mọi thiết bị */
.main {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}
.site-footer {
    margin-top: auto;
    padding: 18px 20px;
    border-radius: 24px;
    border: 1px solid rgba(219, 231, 228, .92);
    background:
        radial-gradient(circle at 0% 0%, rgba(45, 212, 191, .16), transparent 32%),
        linear-gradient(135deg, rgba(255,255,255,.92), rgba(240,253,250,.84));
    box-shadow: 0 14px 34px rgba(15, 118, 110, .08);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    color: #334155;
}
.site-footer-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}
.site-footer-logo {
    width: 42px;
    height: 42px;
    border-radius: 16px;
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    background: linear-gradient(135deg, #2dd4bf, #0ea5e9);
    box-shadow: 0 12px 24px rgba(15, 118, 110, .16);
    font-size: 21px;
}
.site-footer-brand strong {
    display: block;
    color: #0f172a;
    font-size: 15px;
    line-height: 1.25;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.site-footer-brand small {
    display: block;
    margin-top: 3px;
    color: var(--muted);
    font-weight: 800;
}
.site-footer-info {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    flex-wrap: wrap;
    text-align: right;
    font-size: 13px;
    font-weight: 800;
    color: var(--muted);
}
.site-footer-info span,
.site-footer-info a {
    display: inline-flex;
    align-items: center;
    min-height: 34px;
    padding: 8px 11px;
    border-radius: 999px;
    background: rgba(255,255,255,.72);
    border: 1px solid rgba(204, 251, 241, .92);
}
.site-footer-info a {
    color: #047857;
    background: #ecfdf5;
}
.site-footer-info a:hover {
    color: #065f46;
    transform: translateY(-1px);
}

.login-page-minimal {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 16px;
}
.login-site-footer {
    position: relative;
    z-index: 1;
    width: min(1120px, 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
    padding: 13px 16px;
    border-radius: 22px;
    color: rgba(255,255,255,.92);
    background: rgba(255,255,255,.10);
    border: 1px solid rgba(255,255,255,.16);
    backdrop-filter: blur(14px);
    box-shadow: 0 16px 38px rgba(0,0,0,.14);
    text-align: center;
    font-size: 13px;
    font-weight: 800;
}
.login-site-footer strong {
    color: #fff;
    font-size: 14px;
}
.login-site-footer span,
.login-site-footer a {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 5px 9px;
    border-radius: 999px;
    background: rgba(255,255,255,.10);
    color: rgba(255,255,255,.90);
}
.login-site-footer a {
    color: #a7f3d0;
}

@media (max-width: 760px) {
    .site-footer {
        margin-top: 16px;
        padding: 15px;
        border-radius: 20px;
        flex-direction: column;
        align-items: stretch;
        text-align: center;
    }
    .site-footer-brand {
        justify-content: center;
    }
    .site-footer-brand strong {
        white-space: normal;
    }
    .site-footer-info {
        justify-content: center;
        text-align: center;
        gap: 8px;
    }
    .site-footer-info span,
    .site-footer-info a {
        width: 100%;
        justify-content: center;
        border-radius: 14px;
    }
    .login-site-footer {
        width: 100%;
        border-radius: 18px;
        padding: 12px;
        gap: 7px;
    }
    .login-site-footer strong,
    .login-site-footer span,
    .login-site-footer a {
        width: 100%;
        justify-content: center;
    }
}

@media (max-width: 420px) {
    .site-footer-logo {
        width: 38px;
        height: 38px;
        border-radius: 14px;
        font-size: 19px;
    }
    .site-footer-brand strong {
        font-size: 14px;
    }
    .site-footer-info {
        font-size: 12.5px;
    }
}

/* Advanced modules: backup, pagination, charts */
.pagination{display:flex;gap:8px;justify-content:center;align-items:center;margin-top:18px;flex-wrap:wrap}.page-link,.page-ellipsis{min-width:36px;height:36px;border-radius:12px;display:inline-flex;align-items:center;justify-content:center;border:1px solid rgba(15,118,110,.18);background:#fff;color:#0f766e;text-decoration:none;font-weight:800}.page-link.active{background:linear-gradient(135deg,#0f766e,#0891b2);color:#fff;box-shadow:0 12px 28px rgba(8,145,178,.22)}.report-charts-panel{overflow:hidden}.simple-chart{height:260px;display:grid;grid-template-columns:repeat(6,1fr);gap:14px;align-items:end;padding:18px 8px 6px}.simple-chart-col{height:100%;display:flex;flex-direction:column;justify-content:flex-end;align-items:center;gap:8px}.simple-chart-bars{height:210px;width:100%;display:flex;align-items:flex-end;justify-content:center;gap:6px;border-bottom:1px solid rgba(15,118,110,.16);background:linear-gradient(180deg,rgba(20,184,166,.07),transparent);border-radius:14px 14px 4px 4px;padding:8px 6px 0}.simple-chart .bar{width:22px;min-height:4px;border-radius:12px 12px 3px 3px;transition:height .35s ease,transform .2s ease}.simple-chart .bar:hover{transform:translateY(-3px)}.simple-chart .bar.billed{background:linear-gradient(180deg,#38bdf8,#0284c7)}.simple-chart .bar.paid{background:linear-gradient(180deg,#34d399,#0f766e)}.chart-legend{display:flex;gap:18px;flex-wrap:wrap;align-items:center;justify-content:center;color:#475569;font-size:.9rem}.chart-legend i{display:inline-block;width:12px;height:12px;border-radius:4px;margin-right:6px;vertical-align:-1px}.legend-billed{background:#0284c7}.legend-paid{background:#0f766e}.mini-bars{display:grid;gap:14px}.mini-bar-row{display:grid;grid-template-columns:minmax(100px,1fr) 42px minmax(120px,2fr);gap:10px;align-items:center}.mini-bar-row span{font-weight:700;color:#334155}.mini-bar-row strong{color:#0f766e}.mini-bar-row div{height:12px;background:#e2e8f0;border-radius:999px;overflow:hidden}.mini-bar-row i{display:block;height:100%;background:linear-gradient(90deg,#14b8a6,#0ea5e9);border-radius:999px}.muted{color:#64748b}.badge-info{background:#e0f2fe;color:#0369a1}.badge-warning{background:#fef3c7;color:#92400e}.badge-paid{background:#dcfce7;color:#166534}.field input[readonly]{background:#f8fafc;color:#475569}.backup-warning{border-left:4px solid #f59e0b}.checkout-calc:focus{box-shadow:0 0 0 4px rgba(14,165,233,.14)}
@media (max-width: 720px){.simple-chart{height:220px;gap:8px;overflow-x:auto;grid-template-columns:repeat(6,minmax(80px,1fr))}.simple-chart-bars{height:170px}.simple-chart .bar{width:18px}.mini-bar-row{grid-template-columns:1fr 38px;gap:8px}.mini-bar-row div{grid-column:1 / -1}.pagination{justify-content:flex-start;overflow-x:auto;padding-bottom:4px}}
.secure-id-card{position:relative;overflow:hidden}.secure-id-card:after{content:"Chỉ dùng cho quản lý nhà trọ Trân Ánh Liên";position:absolute;left:50%;top:50%;transform:translate(-50%,-50%) rotate(-18deg);font-weight:900;color:rgba(15,23,42,.20);font-size:clamp(1rem,3vw,2.2rem);pointer-events:none;white-space:nowrap;text-shadow:0 1px 0 rgba(255,255,255,.25)}

/* Report chart simplified: only electricity usage current month vs previous month */
.electricity-report-panel { overflow: hidden; }
.electricity-summary-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
    margin: 16px 0 6px;
}
.electricity-summary-card {
    padding: 16px;
    border-radius: 18px;
    border: 1px solid rgba(15, 118, 110, .14);
    background: linear-gradient(135deg, #ffffff, #f8fafc);
    box-shadow: 0 14px 32px rgba(15, 23, 42, .06);
}
.electricity-summary-card span { display: block; color: #64748b; font-weight: 900; font-size: 13px; margin-bottom: 6px; }
.electricity-summary-card strong { display: block; color: #0f172a; font-size: clamp(22px, 3vw, 32px); letter-spacing: -.04em; }
.electricity-summary-card small { display: block; color: #64748b; margin-top: 6px; line-height: 1.45; }
.electricity-summary-card.current { background: linear-gradient(135deg, #ecfeff, #ffffff); border-color: rgba(8, 145, 178, .22); }
.electricity-summary-card.diff.up strong { color: #dc2626; }
.electricity-summary-card.diff.down strong { color: #059669; }
.simple-chart.electricity-chart {
    grid-template-columns: repeat(2, minmax(130px, 1fr));
    max-width: 640px;
    margin: 8px auto 0;
    height: 260px;
}
.electricity-chart-bars { height: 205px; }
.simple-chart .bar.electric { width: min(58px, 42%); }
.simple-chart .bar.electric.previous { background: linear-gradient(180deg, #93c5fd, #2563eb); }
.simple-chart .bar.electric.current { background: linear-gradient(180deg, #5eead4, #0f766e); }
.legend-electric-previous { background: #2563eb; }
.legend-electric-current { background: #0f766e; }

/* Extra mobile/tablet smoothness and usability */
html { scroll-behavior: smooth; }
body { overflow-x: hidden; text-rendering: optimizeLegibility; }
img { max-width: 100%; height: auto; }
a, button, .btn, input, select, textarea { -webkit-tap-highlight-color: transparent; }
@media (hover: none) {
    .btn:hover, .panel:hover, .stat-card:hover, .table-wrap tbody tr:hover { transform: none !important; }
}
@media (max-width: 1024px) {
    .sidebar { overflow-y: auto; overscroll-behavior: contain; padding-bottom: calc(18px + env(safe-area-inset-bottom)); }
    .menu a { min-height: 44px; display: flex; align-items: center; gap: 10px; }
    .main { max-width: 100vw; overflow-x: hidden; }
    .panel, .stat-card { box-shadow: 0 12px 30px rgba(15, 23, 42, .07); }
    .filters { align-items: stretch; }
    .filters input, .filters select, .filters .btn, .filters a.btn { min-height: 44px; }
}
@media (max-width: 840px) {
    .stats-grid, .stats-grid.small, .grid-2, .grid-3, .form-grid, .electricity-summary-grid { grid-template-columns: 1fr; }
    .panel-head { align-items: flex-start; }
    .panel-head.stack-mobile { flex-direction: column; align-items: stretch; }
    .form-actions, .inline-actions, .row-actions { align-items: stretch; }
    .form-actions .btn, .inline-actions .btn, .row-actions .btn, .row-actions a.btn { width: 100%; }
    .simple-chart.electricity-chart { height: 230px; grid-template-columns: repeat(2, minmax(120px, 1fr)); }
    .electricity-chart-bars { height: 170px; }
}
@media (max-width: 640px) {
    .panel { padding: 14px; margin-bottom: 14px; }
    .stat-card { padding: 15px; }
    .stat-card strong { font-size: 24px; }
    .filters { display: grid; grid-template-columns: 1fr; gap: 9px; }
    .filters input, .filters select, .filters button, .filters a.btn { width: 100%; min-width: 0; }
    input, select, textarea { font-size: 16px; min-height: 44px; }
    .btn { min-height: 44px; border-radius: 14px; }
    .table-wrap { max-height: 72vh; border-radius: 14px; }
    .table-wrap table { min-width: 680px; }
    .flash-wrap.toast-fixed-viewport, .notify-toast-wrap { left: 10px; right: 10px; max-width: none; }
    .site-footer { margin-top: 18px; padding: 14px; border-radius: 18px; }
}


/* Final UX cleanup: tiền tệ gọn, menu ổn định, footer sát đáy và popup thân thiện */
.app-shell { min-height: 100svh; }
.main { min-height: 100svh; display: flex; flex-direction: column; }
.main > footer.site-footer { margin-top: auto; }
.site-footer { margin-bottom: 0; }

.menu a.active {
    background: rgba(255,255,255,.16);
    color: #fff;
    border-color: rgba(255,255,255,.20);
}
.menu a.active::before {
    content: "";
    position: absolute;
    left: 4px;
    top: 50%;
    width: 4px;
    height: 60%;
    transform: translateY(-50%);
    border-radius: 999px;
    background: linear-gradient(180deg, #2dd4bf, #60a5fa);
}

.toast-pop {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: start;
    gap: 10px;
    padding: 14px 12px 14px 14px;
    line-height: 1.45;
}
.toast-icon {
    width: 30px;
    height: 30px;
    display: grid;
    place-items: center;
    border-radius: 12px;
    background: rgba(255,255,255,.65);
    box-shadow: inset 0 0 0 1px rgba(255,255,255,.42);
}
.toast-message {
    overflow-wrap: anywhere;
}
.toast-close {
    position: static;
    flex: 0 0 auto;
}
.notify-toast {
    border: 1px solid rgba(226,232,240,.92);
}
.notify-actions a {
    border-radius: 999px;
    padding: 7px 10px;
    background: #0f766e;
    color: #fff !important;
    font-weight: 900;
}

/* Trải nghiệm người mới: khoảng cách và thao tác cảm ứng rõ hơn */
.field small, .hint { line-height: 1.55; }
.panel-head p, .empty-state p { line-height: 1.6; }
input[type=number] { font-variant-numeric: tabular-nums; }

@media (max-width: 1100px) {
    .sidebar { scroll-padding: 84px 0; }
    .menu a { min-height: 48px; }
}

@media (max-width: 760px) {
    .main { min-height: 100svh; }
    .site-footer {
        margin-top: auto;
        margin-left: -2px;
        margin-right: -2px;
        padding: 13px 12px;
        gap: 8px;
    }
    .site-footer-logo { width: 34px; height: 34px; border-radius: 13px; font-size: 18px; }
    .site-footer-brand small, .site-footer-info { font-size: 12px; }
    .panel, .stat-card, .notification-card { box-shadow: 0 10px 24px rgba(15, 23, 42, .07); }
    .btn, input, select, textarea { min-height: 44px; }
    .row-actions, .inline-actions { gap: 7px; }
    .row-actions .btn, .inline-actions .btn { flex: 1 1 auto; }
    .notification-card { grid-template-columns: 1fr; }
    .notification-actions { justify-content: stretch; }
    .notification-actions .btn, .notification-actions form, .notification-actions button { width: 100%; }
}

@media (max-width: 480px) {
    .flash-wrap, .flash-login, .notify-toast-wrap { width: calc(100vw - 16px); right: 8px; }
    .toast-pop { border-radius: 16px; }
    .panel { padding: 14px; }
    .form-actions { display: grid; grid-template-columns: 1fr; }
}


/* Cleanup 2026-06: đồng bộ component, mã bảo mật nổi bật và thao tác mượt hơn */
.main { gap: 0; }
.main > .panel,
.main > .dashboard-hero,
.main > .stats-grid,
.main > .grid-2,
.main > .grid-3,
.main > form,
.main > .filters,
.main > .table-scroll-hint,
.main > .empty-state { flex: 0 0 auto; }
.panel,
.stat-card,
.form-card,
.notification-card,
.issue-card,
.login-card,
.dashboard-hero,
.hero-mini-card {
    box-sizing: border-box;
    max-width: 100%;
}
.panel,
.form-card,
.notification-card,
.stat-card {
    overflow-wrap: anywhere;
}
.panel + .panel,
.table-wrap + .panel,
.grid-2 + .panel,
.stats-grid + .panel { margin-top: 2px; }

.menu a.security-menu-link {
    position: relative;
    color: #ecfeff;
    background: linear-gradient(135deg, rgba(20, 184, 166, .26), rgba(59, 130, 246, .24));
    border: 1px solid rgba(94, 234, 212, .38);
    box-shadow: 0 12px 28px rgba(20, 184, 166, .16);
}
.menu a.security-menu-link span {
    display: inline-grid;
    place-items: center;
    width: 28px;
    height: 28px;
    border-radius: 12px;
    background: rgba(255,255,255,.16);
}
.menu a.security-menu-link::after {
    content: none;
    margin-left: auto;
    font-size: 10px;
    font-weight: 900;
    letter-spacing: .02em;
    padding: 4px 7px;
    border-radius: 999px;
    color: #064e3b;
    background: #a7f3d0;
}
.menu a.security-menu-link:hover,
.menu a.security-menu-link.active {
    color: #fff;
    background: linear-gradient(135deg, #0f766e, #2563eb);
    transform: translateX(3px);
}
.menu a.security-menu-link.active::after { background: #fff; color: #0f766e; }

.security-key-panel .friendly-note {
    border: 1px solid rgba(20, 184, 166, .24);
    background: linear-gradient(135deg, #ecfdf5, #eff6ff);
}
.security-key-panel input[name="security_key"],
.security-key-panel input[name="confirm_security_key"],
.login-form input[name="security_key"] {
    letter-spacing: .28em;
    font-weight: 900;
    font-variant-numeric: tabular-nums;
    text-align: center;
}

/* Dọn dẹp bố cục để box không dính/đè nhau trên nhiều thiết bị */
.form-grid,
.filters,
.row-actions,
.inline-actions,
.form-actions,
.panel-head,
.stats-grid,
.grid-2,
.grid-3 { min-width: 0; }
.field,
.field input,
.field select,
.field textarea { min-width: 0; }
.table-wrap { contain: layout paint; }
.table-wrap table { border-collapse: separate; border-spacing: 0; }
.table-wrap th,
.table-wrap td { vertical-align: middle; }
.btn { white-space: nowrap; }
.row-actions .btn,
.inline-actions .btn { white-space: normal; }

/* Hiệu năng: giảm animation nặng ở thiết bị cảm ứng và khi người dùng cuộn nhiều */
@media (hover: none), (pointer: coarse) {
    .panel,
    .stat-card,
    .dashboard-hero,
    .notification-card,
    .menu a,
    .btn { transition-duration: .12s !important; }
    .panel:hover,
    .stat-card:hover,
    .notification-card:hover { transform: none !important; }
}

@media (max-width: 980px) {
    .topbar { gap: 12px; }
    .panel-head { gap: 12px; }
    .panel-head > * { min-width: 0; }
    .btn { min-height: 46px; }
}
@media (max-width: 640px) {
    .main { padding-bottom: 0; }
    .panel,
    .dashboard-hero,
    .stat-card,
    .form-card,
    .notification-card { border-radius: 18px; }
    .panel-head h2,
    .panel h2 { font-size: 18px; line-height: 1.25; }
    .topbar-title h1 { line-height: 1.2; }
    .menu a.security-menu-link::after { content: none; }
    .btn { width: 100%; justify-content: center; }
    .top-actions .btn { width: auto; }
}

/* Cập nhật giao diện đồng bộ sau rà soát */
.dashboard-summary-strip {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 18px;
}
.summary-tile {
    border: 1px solid rgba(15, 118, 110, .12);
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
    border-radius: 22px;
    padding: 18px;
    box-shadow: 0 18px 42px rgba(15, 23, 42, .06);
    min-width: 0;
}
.summary-tile span { display: block; color: #64748b; font-weight: 800; font-size: .9rem; margin-bottom: 8px; }
.summary-tile strong { display: block; color: #0f172a; font-size: clamp(22px, 4vw, 34px); line-height: 1; letter-spacing: -.03em; }
.summary-tile small { display: block; color: #64748b; margin-top: 8px; font-weight: 700; }
.summary-primary { background: linear-gradient(135deg, #ecfdf5, #eff6ff); border-color: rgba(20, 184, 166, .22); }
.summary-warning { background: linear-gradient(135deg, #fffbeb, #fff7ed); border-color: rgba(245, 158, 11, .28); }
.summary-info { background: linear-gradient(135deg, #eff6ff, #f5f3ff); border-color: rgba(59, 130, 246, .22); }

.menu a.menu-utility-link,
.menu a.security-menu-link,
.menu a.menu-zalo-link,
.menu a.menu-support-phone {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 46px;
    color: #e0f2fe;
    background: rgba(255, 255, 255, .08);
    border: 1px solid rgba(255, 255, 255, .12);
    box-shadow: none;
}
.menu a.menu-utility-link span,
.menu a.security-menu-link span,
.menu a.menu-zalo-link span,
.menu a.menu-support-phone span {
    display: inline-grid;
    place-items: center;
    width: 28px;
    height: 28px;
    border-radius: 10px;
    background: rgba(255,255,255,.12);
    flex: 0 0 auto;
}
.menu a.security-menu-link::after { content: none !important; display: none !important; }
.menu a.menu-utility-link:hover,
.menu a.menu-utility-link.active,
.menu a.security-menu-link:hover,
.menu a.security-menu-link.active,
.menu a.menu-zalo-link:hover,
.menu a.menu-support-phone:hover {
    color: #fff;
    background: rgba(20, 184, 166, .22);
    border-color: rgba(94, 234, 212, .34);
    transform: translateX(3px);
}

.pin-code-input {
    width: min(100%, 430px) !important;
    max-width: 430px;
    height: 58px;
    font-size: 24px !important;
    font-weight: 900 !important;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
    text-align: center;
    letter-spacing: .56em !important;
    padding: 0 0 0 .56em !important;
    border-radius: 18px !important;
    border: 1px solid rgba(15, 118, 110, .24) !important;
    background:
        linear-gradient(#fff, #fff) padding-box,
        repeating-linear-gradient(90deg, rgba(15, 118, 110, .22) 0 1px, transparent 1px 12.5%) border-box;
    box-shadow: inset 0 0 0 999px rgba(248, 250, 252, .68), 0 12px 28px rgba(15, 118, 110, .08);
}
.pin-code-input:focus {
    border-color: #0f766e !important;
    box-shadow: 0 0 0 4px rgba(20, 184, 166, .16), 0 12px 28px rgba(15, 118, 110, .10) !important;
}
.security-key-panel .friendly-note,
.warning-note,
.config-source-note,
.age-rule-note,
.backup-warning,
.menu-lock-note {
    border-left: 4px solid #f59e0b !important;
    background: #fffbeb !important;
    color: #78350f !important;
}
.security-key-panel .friendly-note strong,
.warning-note strong,
.config-source-note strong,
.age-rule-note strong { color: #b45309 !important; }
.urgent-panel,
.flash-danger,
.flash-warning { border-left-width: 5px; }
.flash-danger { background: #fef2f2 !important; color: #991b1b !important; }
.flash-warning { background: #fffbeb !important; color: #92400e !important; }

.config-locked,
.field input.config-locked[readonly] {
    background: #f1f5f9 !important;
    color: #334155 !important;
    cursor: not-allowed;
    border-style: dashed !important;
}
.config-source-note {
    padding: 12px 14px;
    border-radius: 14px;
    line-height: 1.45;
}

.user-table-panel { overflow: hidden; }
.user-table-panel .table-wrap { width: 100%; max-width: 100%; }
.user-table-panel table { min-width: 960px; }
.user-table-panel .row-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    min-width: 210px;
}
.user-table-panel .row-actions form { margin: 0; }
.user-table-panel .row-actions .btn { min-height: 38px; padding: 9px 12px; }

@media (max-width: 980px) {
    .dashboard-summary-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
    .dashboard-summary-strip { grid-template-columns: 1fr; gap: 12px; }
    .summary-tile { border-radius: 18px; padding: 16px; }
    .pin-code-input { max-width: 100%; height: 54px; font-size: 22px !important; letter-spacing: .42em !important; padding-left: .42em !important; }
    .user-table-panel table { min-width: 0; }
    .user-table-panel .row-actions { min-width: 0; }
}

/* Cleanup: readonly values auto-synced from configuration */
.readonly-input, input[readonly].readonly-input {
    background: #f8fafc;
    border-color: rgba(148, 163, 184, 0.45);
    color: #334155;
    cursor: not-allowed;
}

/* Dashboard gọn lại sau khi bỏ các thống kê trùng lặp ở dải trên */
.stats-grid.stats-grid-refresh {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
    align-items: stretch;
}
.stats-grid.stats-grid-refresh .stat-card-refresh {
    min-height: 150px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}
.stats-grid.stats-grid-refresh .stat-card-refresh strong {
    font-size: clamp(24px, 3vw, 34px);
}

/* Làm nổi bật 3 nút liên kết nhanh trong menu */
.menu-feature-actions {
    display: grid;
    gap: 10px;
    padding: 10px;
    margin: 2px 0 4px;
    border-radius: 22px;
    background: linear-gradient(180deg, rgba(255,255,255,.10), rgba(255,255,255,.04));
    border: 1px solid rgba(255,255,255,.12);
    box-shadow: inset 0 1px 0 rgba(255,255,255,.10), 0 18px 34px rgba(0,0,0,.18);
}
.menu a.menu-feature-link,
.menu a.menu-utility-link.menu-feature-link,
.menu a.security-menu-link.menu-feature-link,
.menu a.menu-zalo-link.menu-feature-link,
.menu a.menu-support-phone.menu-feature-link {
    min-height: 54px;
    padding: 12px 13px;
    border-radius: 18px;
    color: #fff;
    border: 1px solid rgba(255,255,255,.22);
    box-shadow: 0 14px 30px rgba(0,0,0,.18);
    position: relative;
    isolation: isolate;
    overflow: hidden;
}
.menu a.menu-feature-link::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    background: radial-gradient(circle at 16% 12%, rgba(255,255,255,.30), transparent 30%);
    opacity: .9;
}
.menu a.menu-feature-link span {
    width: 32px;
    height: 32px;
    display: inline-grid;
    place-items: center;
    flex: 0 0 auto;
    border-radius: 13px;
    background: rgba(255,255,255,.18);
    box-shadow: inset 0 1px 0 rgba(255,255,255,.16);
}
.menu a.menu-feature-link strong {
    min-width: 0;
    font-size: 14px;
    line-height: 1.2;
    letter-spacing: -.01em;
}
.menu a.security-menu-link.menu-feature-link {
    background: linear-gradient(135deg, #0f766e, #2563eb);
}
.menu a.menu-zalo-link.menu-feature-link {
    background: linear-gradient(135deg, #0068ff, #0ea5e9);
}
.menu a.menu-support-phone.menu-feature-link {
    background: linear-gradient(135deg, #059669, #0f766e);
}
.menu a.menu-feature-link:hover,
.menu a.menu-feature-link.active {
    transform: translateX(4px) translateY(-1px);
    border-color: rgba(255,255,255,.36);
    box-shadow: 0 18px 36px rgba(0,0,0,.24), inset 0 0 0 1px rgba(255,255,255,.08);
}
.menu a.menu-feature-link b {
    margin-left: auto;
    font-size: 11px;
    padding: 4px 7px;
    border-radius: 999px;
    background: rgba(255,255,255,.18);
    color: #fff;
    white-space: nowrap;
}
.menu a.security-menu-link.menu-feature-link::after { content: none !important; display: none !important; }

@media (max-width: 1100px) {
    .stats-grid.stats-grid-refresh { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
    .stats-grid.stats-grid-refresh { grid-template-columns: 1fr; }
    .menu-feature-actions { padding: 8px; border-radius: 18px; }
    .menu a.menu-feature-link { min-height: 50px; }
}
.menu-feature-actions { grid-column: 1 / -1; }
.menu a.menu-feature-link { width: 100%; }

/* Responsive table normalization: dùng một chuẩn cuộn ngang/dọc cho mọi role và mọi thiết bị. */
.table-wrap {
    display: block;
    width: 100%;
    max-width: 100%;
    overflow: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}
.table-wrap table {
    width: 100%;
    min-width: 760px;
    table-layout: auto;
}
.table-wrap th,
.table-wrap td {
    white-space: nowrap;
    line-height: 1.45;
}
.table-wrap td strong,
.table-wrap td small,
.table-wrap td a {
    max-width: 320px;
}
.table-wrap td small {
    display: inline-block;
    white-space: normal;
    overflow-wrap: anywhere;
}
.table-wrap .row-actions,
.table-wrap .inline-actions {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    min-width: max-content;
}
.table-wrap .row-actions form,
.table-wrap .inline-actions form {
    margin: 0;
    display: inline-flex;
}
.table-wrap .row-actions .btn,
.table-wrap .row-actions a.btn,
.table-wrap .inline-actions .btn,
.table-wrap .inline-actions a.btn,
.table-wrap td .btn,
.table-wrap td a.btn {
    width: auto;
    min-height: 36px;
    padding: 8px 11px;
    white-space: nowrap;
}
.table-wrap .empty {
    white-space: normal;
}
.notification-detail-content {
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
}
.menu-support-phone b { display: none !important; }

@media (max-width: 1024px) {
    .main { overflow-x: hidden; }
    .table-wrap {
        max-height: min(72vh, 620px);
        border-radius: 14px;
    }
    .table-wrap table { min-width: 720px; }
    .user-table-panel table { min-width: 960px; }
    .reports-table table,
    .expenses-table table,
    .tenant-roommates-table table { min-width: 760px; }
}

@media (max-width: 840px) {
    .table-wrap .row-actions,
    .table-wrap .inline-actions {
        align-items: center;
        justify-content: flex-start;
    }
    .table-wrap .row-actions .btn,
    .table-wrap .row-actions a.btn,
    .table-wrap .inline-actions .btn,
    .table-wrap .inline-actions a.btn,
    .table-wrap td .btn,
    .table-wrap td a.btn {
        width: auto !important;
        min-width: 0;
    }
}

@media (max-width: 560px) {
    .mobile-table-card {
        overflow: auto !important;
        max-height: 72vh !important;
        border: 1px solid rgba(226, 232, 240, .92) !important;
        border-radius: 14px !important;
        background: #fff !important;
    }
    .mobile-table-card table {
        display: table !important;
        width: 100% !important;
        min-width: 720px !important;
        border-collapse: separate !important;
        border-spacing: 0 !important;
    }
    .mobile-table-card thead { display: table-header-group !important; }
    .mobile-table-card tbody { display: table-row-group !important; }
    .mobile-table-card tr {
        display: table-row !important;
        margin: 0 !important;
        padding: 0 !important;
        border: 0 !important;
        border-radius: 0 !important;
        background: transparent !important;
        box-shadow: none !important;
    }
    .mobile-table-card th,
    .mobile-table-card td {
        display: table-cell !important;
        width: auto !important;
        min-width: 0 !important;
        padding: 10px 9px !important;
        border-bottom: 1px solid var(--line) !important;
        text-align: left !important;
        vertical-align: middle !important;
    }
    .mobile-table-card td::before { content: none !important; }
    .mobile-table-card .empty {
        display: table-cell !important;
        text-align: center !important;
    }
    .table-wrap table { min-width: 720px; }
    .user-table-panel table { min-width: 940px !important; }
    .table-wrap td strong,
    .table-wrap td small,
    .table-wrap td a { max-width: 260px; }
    .table-scroll-hint {
        font-size: 12px;
        justify-content: flex-start;
        margin-bottom: 8px;
    }
}

/* Đồng bộ header sticky toàn hệ thống sau khi đăng nhập */
.topbar {
    position: sticky;
    top: 14px;
    z-index: 820;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(226, 232, 240, .82);
    background: rgba(255, 255, 255, .94);
    box-shadow: 0 14px 32px rgba(15, 23, 42, .08);
}
.top-actions form[data-confirm-logout] { display: inline-flex; }
.top-action-logout .logout-icon { display: inline-flex; line-height: 1; font-size: 17px; }
.top-action-logout .logout-text { display: inline-flex; }

@media (max-width: 1024px) {
    .topbar {
        top: 8px;
        z-index: 1200;
        align-items: center;
    }
    .top-action-logout {
        color: #991b1b;
        border: 1px solid rgba(220, 38, 38, .24);
        background: #fee2e2;
    }
    .top-action-logout .logout-icon {
        font-size: 18px;
        filter: drop-shadow(0 1px 0 rgba(255,255,255,.7));
    }
}

@media (max-width: 760px) {
    .top-actions .top-action-logout::before { content: none !important; }
    .top-actions .top-action-profile::before { line-height: 1; }
    .top-actions .top-action-logout .logout-text { display: none !important; }
    .top-actions .top-action-logout .logout-icon { display: inline-flex !important; font-size: 19px; }
    .top-actions .top-action-logout {
        width: 40px !important;
        min-width: 40px !important;
        height: 40px !important;
        min-height: 40px !important;
        padding: 0 !important;
        font-size: 0 !important;
        border-radius: 14px !important;
    }
}

/* Popup xem CCCD/CMND: luôn căn giữa, không bị mất trên tablet/điện thoại */
.image-lightbox {
    position: fixed !important;
    inset: 0 !important;
    width: 100vw !important;
    height: 100dvh !important;
    min-height: 100vh !important;
    z-index: 2147483000 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: max(12px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left)) !important;
    overflow: auto !important;
}
.image-lightbox[hidden] { display: none !important; }
.image-lightbox-backdrop { position: fixed !important; inset: 0 !important; }
.image-lightbox-dialog {
    width: min(1080px, calc(100vw - 24px)) !important;
    max-width: calc(100vw - 24px) !important;
    max-height: calc(100dvh - 24px) !important;
    margin: auto !important;
    z-index: 1 !important;
}
.image-lightbox-dialog img {
    max-width: 100% !important;
    max-height: calc(100dvh - 132px) !important;
    object-fit: contain !important;
}
@media (max-width: 780px) {
    .image-lightbox { padding: 8px !important; }
    .image-lightbox-dialog {
        width: calc(100vw - 16px) !important;
        max-width: calc(100vw - 16px) !important;
        max-height: calc(100dvh - 16px) !important;
        border-radius: 16px !important;
        padding: 10px !important;
    }
    .image-lightbox-head {
        align-items: center !important;
        flex-direction: row !important;
    }
    .image-lightbox-head strong {
        font-size: 14px;
        line-height: 1.25;
        min-width: 0;
    }
    .image-lightbox-dialog img {
        max-height: calc(100dvh - 118px) !important;
        border-radius: 12px !important;
    }
}

/* Xem hóa đơn: không mất cột/dữ liệu trên điện thoại và tablet */
.print-page {
    overflow-x: hidden;
}
.invoice-paper {
    max-width: min(980px, calc(100vw - 24px));
    overflow: hidden;
}
.invoice-print-section {
    min-width: 0;
}
.invoice-items-scroll {
    width: 100%;
    max-width: 100%;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
    border: 1px solid rgba(226, 232, 240, .92);
    border-radius: 14px;
    background: #fff;
}
.invoice-items-scroll .print-table {
    width: 100%;
    min-width: 760px;
    margin: 0;
}
.invoice-items-scroll .print-table th,
.invoice-items-scroll .print-table td {
    white-space: nowrap;
}
.invoice-items-scroll .print-table td:nth-child(2) {
    white-space: normal;
    min-width: 190px;
    max-width: 280px;
    overflow-wrap: anywhere;
}
@media (max-width: 720px) {
    body.print-page {
        padding: 8px;
        background: #eef7f4;
    }
    .print-toolbar {
        position: sticky;
        top: 8px;
        z-index: 50;
        display: flex;
        gap: 8px;
        overflow-x: auto;
        max-width: 100%;
        padding: 8px;
        border-radius: 14px;
        background: rgba(255,255,255,.96);
        box-shadow: 0 12px 26px rgba(15,23,42,.10);
    }
    .print-toolbar .btn {
        flex: 0 0 auto;
        min-height: 38px;
        padding: 8px 11px;
        font-size: 13px;
    }
    .invoice-paper {
        max-width: 100%;
        width: 100%;
        padding: 14px !important;
        border-radius: 18px;
    }
    .invoice-print-head {
        gap: 10px;
    }
    .invoice-print-head h1 {
        font-size: 22px !important;
        line-height: 1.15;
    }
    .invoice-print-head p,
    .invoice-info-box p,
    .bank-print-info,
    .invoice-note-box p {
        overflow-wrap: anywhere;
        word-break: break-word;
    }
    .invoice-info-box {
        padding: 14px;
    }
    .invoice-info-box p {
        display: grid;
        grid-template-columns: 1fr;
        gap: 4px;
        align-items: start;
    }
    .invoice-summary-card div {
        align-items: flex-start;
        gap: 8px;
    }
    .invoice-summary-card strong {
        text-align: right;
        overflow-wrap: anywhere;
    }
    .invoice-qr-print {
        padding: 14px;
        gap: 14px;
    }
    .print-qr-card img {
        width: min(220px, 100%);
        margin-inline: auto;
        display: block;
    }
    .invoice-items-scroll .print-table { min-width: 720px !important; }
}

/* Bảng hóa đơn và các cột dài không vượt khung trên mobile/tablet */
.table-wrap td,
.table-wrap th { vertical-align: middle; }
.table-wrap td { overflow-wrap: anywhere; }
.table-wrap td .badge { white-space: nowrap; }
.invoices-table table { min-width: 920px; }
@media (max-width: 1024px) {
    .invoices-table table { min-width: 900px !important; }
    .table-wrap td,
    .table-wrap th { padding: 10px 9px; }
    .table-wrap .row-actions {
        gap: 6px;
    }
    .table-wrap .row-actions .btn,
    .table-wrap td .btn {
        min-height: 34px;
        padding: 7px 9px;
        font-size: 13px;
    }
}

/* Khi mở popup ảnh, tắt transform của khung chính để position:fixed bám đúng viewport thật. */
body.image-preview-open .main {
    transform: none !important;
    animation: none !important;
    filter: none !important;
    perspective: none !important;
}

/* Fix 2026-06-22: header mobile/tablet cố định theo màn hình + modal đăng xuất riêng */
body.confirm-modal-open { overflow: hidden; }
.app-confirm-modal {
    position: fixed;
    inset: 0;
    z-index: 2147483200;
    display: grid;
    place-items: center;
    padding: max(18px, env(safe-area-inset-top)) max(14px, env(safe-area-inset-right)) max(18px, env(safe-area-inset-bottom)) max(14px, env(safe-area-inset-left));
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity .16s ease, visibility .16s ease;
}
.app-confirm-modal[hidden] { display: none !important; }
.app-confirm-modal.is-visible {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}
.app-confirm-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, .56);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}
.app-confirm-box {
    position: relative;
    width: min(420px, calc(100vw - 28px));
    max-width: 100%;
    border-radius: 26px;
    border: 1px solid rgba(226, 232, 240, .95);
    background: rgba(255, 255, 255, .98);
    box-shadow: 0 34px 90px rgba(15, 23, 42, .30);
    padding: 24px;
    text-align: center;
    outline: none;
    transform: translateY(10px) scale(.97);
    transition: transform .18s var(--ease-out, ease);
}
.app-confirm-modal.is-visible .app-confirm-box { transform: translateY(0) scale(1); }
.app-confirm-icon {
    width: 58px;
    height: 58px;
    margin: 0 auto 14px;
    display: grid;
    place-items: center;
    border-radius: 20px;
    background: #fee2e2;
    color: #991b1b;
    font-size: 28px;
    box-shadow: inset 0 0 0 1px rgba(220, 38, 38, .14);
}
.app-confirm-content h2 {
    margin: 0 0 8px;
    color: #0f172a;
    font-size: 22px;
    letter-spacing: -.02em;
}
.app-confirm-content p {
    margin: 0;
    color: #475569;
    line-height: 1.55;
}
.app-confirm-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 22px;
}
.app-confirm-actions .btn { width: 100%; }

/* Fix hỗ trợ nhà trọ: liên kết thật, dễ bấm trên mọi thiết bị. */
.menu a.menu-support-phone { cursor: pointer; }
.menu a.menu-support-phone[aria-disabled="true"] { opacity: .7; pointer-events: none; }
.logout-confirm-icon .logout-svg {
    display: block;
    width: 30px;
    height: 30px;
}

@media (max-width: 1100px) {
    body.has-fixed-topbar .topbar {
        position: fixed !important;
        top: max(8px, env(safe-area-inset-top)) !important;
        left: max(10px, env(safe-area-inset-left)) !important;
        right: max(10px, env(safe-area-inset-right)) !important;
        width: auto !important;
        margin: 0 !important;
        z-index: 2147481000 !important;
        transform: translateZ(0);
    }
    body.has-fixed-topbar .main {
        padding-top: calc(var(--fixed-topbar-height, 68px) + 28px) !important;
    }
    body.has-fixed-topbar .flash-wrap.toast-fixed-viewport {
        top: calc(var(--fixed-topbar-height, 68px) + 18px) !important;
    }
}

@media (max-width: 760px) {
    body.has-fixed-topbar .main {
        padding-top: calc(var(--fixed-topbar-height, 58px) + 20px + env(safe-area-inset-top)) !important;
    }
    body.has-fixed-topbar .topbar {
        display: grid !important;
        grid-template-columns: 40px minmax(0, 1fr) auto !important;
        align-items: center !important;
        gap: 8px !important;
        padding: 8px 10px !important;
        border-radius: 18px !important;
        min-height: 56px !important;
        max-width: calc(100vw - 20px) !important;
    }
    body.has-fixed-topbar .topbar-title {
        grid-column: auto !important;
        min-width: 0 !important;
    }
    body.has-fixed-topbar .top-actions {
        grid-column: auto !important;
        width: auto !important;
        display: flex !important;
        flex-wrap: nowrap !important;
        align-items: center !important;
        justify-content: flex-end !important;
        gap: 6px !important;
        margin-left: 0 !important;
    }
    body.has-fixed-topbar .top-actions form {
        width: auto !important;
        display: inline-flex !important;
        margin: 0 !important;
    }
    body.has-fixed-topbar .top-action-profile,
    body.has-fixed-topbar .top-action-logout {
        width: 40px !important;
        min-width: 40px !important;
        height: 40px !important;
        min-height: 40px !important;
        padding: 0 !important;
        border-radius: 14px !important;
    }
    .app-confirm-box {
        width: min(380px, calc(100vw - 24px));
        border-radius: 24px;
        padding: 22px 18px 18px;
    }
    .app-confirm-actions { grid-template-columns: 1fr; }
}


/* Tránh animation transform của .main làm header fixed bị cuộn theo nội dung trên mobile/tablet. */
@media (max-width: 1100px) {
    body.has-fixed-topbar.ui-ready .main {
        animation: none !important;
        transform: none !important;
    }
}

/* Fix header action buttons mobile/tablet: icon đăng xuất rõ ràng + kích thước đồng bộ */
.logout-icon {
    align-items: center;
    justify-content: center;
}
.logout-svg {
    width: 20px;
    height: 20px;
    display: block;
    flex: 0 0 auto;
}
.top-action-profile,
.top-action-logout {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    white-space: nowrap;
}

@media (min-width: 761px) and (max-width: 1100px) {
    body.has-fixed-topbar .top-actions {
        display: inline-flex !important;
        align-items: center !important;
        gap: 8px !important;
    }
    body.has-fixed-topbar .top-actions form {
        display: inline-flex !important;
        margin: 0 !important;
    }
    body.has-fixed-topbar .top-action-profile,
    body.has-fixed-topbar .top-action-logout {
        width: 128px !important;
        min-width: 128px !important;
        height: 42px !important;
        min-height: 42px !important;
        padding: 0 14px !important;
        border-radius: 14px !important;
        font-size: 14px !important;
        font-weight: 900 !important;
        line-height: 1 !important;
    }
    body.has-fixed-topbar .top-action-logout .logout-text {
        display: inline-flex !important;
        font-size: 14px !important;
    }
    body.has-fixed-topbar .top-action-logout .logout-icon {
        display: inline-flex !important;
        font-size: 0 !important;
    }
    body.has-fixed-topbar .top-action-profile::before {
        content: none !important;
    }
}

@media (max-width: 760px) {
    body.has-fixed-topbar .topbar {
        grid-template-columns: 42px minmax(0, 1fr) auto !important;
        gap: 7px !important;
        padding: 8px 9px !important;
        min-height: 58px !important;
    }
    body.has-fixed-topbar .menu-toggle {
        width: 42px !important;
        min-width: 42px !important;
        height: 42px !important;
        min-height: 42px !important;
        border-radius: 14px !important;
        display: inline-grid !important;
        place-items: center !important;
    }
    body.has-fixed-topbar .top-actions {
        width: 172px !important;
        min-width: 172px !important;
        display: grid !important;
        grid-template-columns: 1fr 1fr !important;
        gap: 6px !important;
    }
    body.has-fixed-topbar .top-actions form {
        width: 100% !important;
        display: flex !important;
    }
    body.has-fixed-topbar .top-action-profile,
    body.has-fixed-topbar .top-action-logout,
    body.has-fixed-topbar .top-actions button {
        width: 83px !important;
        min-width: 83px !important;
        height: 42px !important;
        min-height: 42px !important;
        padding: 0 8px !important;
        border-radius: 14px !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        gap: 4px !important;
        font-size: 0 !important;
        line-height: 1 !important;
        box-shadow: none !important;
    }
    body.has-fixed-topbar .top-action-profile::before {
        content: "👤" !important;
        font-size: 16px !important;
        line-height: 1 !important;
        margin: 0 !important;
    }
    body.has-fixed-topbar .top-action-profile::after {
        content: "Tài khoản" !important;
        font-size: 11px !important;
        font-weight: 900 !important;
        letter-spacing: -.01em !important;
        line-height: 1 !important;
    }
    body.has-fixed-topbar .top-action-logout::before,
    body.has-fixed-topbar .top-action-logout::after {
        content: none !important;
    }
    body.has-fixed-topbar .top-action-logout {
        color: #ffffff !important;
        border: 1px solid rgba(185, 28, 28, .18) !important;
        background: linear-gradient(135deg, #dc2626, #991b1b) !important;
    }
    body.has-fixed-topbar .top-action-logout .logout-icon {
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        color: #fff !important;
        width: 18px !important;
        min-width: 18px !important;
        height: 18px !important;
        font-size: 0 !important;
    }
    body.has-fixed-topbar .top-action-logout .logout-svg {
        width: 18px !important;
        height: 18px !important;
        stroke-width: 2.3 !important;
    }
    body.has-fixed-topbar .top-action-logout .logout-text {
        display: inline-flex !important;
        color: #fff !important;
        font-size: 11px !important;
        font-weight: 950 !important;
        line-height: 1 !important;
    }
}

@media (max-width: 390px) {
    body.has-fixed-topbar .topbar {
        grid-template-columns: 40px minmax(0, 1fr) auto !important;
        gap: 6px !important;
        padding: 7px 8px !important;
    }
    body.has-fixed-topbar .menu-toggle {
        width: 40px !important;
        min-width: 40px !important;
        height: 40px !important;
        min-height: 40px !important;
    }
    body.has-fixed-topbar .top-actions {
        width: 148px !important;
        min-width: 148px !important;
        gap: 5px !important;
    }
    body.has-fixed-topbar .top-action-profile,
    body.has-fixed-topbar .top-action-logout,
    body.has-fixed-topbar .top-actions button {
        width: 71.5px !important;
        min-width: 71.5px !important;
        height: 40px !important;
        min-height: 40px !important;
        padding: 0 6px !important;
        gap: 3px !important;
    }
    body.has-fixed-topbar .top-action-profile::after {
        content: "Tài khoản" !important;
        font-size: 10px !important;
    }
    body.has-fixed-topbar .top-action-logout .logout-text {
        font-size: 10px !important;
    }
    body.has-fixed-topbar .top-action-logout .logout-icon,
    body.has-fixed-topbar .top-action-logout .logout-svg {
        width: 16px !important;
        min-width: 16px !important;
        height: 16px !important;
    }
}

@media (max-width: 340px) {
    body.has-fixed-topbar .top-actions {
        width: 132px !important;
        min-width: 132px !important;
    }
    body.has-fixed-topbar .top-action-profile,
    body.has-fixed-topbar .top-action-logout,
    body.has-fixed-topbar .top-actions button {
        width: 63.5px !important;
        min-width: 63.5px !important;
    }
    body.has-fixed-topbar .top-action-profile::after {
        content: "TK" !important;
        font-size: 10px !important;
    }
    body.has-fixed-topbar .top-action-logout .logout-text {
        font-size: 0 !important;
    }
    body.has-fixed-topbar .top-action-logout::after {
        content: "Thoát" !important;
        display: inline-flex !important;
        color: #fff !important;
        font-size: 10px !important;
        font-weight: 950 !important;
        line-height: 1 !important;
    }
}

/* Final header button sync: desktop shows icon + label, phone/tablet uses clean equal icon buttons */
.topbar .top-actions {
    align-items: center;
    gap: 10px;
}
.topbar .top-actions form[data-confirm-logout] {
    display: inline-flex;
    align-items: center;
    margin: 0;
}
.topbar .top-action-profile,
.topbar .top-action-logout {
    width: 128px;
    min-width: 128px;
    height: 44px;
    min-height: 44px;
    padding: 0 14px;
    border-radius: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 900;
    line-height: 1;
    white-space: nowrap;
    box-sizing: border-box;
}
.topbar .top-action-profile::before,
.topbar .top-action-profile::after,
.topbar .top-action-logout::before,
.topbar .top-action-logout::after {
    content: none !important;
    display: none !important;
}
.topbar .profile-icon,
.topbar .logout-icon {
    width: 20px;
    min-width: 20px;
    height: 20px;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    flex: 0 0 20px;
    color: currentColor;
}
.topbar .profile-svg,
.topbar .logout-svg {
    width: 20px;
    height: 20px;
    display: block;
    flex: 0 0 auto;
}
.topbar .profile-text,
.topbar .logout-text {
    display: inline-flex !important;
    align-items: center;
    color: inherit;
    font-size: inherit;
    font-weight: inherit;
    line-height: 1;
}
.topbar .top-action-profile {
    color: #134e4a;
    background: #f0fdfa;
    border: 1px solid #ccfbf1;
}
.topbar .top-action-logout {
    color: #ffffff;
    background: linear-gradient(135deg, #dc2626, #991b1b);
    border: 1px solid rgba(185, 28, 28, .20);
}

@media (min-width: 1101px) {
    .topbar .top-actions {
        display: inline-flex !important;
        flex-wrap: nowrap !important;
    }
    .topbar .top-action-profile,
    .topbar .top-action-logout {
        width: 128px !important;
        min-width: 128px !important;
        height: 44px !important;
        min-height: 44px !important;
    }
}

@media (max-width: 1100px) {
    body.has-fixed-topbar .topbar {
        z-index: 2147481000 !important;
    }
    body.menu-open .mobile-overlay {
        display: block !important;
        z-index: 2147481500 !important;
    }
    body.menu-open .sidebar {
        z-index: 2147482000 !important;
    }
    body.has-fixed-topbar .top-actions {
        display: inline-flex !important;
        align-items: center !important;
        justify-content: flex-end !important;
        flex-wrap: nowrap !important;
        gap: 8px !important;
        width: auto !important;
        min-width: 0 !important;
        margin-left: auto !important;
    }
    body.has-fixed-topbar .top-actions form[data-confirm-logout] {
        width: auto !important;
        min-width: 0 !important;
        display: inline-flex !important;
        margin: 0 !important;
    }
    body.has-fixed-topbar .top-action-profile,
    body.has-fixed-topbar .top-action-logout,
    body.has-fixed-topbar .top-actions button {
        width: 44px !important;
        min-width: 44px !important;
        height: 44px !important;
        min-height: 44px !important;
        padding: 0 !important;
        border-radius: 14px !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        gap: 0 !important;
        font-size: 0 !important;
        line-height: 1 !important;
        box-sizing: border-box !important;
        overflow: hidden !important;
        white-space: nowrap !important;
    }
    body.has-fixed-topbar .profile-text,
    body.has-fixed-topbar .logout-text {
        display: none !important;
        width: 0 !important;
        height: 0 !important;
        overflow: hidden !important;
        font-size: 0 !important;
        line-height: 0 !important;
    }
    body.has-fixed-topbar .profile-icon,
    body.has-fixed-topbar .logout-icon {
        display: inline-flex !important;
        width: 22px !important;
        min-width: 22px !important;
        height: 22px !important;
        flex: 0 0 22px !important;
        font-size: 0 !important;
        align-items: center !important;
        justify-content: center !important;
    }
    body.has-fixed-topbar .profile-svg,
    body.has-fixed-topbar .logout-svg {
        display: block !important;
        width: 22px !important;
        height: 22px !important;
    }
}

@media (max-width: 760px) {
    body.has-fixed-topbar .topbar {
        grid-template-columns: 42px minmax(0, 1fr) auto !important;
        gap: 7px !important;
    }
    body.has-fixed-topbar .menu-toggle,
    body.has-fixed-topbar .top-action-profile,
    body.has-fixed-topbar .top-action-logout,
    body.has-fixed-topbar .top-actions button {
        width: 42px !important;
        min-width: 42px !important;
        height: 42px !important;
        min-height: 42px !important;
    }
    body.has-fixed-topbar .top-actions {
        gap: 6px !important;
    }
}

@media (max-width: 390px) {
    body.has-fixed-topbar .menu-toggle,
    body.has-fixed-topbar .top-action-profile,
    body.has-fixed-topbar .top-action-logout,
    body.has-fixed-topbar .top-actions button {
        width: 40px !important;
        min-width: 40px !important;
        height: 40px !important;
        min-height: 40px !important;
        border-radius: 13px !important;
    }
    body.has-fixed-topbar .top-actions {
        gap: 5px !important;
    }
    body.has-fixed-topbar .profile-icon,
    body.has-fixed-topbar .logout-icon,
    body.has-fixed-topbar .profile-svg,
    body.has-fixed-topbar .logout-svg {
        width: 21px !important;
        min-width: 21px !important;
        height: 21px !important;
        flex-basis: 21px !important;
    }
}


.app-confirm-actions .btn.is-logout-loading {
    gap: 8px;
    cursor: wait;
    opacity: .92;
}
.btn-spinner {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, .52);
    border-top-color: #fff;
    display: inline-block;
    flex: 0 0 auto;
    animation: spin .78s linear infinite;
}

/* Menu mobile/tablet mở ra phải nằm trên header fixed để không che mất thông tin menu. */
@media (max-width: 1100px) {
    body.menu-open .topbar { z-index: 2147480900 !important; }
    body.menu-open .mobile-overlay { z-index: 2147481500 !important; }
    body.menu-open .sidebar { z-index: 2147482000 !important; }
}

/* Final authority: mobile/tablet header action buttons chỉ hiển thị icon, không hiện chữ. */
@media (max-width: 1100px) {
    body.has-fixed-topbar .topbar .profile-text,
    body.has-fixed-topbar .topbar .logout-text {
        display: none !important;
        width: 0 !important;
        min-width: 0 !important;
        height: 0 !important;
        line-height: 0 !important;
        overflow: hidden !important;
        opacity: 0 !important;
        pointer-events: none !important;
    }
}

/* Backup/restore safety UI */
.backup-safety-grid {
    margin-bottom: 18px;
}
.backup-preview-panel code,
.code-wrap {
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
}
.compact-table table th,
.compact-table table td {
    padding: 10px 12px;
}
.danger-zone {
    border-color: rgba(239, 68, 68, .28) !important;
    box-shadow: 0 16px 40px rgba(239, 68, 68, .08);
}
.field-action {
    align-self: end;
}
.badge.success {
    background: rgba(16, 185, 129, .12);
    color: #047857;
    border: 1px solid rgba(16, 185, 129, .25);
}
.badge.warning {
    background: rgba(245, 158, 11, .13);
    color: #92400e;
    border: 1px solid rgba(245, 158, 11, .25);
}
@media (max-width: 900px) {
    .backup-safety-grid,
    .backup-preview-panel .grid-2,
    .danger-zone .grid-2 {
        grid-template-columns: 1fr !important;
    }
    .field-action label { display: none; }
    .danger-zone .btn,
    .backup-preview-panel .btn {
        width: 100%;
        justify-content: center;
    }
}

/* Auto backup settings */
.backup-auto-panel { overflow: hidden; }
.backup-auto-form { align-items: end; }
.toggle-field {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 48px;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--surface-soft);
    font-weight: 700;
    color: var(--text);
}
.toggle-field input { width: 18px; height: 18px; accent-color: var(--primary); }
.auto-backup-status-card small { overflow-wrap: anywhere; }
@media (max-width: 980px) {
    .backup-auto-form { grid-template-columns: 1fr; }
    .toggle-field { width: 100%; }
}

/* Full operations upgrade: health, audit, debts, deposits, receipts */
.readonly-box { padding: 11px 12px; border-radius: 12px; border: 1px solid var(--line); background: #f8fafc; font-weight: 800; color: #334155; }
.summary-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 16px; margin-bottom: 22px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 16px; align-items: end; }
.grid-3 .full { grid-column: 1 / -1; }
.danger-text { color: #991b1b; font-weight: 800; }
.badge.success { background: #dcfce7; color: #166534; }
.badge.warning { background: #fef3c7; color: #92400e; }
.receipt-card { max-width: 860px; margin-left: auto; margin-right: auto; }
.receipt-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding-bottom: 16px; border-bottom: 1px solid var(--line); margin-bottom: 18px; }
.receipt-head h2 { font-size: 34px; margin: 4px 0; }
.receipt-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 14px; }
.receipt-grid div { padding: 14px; border: 1px solid var(--line); border-radius: 14px; background: #f8fafc; }
.receipt-grid span { display: block; color: var(--muted); font-weight: 800; font-size: 13px; margin-bottom: 5px; }
.receipt-grid strong { word-break: break-word; }
.audit-meta { max-width: 420px; white-space: normal !important; }
@media (max-width: 900px) { .summary-grid, .grid-3 { grid-template-columns: repeat(2, minmax(0,1fr)); } }
@media (max-width: 720px) { .summary-grid, .grid-3, .receipt-grid { grid-template-columns: 1fr; } .receipt-head { flex-direction: column; } }
@media print { .sidebar, .topbar, .flash-wrap, .print-toolbar-screen, .mobile-overlay, .loading-overlay { display: none !important; } .app-shell { display: block !important; } .main { padding: 0 !important; } .panel { box-shadow: none !important; border: 0 !important; } body { background: #fff !important; } }

/* Upgrade 2026-06-22: dashboard vận hành, lọc nâng cao, import/nhắc công nợ, desktop/mobile polish */
.ops-kpi-strip {
    display: grid;
    grid-template-columns: repeat(6, minmax(150px, 1fr));
    gap: 12px;
    margin: 14px 0 18px;
}
.ops-kpi-strip > div,
.quick-op-card {
    background: linear-gradient(135deg, #ffffff, #f8fafc);
    border: 1px solid rgba(148, 163, 184, .22);
    border-radius: 18px;
    padding: 14px;
    box-shadow: 0 12px 28px rgba(15, 23, 42, .06);
}
.ops-kpi-strip span,
.quick-op-card small { display: block; color: #64748b; font-size: 12px; font-weight: 700; }
.ops-kpi-strip strong { display: block; margin: 5px 0 3px; font-size: 22px; color: #0f172a; }
.quick-ops-grid { display: grid; grid-template-columns: repeat(4, minmax(160px, 1fr)); gap: 12px; }
.quick-op-card { text-decoration: none; color: inherit; display: grid; gap: 4px; min-height: 92px; transition: transform .18s ease, box-shadow .18s ease; }
.quick-op-card:hover { transform: translateY(-2px); box-shadow: 0 18px 36px rgba(15, 23, 42, .10); }
.quick-op-card span { font-size: 24px; }
.quick-op-card strong { font-size: 15px; }
.smart-filter { background: #f8fafc; border: 1px solid rgba(148, 163, 184, .18); border-radius: 16px; padding: 10px; margin-bottom: 12px; }
.smart-filter input, .smart-filter select { flex: 1 1 170px; }
.check-line { display: inline-flex; align-items: center; gap: 8px; font-weight: 800; color: #334155; }
.check-line input { width: 18px; height: 18px; accent-color: #0f766e; }
.compact-stats { margin-bottom: 14px; }
.btn-ghost { background: #fff; color: #475569; border: 1px solid rgba(148, 163, 184, .28); }
.btn-ghost:hover { background: #f8fafc; }
@media (min-width: 1280px) {
    .main { max-width: 1480px; }
    .panel { padding: 22px; }
    .dashboard-grid { align-items: start; }
    .table-wrap table { min-width: 820px; }
}
@media (max-width: 1200px) {
    .ops-kpi-strip { grid-template-columns: repeat(3, minmax(160px, 1fr)); }
    .quick-ops-grid { grid-template-columns: repeat(2, minmax(160px, 1fr)); }
}
@media (max-width: 760px) {
    .ops-kpi-strip { grid-template-columns: 1fr 1fr; gap: 9px; }
    .ops-kpi-strip > div { padding: 11px; border-radius: 14px; }
    .ops-kpi-strip strong { font-size: 18px; }
    .quick-ops-grid { grid-template-columns: 1fr; }
    .quick-op-card { min-height: auto; grid-template-columns: auto 1fr; align-items: center; }
    .quick-op-card small { grid-column: 2; }
    .smart-filter { display: grid; grid-template-columns: 1fr; }
    .smart-filter input, .smart-filter select, .smart-filter .btn, .smart-filter a.btn { width: 100%; min-width: 0; }
    .panel { padding: 14px; }
    .row-actions { min-width: 180px; }
    .app-confirm-box { width: min(92vw, 420px); }
}
@media (max-width: 430px) {
    .ops-kpi-strip { grid-template-columns: 1fr; }
    .topbar-title h1 { font-size: 18px; }
    .top-actions .btn { width: 42px; height: 42px; padding: 0; }
}

/* Toggle hiển thị/ẩn mật khẩu */
.password-toggle-wrap {
    position: relative;
    width: 100%;
    display: block;
}
.password-toggle-wrap input.has-password-toggle {
    padding-right: 50px;
}
.password-toggle-wrap input.has-password-toggle.pin-code-input {
    padding-right: 54px !important;
}
.password-toggle-btn {
    position: absolute;
    top: 50%;
    right: 7px;
    transform: translateY(-50%);
    width: 38px;
    height: 38px;
    border: 0;
    border-radius: 12px;
    background: transparent;
    color: #64748b;
    cursor: pointer;
    display: inline-grid;
    place-items: center;
    padding: 0;
    transition: background .14s ease, color .14s ease, transform .14s ease;
    z-index: 2;
}
.password-toggle-btn:hover {
    background: #f1f5f9;
    color: #0f172a;
}
.password-toggle-btn:active {
    transform: translateY(-50%) scale(.96);
}
.password-toggle-btn:focus-visible {
    outline: none;
    background: #eff6ff;
    color: var(--primary);
    box-shadow: 0 0 0 3px rgba(15, 118, 110, .16);
}
.password-toggle-btn svg {
    width: 21px;
    height: 21px;
    pointer-events: none;
}
.password-toggle-btn .eye-off-icon { display: none; }
.password-toggle-wrap.is-password-visible .eye-on-icon { display: none; }
.password-toggle-wrap.is-password-visible .eye-off-icon { display: block; }
.login-form .password-toggle-btn {
    right: 8px;
}
@media (max-width: 640px) {
    .password-toggle-btn {
        width: 40px;
        height: 40px;
        right: 6px;
    }
    .password-toggle-wrap input.has-password-toggle {
        padding-right: 52px;
    }
}
