:root {
    color-scheme: light;
    --primary: #1d4ed8; --success: #15803d; --warning: #b45309; --danger: #b91c1c;
    --bg: #f1f5f9; --card: #ffffff; --soft: #f8fafc; --soft2: #f1f5f9; --line: #e2e8f0; --border: #cbd5e1;
    --text: #0f172a; --text2: #334155; --muted: #475569;
    --info-bg: #eff6ff; --info-bd: #bfdbfe; --info-tx: #1e3a8a; --ok-bg: #f0fdf4; --ok-bd: #bbf7d0; --bad-bg: #fef2f2; --bad-bd: #fecaca;
}
:root[data-theme="dark"] {
    color-scheme: dark;
    --primary: #60a5fa; --success: #4ade80; --warning: #fbbf24; --danger: #f87171;
    --bg: #0b1220; --card: #111c30; --soft: #16233b; --soft2: #1a2942; --line: #263754; --border: #33476b;
    --text: #e5edf8; --text2: #cbd5e1; --muted: #94a3b8;
    --info-bg: #14264a; --info-bd: #274a85; --info-tx: #bfdbfe; --ok-bg: #0f2a1c; --ok-bd: #1d5a37; --bad-bg: #321416; --bad-bd: #6b2326;
}
:root[data-theme="dark"] .btn-danger { background: #3a1517; border-color: #6b2326; }
:root[data-theme="dark"] .bg-green { background: #12361f; color: #86efac; border-color: #1d5a37; }
:root[data-theme="dark"] .bg-yellow { background: #3a2f0c; color: #fde68a; border-color: #6b5614; }
:root[data-theme="dark"] .bg-red { background: #3a1517; color: #fca5a5; border-color: #6b2326; }
:root[data-theme="dark"] .bg-gray { background: #1a2942; color: #cbd5e1; border-color: #263754; }
:root[data-theme="dark"] .bg-blue { background: #14264a; color: #bfdbfe; border-color: #274a85; }
:root[data-theme="dark"] #welcome-screen { background: #0b1220; }
:root[data-theme="dark"] input, :root[data-theme="dark"] select, :root[data-theme="dark"] textarea { background: var(--soft); color: var(--text); }
* { box-sizing: border-box; font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--text); font-size: 14.5px; overflow: hidden; }
#app-root { display: contents; }
.hidden { display: none !important; }
body:not(.is-admin) .admin-only { display: none !important; }
button { font-family: inherit; }

/* ================= BỐ CỤC MÁY TÍNH ================= */
.app-layout { display: flex; height: 100vh; width: 100vw; }
.sidebar { width: 220px; background: #0f172a; color: #fff; display: flex; flex-direction: column; padding: 12px; flex-shrink: 0; overflow-y: auto; z-index: 50; }
.brand h2 { margin: 0; font-size: 18px; color: #60a5fa; text-transform: uppercase; }
.brand p { margin: 4px 0 12px; font-size: 12px; color: #94a3b8; border-bottom: 1px solid #1e293b; padding-bottom: 10px; line-height: 1.5; }
.lnk { color: #93c5fd; text-decoration: underline; cursor: pointer; }
.main-content .lnk, .summary-strip .lnk { color: var(--primary); }
.nav-menu { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.nav-item { text-align: left; padding: 10px 12px; border: none; background: transparent; color: #cbd5e1; font-weight: 600; border-radius: 8px; cursor: pointer; font-size: 14px; display: flex; align-items: center; gap: 8px; transition: .2s; }
.nav-item:hover { background: #1e293b; color: #fff; }
.nav-item.active { background: var(--primary); color: #fff; }
.sidebar-footer { border-top: 1px solid #334155; padding-top: 12px; margin-top: 12px; }
.full-btn { width: 100%; justify-content: center; font-size: 13.5px; padding: 9px 8px; margin-bottom: 8px; }
.pend-badge { background: #f59e0b; color: #111; border-radius: 10px; padding: 0 7px; font-size: 12px; margin-left: 4px; }
.m-topbar { display: none; }

.main-content { flex: 1; display: flex; flex-direction: column; padding: 15px 20px; overflow: hidden; position: relative; min-width: 0; }
.tab-pane { display: flex; flex-direction: column; flex: 1; overflow: hidden; min-height: 0; }
#hhList, #memList, #fundList { flex: 1; min-height: 0; display: flex; flex-direction: column; overflow: hidden; }
.dashboard-header { margin-bottom: 12px; }
.dashboard-header h2 { margin: 0; font-size: 22px; color: var(--info-tx); }
.dashboard-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; overflow-y: auto; padding-bottom: 30px; flex: 1; align-content: start; }
.dash-card { background: var(--card); border-radius: 10px; border: 1px solid var(--border); padding: 16px; box-shadow: 0 2px 5px rgba(0,0,0,.05); }
.dash-card h4 { margin: 0 0 10px; font-size: 15px; border-bottom: 1px dashed var(--border); padding-bottom: 6px; }
.dash-card h3 { margin: 0 0 12px; font-size: 16px; color: var(--primary); border-bottom: 2px solid var(--line); padding-bottom: 8px; }

/* ----- biểu đồ ----- */
.dash-row { display: flex; gap: 14px; align-items: center; }
.kv-list .kv { display: flex; justify-content: space-between; padding: 6px 4px; border-bottom: 1px solid var(--soft2); cursor: default; }
.kv[data-act] { cursor: pointer; }
.kv[data-act]:hover, .bar-row[data-act]:hover { background: var(--soft); }
.bar-chart { margin-top: 4px; }
.bar-row { display: flex; align-items: center; margin-bottom: 8px; border-radius: 6px; }
.bar-label { width: 125px; font-size: 13px; font-weight: 600; color: var(--text2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-track { flex: 1; background: var(--line); height: 14px; border-radius: 10px; margin: 0 8px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 10px; transition: width .6s ease; }
.bar-val { width: 38px; text-align: right; font-weight: 800; font-size: 14px; }
.fund-list { margin-top: 8px; max-height: 220px; overflow-y: auto; border-top: 1px dashed #cbd5e1; }
.fund-list-item { display: flex; align-items: center; gap: 8px; padding: 8px 4px; border-bottom: 1px solid var(--soft2); cursor: pointer; font-size: 13px; }
.fund-list-item:hover { background: var(--soft); }
.mini-track { height: 5px; background: var(--line); border-radius: 4px; margin: 4px 0; overflow: hidden; }
.mini-track > div { height: 100%; background: var(--success); }
.lnk-sm { color: var(--primary); font-size: 11px; font-weight: 700; white-space: nowrap; }
.hint { font-size: 12.5px; color: var(--muted); margin: 6px 0; line-height: 1.5; }
.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stat-box { padding: 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--soft); }
.stat-box small { display: block; color: var(--muted); margin-bottom: 3px; }
.stat-box b { font-size: 17px; }
.stat-box.ok { background: var(--ok-bg); border-color: var(--ok-bd); } .stat-box.ok b { color: var(--success); }
.stat-box.bad { background: var(--bad-bg); border-color: var(--bad-bd); } .stat-box.bad b { color: var(--danger); }
.stat-box.full { grid-column: 1 / -1; background: var(--info-bg); border-color: var(--info-bd); } .stat-box.full b { color: var(--primary); }

/* ----- thanh công cụ, lọc ----- */
.toolbar { background: var(--card); padding: 10px 12px; border-radius: 8px; border: 1px solid var(--border); margin-bottom: 8px; flex-shrink: 0; }
.toolbar-top { display: flex; gap: 8px; align-items: center; }
.search-input { flex: 1; min-width: 0; padding: 8px 12px; border: 2px solid var(--border); border-radius: 6px; font-size: 14px; outline: none; }
.search-input:focus { border-color: var(--primary); }
.fund-select { flex: 1; min-width: 0; padding: 8px 10px; font-weight: 700; color: var(--primary); border: 2px solid var(--primary); border-radius: 6px; font-size: 14px; background: var(--card); }
.fund-action-row { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.seg { display: inline-flex; border: 2px solid var(--primary); border-radius: 6px; overflow: hidden; flex-shrink: 0; }
.seg button { border: none; background: var(--card); color: var(--primary); font-weight: 700; padding: 8px 14px; cursor: pointer; font-size: 14px; }
.seg button.active { background: var(--primary); color: #fff; }
.rule-box { margin-top: 8px; padding: 6px 10px; background: var(--info-bg); border: 1px solid var(--info-bd); border-radius: 6px; font-size: 13px; color: var(--info-tx); }
.chip-group { display: flex; gap: 6px; align-items: center; margin-top: 8px; overflow-x: auto; white-space: nowrap; -webkit-overflow-scrolling: touch; scrollbar-width: thin; }
.chip-label { font-size: 13px; font-weight: 700; color: var(--muted); margin-right: 2px; flex-shrink: 0; }
.chip { flex-shrink: 0; cursor: pointer; padding: 4px 11px; border-radius: 14px; font-size: 13px; border: 1px solid #cbd5e1; background: var(--card); user-select: none; }
.chip:hover { background: var(--soft2); }
.chip.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.summary-strip { background: var(--info-bg); border: 1px solid var(--info-bd); color: var(--info-tx); padding: 7px 12px; border-radius: 8px; margin-bottom: 8px; font-size: 13.5px; flex-shrink: 0; }
.summary-strip:empty { display: none; }
.count-line { font-size: 12px; color: var(--muted); margin: 0 2px 4px; flex-shrink: 0; }
.empty-box { padding: 40px 16px; text-align: center; color: var(--muted); background: var(--card); border: 1px dashed var(--border); border-radius: 10px; }
.more-row { text-align: center; padding: 12px 0; }

/* ----- bảng ----- */
.table-container { flex: 1; min-height: 0; background: var(--card); border: 1px solid var(--border); border-radius: 8px; overflow: auto; }
table { width: 100%; border-collapse: collapse; min-width: 1000px; }
th, td { padding: 7px 10px; text-align: left; border-bottom: 1px solid var(--line); font-size: 14px; vertical-align: middle; }
th { position: sticky; top: 0; background: var(--soft); font-weight: 700; color: var(--text); font-size: 13px; z-index: 10; box-shadow: 0 1px 0 var(--border); }
tbody tr:hover { background: var(--soft); }
.fund-table .amt-in { width: 105px; text-align: right; font-weight: 700; }
.fund-table .method-in { width: 64px; }
.total-all-box { line-height: 1.35; font-size: 13px; }
.dot-unsync { color: #f59e0b; font-size: 11px; vertical-align: middle; }
.gps-link { font-size: 12px; color: var(--primary); margin-left: 4px; white-space: nowrap; }

/* ----- nút, nhãn ----- */
.btn { padding: 8px 12px; border: none; border-radius: 6px; font-weight: 600; cursor: pointer; font-size: 13.5px; display: inline-flex; align-items: center; gap: 5px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-success { background: var(--success); color: #fff; }
.btn-outline { background: var(--card); border: 1px solid var(--border); color: var(--text); }
.btn-danger { background: #fee2e2; color: var(--danger); border: 1px solid #fecaca; }
.btn-sm { padding: 5px 9px; font-size: 12.5px; }
.btn-add { flex-shrink: 0; white-space: nowrap; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }
.btn-row > * { flex: 1; justify-content: center; margin: 0; }
.badge { display: inline-block; padding: 1px 7px; border-radius: 6px; font-size: 12px; font-weight: 600; margin: 1px; white-space: nowrap; }
.bg-green { background: #dcfce7; color: #166534; border: 1px solid #bbf7d0; }
.bg-yellow { background: #fef3c7; color: #92400e; border: 1px solid #fde68a; }
.bg-red { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }
.bg-gray { background: var(--soft2); color: var(--muted); border: 1px solid var(--line); }
.bg-blue { background: #dbeafe; color: #1e40af; border: 1px solid var(--info-bd); }

/* ----- cửa sổ nhập ----- */
.modal-backdrop { display: none; position: fixed; inset: 0; background: rgba(15,23,42,.65); z-index: 1000; justify-content: center; align-items: center; padding: 20px; }
.modal-backdrop.active { display: flex; }
.modal { background: var(--card); border-radius: 12px; width: 100%; max-width: 750px; max-height: 92vh; overflow-y: auto; padding: 20px 22px 0; box-shadow: 0 20px 25px -5px rgba(0,0,0,.2); }
.modal-header { display: flex; justify-content: space-between; align-items: center; border-bottom: 2px solid var(--border); padding-bottom: 10px; margin-bottom: 14px; }
.modal-header h3 { margin: 0; font-size: 18px; color: var(--primary); }
.modal-footer { position: sticky; bottom: 0; background: var(--card); padding: 10px 0 14px; margin-top: 10px; text-align: right; border-top: 1px solid var(--border); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.form-group { margin-bottom: 12px; }
.form-group.full { grid-column: 1 / -1; }
label { display: block; font-size: 13.5px; font-weight: 600; margin-bottom: 5px; color: var(--text2); }
input[type="text"], input[type="search"], input[type="tel"], input[type="number"], input[type="password"], input[type="date"], select, textarea { width: 100%; padding: 9px 11px; border: 1px solid var(--border); border-radius: 6px; font-size: 15px; background: var(--card); }
input:focus, select:focus, textarea:focus { outline: 2px solid #93c5fd; border-color: var(--primary); }
.checkbox-group { display: flex; flex-wrap: wrap; gap: 6px; padding: 8px; background: var(--soft); border: 1px solid var(--border); border-radius: 8px; }
.checkbox-item { display: flex; align-items: center; gap: 6px; font-size: 13px; background: var(--card); padding: 6px 10px; border-radius: 6px; border: 1px solid #cbd5e1; cursor: pointer; margin: 0; font-weight: 500; }
.checkbox-item input { width: auto; }
.section-box { background: var(--soft); border: 1px solid var(--border); border-radius: 8px; padding: 12px; margin: 10px 0; }
.section-box h4 { margin: 0 0 8px; font-size: 14px; color: var(--primary); }
.sys-card { margin-bottom: 12px; }

/* ----- đăng nhập, thông báo ----- */
#welcome-screen { position: fixed; inset: 0; background: var(--line); display: flex; justify-content: center; align-items: center; z-index: 9999; overflow-y: auto; padding: 16px; }
.welcome-box { background: var(--card); padding: 28px 24px; border-radius: 16px; box-shadow: 0 10px 25px rgba(0,0,0,.1); width: 100%; max-width: 400px; }
.toast { position: fixed; left: 50%; bottom: 22px; transform: translate(-50%, 30px); max-width: 92vw; background: #166534; color: #fff; padding: 11px 16px; border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,.3); z-index: 5000; opacity: 0; pointer-events: none; transition: .25s; display: flex; gap: 12px; align-items: center; font-weight: 600; font-size: 14px; }
.toast.show { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.toast.err { background: #991b1b; }
.toast-btn { background: var(--card); color: #111; border: none; border-radius: 6px; padding: 6px 10px; font-weight: 700; cursor: pointer; white-space: nowrap; }

/* ================= ĐIỆN THOẠI: ưu tiên hiển thị dữ liệu ================= */
body.mobile-mode { position: fixed; inset: 0; overflow: hidden; }
.mobile-mode .app-layout { position: absolute; inset: 0; width: 100%; height: 100%; display: flex; flex-direction: column; }
.mobile-mode .sidebar { display: none; }

/* thanh trên cùng: chỉ 1 dòng mỏng */
.mobile-mode .m-topbar { display: flex; align-items: center; gap: 6px; flex-shrink: 0; min-height: 34px; padding: env(safe-area-inset-top, 0) 8px 0 12px; background: #0f172a; color: #fff; }
.m-title { flex: 1; font-size: 13px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.m-op { background: transparent; color: #cbd5e1; border: none; font-size: 11.5px; max-width: 42vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 6px 4px; }
.m-sync { background: #166534; color: #fff; border: none; border-radius: 12px; font-size: 12px; font-weight: 700; padding: 3px 10px; }
.m-sync.warn { background: #f59e0b; color: #111; }

.mobile-mode .main-content { display: flex; flex-direction: column; padding: 0 0 14px; overflow-y: auto; overflow-x: hidden; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
.mobile-mode .tab-pane:not(.hidden) { display: flex; flex-direction: column; flex: 1 0 auto; }
.mobile-mode .tab-pane {  padding: 0 10px 6px 12px; overflow: visible; }
.mobile-mode #hhList, .mobile-mode #memList, .mobile-mode #fundList { display: block; overflow: visible; }
.mobile-mode .dashboard-header { margin: 8px 0 6px; }
.mobile-mode .dashboard-header h2 { font-size: 16px; }
.mobile-mode .dashboard-grid { display: flex; flex-direction: column; gap: 10px; overflow: visible; padding-bottom: 8px; }
.mobile-mode .dash-card { padding: 11px 12px; }
.mobile-mode .dash-card h3 { font-size: 14.5px; margin-bottom: 8px; padding-bottom: 6px; }
.mobile-mode .bar-label { width: 108px; font-size: 12.5px; }

.mobile-mode .toolbar { position: sticky; top: 0; z-index: 40; margin: 0 -10px 6px -12px; padding: 6px 10px 6px 12px; border-radius: 0; border-width: 0 0 1px; box-shadow: 0 2px 8px rgba(0,0,0,.07); }
.mobile-mode .search-input { padding: 8px 10px; font-size: 15px; }
.mobile-mode .chip-group { margin-top: 6px; }
.mobile-mode .chip { padding: 3px 10px; font-size: 12.5px; }
.mobile-mode .fund-action-row { margin-top: 6px; }
.mobile-mode .fund-action-row .btn { flex: 1; justify-content: center; padding: 6px 4px; font-size: 12px; }
.mobile-mode .rule-box { margin-top: 6px; padding: 4px 8px; font-size: 12px; }
.mobile-mode .summary-strip { margin-bottom: 6px; padding: 5px 9px; font-size: 12.5px; }

.mobile-mode .table-container { display: none; }
.mobile-card-list { display: flex; flex-direction: column; gap: 7px; padding-bottom: 6px; }
.mobile-card { background: var(--card); border-radius: 10px; padding: 8px 11px; border: 1px solid var(--border); box-shadow: 0 1px 3px rgba(0,0,0,.05); }
.mobile-card.fund-paid { border-left: 4px solid var(--success); }
.mobile-card.fund-unpaid { border-left: 4px solid var(--danger); }
.mobile-card.fund-exempt { border-left: 4px solid #eab308; }
.mc-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 6px; border-bottom: 1px dashed var(--border); padding-bottom: 5px; margin-bottom: 5px; }
.mc-title { font-size: 15px; font-weight: 700; color: var(--primary); margin: 0; line-height: 1.3; }
.mc-sub { font-size: 11.5px; color: var(--muted); margin-top: 1px; }
.mc-row { margin-bottom: 4px; font-size: 13.5px; color: var(--text2); display: flex; gap: 5px; align-items: flex-start; }
.mc-row strong { color: var(--text); font-weight: 600; }
.mc-actions { display: flex; justify-content: flex-end; gap: 6px; margin-top: 6px; border-top: 1px solid var(--soft2); padding-top: 6px; flex-wrap: wrap; }
.mc-actions .btn { padding: 8px 12px; font-size: 13.5px; }
.mc-actions .btn-success { flex: 1; justify-content: center; font-size: 15px; padding: 10px; }
.mc-input-group { display: flex; gap: 6px; margin: 2px 0; }
.mc-input-group .amt-in { flex: 1; font-weight: 700; text-align: right; font-size: 17px; padding: 8px 10px; }
.mc-input-group .method-in { width: 78px; font-size: 15px; }

/* ----- NÚT MENU DÍNH SÁT MÉP TRÁI ----- */
.edge-nav, .edge-scrim { display: none; }
.mobile-mode .edge-nav { display: flex; flex-direction: column; align-items: flex-start; position: fixed; left: env(safe-area-inset-left, 0); bottom: calc(8px + env(safe-area-inset-bottom, 0)); z-index: 900; pointer-events: none; }
.mobile-mode .edge-nav > * { pointer-events: auto; }
.edge-tab { width: 36px; height: 56px; padding: 0; border: none; border-radius: 0 18px 18px 0; background: rgba(29,78,216,.88); color: #fff; font-size: 20px; font-weight: 700; line-height: 1; box-shadow: 2px 2px 8px rgba(0,0,0,.3); cursor: pointer; display: flex; align-items: center; justify-content: center; }
.edge-nav.open .edge-tab { background: #334155; }
.edge-tray { display: flex; flex-direction: column; gap: 6px; margin-bottom: 8px; transform: translateX(-115%); opacity: 0; pointer-events: none !important; transition: .2s ease; }
.edge-nav.open .edge-tray { transform: none; opacity: 1; pointer-events: auto !important; }
.edge-item { display: flex; align-items: center; gap: 10px; min-width: 176px; padding: 14px 22px 14px 16px; border: none; border-radius: 0 26px 26px 0; background: rgba(15,23,42,.96); color: #fff; font-size: 16px; font-weight: 600; box-shadow: 2px 3px 10px rgba(0,0,0,.35); cursor: pointer; text-align: left; }
.edge-item .ei { font-size: 19px; }
.edge-item.active { background: var(--primary); }
.edge-item.danger { color: #fca5a5; }
.edge-scrim { position: fixed; inset: 0; z-index: 850; background: rgba(15,23,42,.28); }
.mobile-mode .edge-scrim.on { display: block; }
body.modal-open .edge-nav, body.modal-open .edge-scrim { display: none !important; }
/* đổi sang mép phải (cho người thuận tay phải) */
.edge-right .edge-nav { left: auto; right: env(safe-area-inset-right, 0); align-items: flex-end; }
.edge-right .edge-tab { border-radius: 18px 0 0 18px; }
.edge-right .edge-tray { transform: translateX(115%); }
.edge-right .edge-nav.open .edge-tray { transform: none; }
.edge-right .edge-item { border-radius: 26px 0 0 26px; flex-direction: row-reverse; padding: 11px 14px 11px 18px; }

/* cửa sổ nhập trên điện thoại: toàn màn hình */
.mobile-mode .modal-backdrop { padding: 0; align-items: stretch; }
.mobile-mode .modal { height: 100%; max-height: 100%; max-width: 100% !important; border-radius: 0; padding: 12px 12px 0; }
.mobile-mode .form-grid { grid-template-columns: 1fr; }
.mobile-mode .modal-footer .btn { width: 100%; justify-content: center; padding: 13px; font-size: 16px; }
.mobile-mode .toast { bottom: 76px; }


/* ----- thanh tìm kiếm (điện thoại: nằm dưới cùng; máy tính: nằm trên cùng) ----- */
.searchbar { display: flex; gap: 8px; align-items: center; flex-shrink: 0; order: -2; background: var(--card); padding: 10px 12px; border-radius: 8px; border: 1px solid var(--border); margin-bottom: 8px; }
.searchbar .btn-clear { padding: 7px 11px; }
.mobile-mode .searchbar { order: 0; position: sticky; bottom: 0; margin-top: auto !important; z-index: 45; margin: 6px -10px 0 -12px; padding: 8px 10px 8px 46px; border-radius: 0; border-width: 1px 0 0; box-shadow: 0 -2px 10px rgba(0,0,0,.12); padding-bottom: calc(8px + env(safe-area-inset-bottom, 0)); }
.mobile-mode .toolbar { top: 0; }
.seg-full { display: flex; width: 100%; margin-top: 8px; } .seg-full button { flex: 1; padding: 9px 4px; }
.add-row { margin-bottom: 8px; } .add-row .btn { width: 100%; justify-content: center; }
.total-line { margin-top: 6px; font-size: 13.5px; color: var(--muted); }
.bar-label { width: 130px; } .bar-val { width: 62px; } .bar-val small { display: block; font-size: 11px; font-weight: 600; color: var(--muted); line-height: 1; }
.m-theme { background: transparent; border: none; font-size: 17px; padding: 4px 6px; }
.m-install { background: transparent; border: none; font-size: 17px; padding: 4px 6px; cursor: pointer; }
.system-wrap { overflow-y: auto; flex: 1; min-height: 0; padding-bottom: 24px; max-width: 720px; }
.mobile-mode .system-wrap { overflow: visible; }
.hint { font-size: 12.5px; color: var(--muted); margin-top: 6px; }
.nav-item .pend-badge:empty { display: none; }
/* ================= PHIẾU THU (in nhiệt 58 / 80 mm) ================= */
#print-area { display: none; }
.receipt { color: #000; background: #fff; font-family: Arial, 'Segoe UI', sans-serif; font-size: 12px; line-height: 1.35; padding: 3mm 2mm 4mm; margin: 0 auto; page-break-after: always; break-after: page; }
.receipt:last-child { page-break-after: auto; break-after: auto; }
.paper-80 .receipt { width: 76mm; }
.paper-58 .receipt { width: 52mm; font-size: 10.5px; }
.rc-center { text-align: center; }
.rc-small { font-size: 0.88em; }
.rc-tiny { font-size: 0.75em; margin-top: 3mm; color: #333; }
.rc-dash { border-top: 1px dashed #000; margin: 2mm 0; }
.rc-title { text-align: center; font-size: 1.6em; font-weight: 800; letter-spacing: 1px; margin: 2mm 0 1mm; }
.rc-row { display: flex; gap: 2mm; margin: 0.6mm 0; }
.rc-k { flex: 0 0 auto; white-space: nowrap; }
.rc-v { flex: 1; text-align: right; font-weight: 600; word-break: break-word; }
.rc-amount { text-align: center; font-size: 1.35em; font-weight: 800; margin: 1.5mm 0; }
.rc-words { text-align: center; margin-bottom: 1mm; }
.rc-sign { display: flex; justify-content: space-between; text-align: center; margin-top: 2mm; min-height: 22mm; gap: 1mm; }
.rc-sign > div { flex: 1; font-size: 0.92em; }
.rc-sign small { font-size: 0.78em; }
.rc-reprint { font-weight: 800; margin-top: 2mm; }

@media print {
    html, body { height: auto !important; overflow: visible !important; position: static !important; background: #fff !important; }
    body > *:not(#print-area) { display: none !important; }
    #print-area { display: block !important; }
}

/* ----- điện thoại: ô tìm kiếm luôn cố định đáy (không nhảy theo kết quả) ----- */
.mobile-mode #hhList, .mobile-mode #memList, .mobile-mode #fundList { flex: 1 0 auto; }
.mobile-mode .searchbar { margin-top: auto; }
.mobile-mode .searchbar .search-input { min-height: 40px; }

/* ----- điện thoại: Tổng quan kéo sang ngang, mỗi trang 2 thẻ ----- */
.mobile-mode .dashboard-grid { display: grid; grid-template-rows: auto auto; grid-auto-flow: column; grid-auto-columns: 92%; gap: 10px; overflow-x: auto; overflow-y: hidden; scroll-snap-type: x mandatory; padding: 0 10px 10px 0; align-content: start; -webkit-overflow-scrolling: touch; overscroll-behavior-x: contain; flex: none; }
.mobile-mode .dashboard-grid > .dash-card { scroll-snap-align: start; margin: 0; min-width: 0; }
.dash-dots { display: none; }
.mobile-mode .dash-dots { display: flex; justify-content: center; gap: 7px; padding: 4px 0 8px; }
.dash-dots i { width: 8px; height: 8px; border-radius: 50%; background: var(--border); }
.dash-dots i.on { background: var(--primary); width: 20px; border-radius: 6px; }

/* ----- phiếu: tiêu đề theo mẫu, chữ ký ----- */
.rc-head { display: flex; gap: 2mm; align-items: flex-start; font-size: 0.9em; line-height: 1.3; }
.rc-hl { flex: 0 0 36%; text-align: center; }
.rc-hr { flex: 1; text-align: center; }
.rc-line { width: 60%; border-top: 1px solid #000; margin: 0.8mm auto 0; }
.rc-name { margin-top: 9mm; font-weight: 700; font-size: 0.95em; word-break: break-word; }
.rc-sig { display: block; margin: 1mm auto 0; height: 12mm; max-width: 100%; object-fit: contain; }
.rc-signed { margin-top: 8mm; font-style: italic; font-weight: 700; }
@media print { .dash-dots { display: none !important; } }
.mobile-mode .main-content { padding-bottom: 0; }
.mobile-mode .tab-pane { padding-bottom: 0; }
.mobile-mode #tab-dashboard, .mobile-mode #tab-system { padding-bottom: 72px; }

.dash-page { display: contents; }
.mobile-mode .dash-page { display: flex; flex-direction: column; gap: 10px; scroll-snap-align: start; min-width: 0; }
.mobile-mode .dashboard-grid { grid-template-rows: auto; }
.mobile-mode .dashboard-grid > .dash-card { scroll-snap-align: none; }

.rc-sign { min-height: 30mm; }
.rc-sign > div { display: flex; flex-direction: column; align-items: center; }
.rc-name { margin-top: auto !important; padding-top: 1mm; font-weight: 700; font-size: 0.95em; line-height: 1.2; word-break: normal; overflow-wrap: anywhere; }
.rc-signed { margin-top: 6mm; }

.login-msg { margin-top: 10px; padding: 10px 12px; border-radius: 8px; font-size: 13.5px; line-height: 1.5; white-space: pre-wrap; word-break: break-word; background: var(--bad-bg); border: 1px solid var(--bad-bd); color: var(--danger); }
.login-msg.ok { background: var(--info-bg); border-color: var(--info-bd); color: var(--info-tx); }
