/* ============ App Quản lý máy POS — bổ sung cho app.css (bộ chuẩn QuyChuan_GiaoDien.html) ============
   Chỉ đọc biến màu var(--…); ngoại lệ duy nhất: nút Excel #217346 và phiếu báo phí (luôn nền trắng để gửi khách). */

:root { --c1: #2563eb; --c2: #b07d2a; --r-admin: #7c3aed; --r-admin-soft: #f1ebfe; --r-kiem: #0f766e; --r-kiem-soft: #e2f5f1; --info: #2563eb; --info-soft: #e8effd; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --c1: #3d7fe6; --c2: #b0812c; --r-admin: #b794f6; --r-admin-soft: rgba(183, 148, 246, .15); --r-kiem: #4fd1c5; --r-kiem-soft: rgba(79, 209, 197, .13); --info: #6ea8fe; --info-soft: rgba(110, 168, 254, .16); } }
:root[data-theme="dark"] { --c1: #3d7fe6; --c2: #b0812c; --r-admin: #b794f6; --r-admin-soft: rgba(183, 148, 246, .15); --r-kiem: #4fd1c5; --r-kiem-soft: rgba(79, 209, 197, .13); --info: #6ea8fe; --info-soft: rgba(110, 168, 254, .16); }

/* ---------- Menu trái nhiều mục (mục 17) + thẻ quảng bá gọn 1 hàng ---------- */
.side > * { flex-shrink: 0; }
.side nav { margin-bottom: 12px; }
.side nav a .grow { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side .promo-card { flex-direction: row; text-align: left; gap: 8px; padding: 8px 8px; margin: auto 2px 6px; }
.side .promo-card-icon { width: 26px; height: 26px; font-size: 12px; flex: none; }
.side .promo-card-text { align-items: flex-start; gap: 1px; }
.side .promo-card-text strong { font-size: 9.5px; line-height: 1.3; white-space: nowrap; letter-spacing: -.1px; }
.side .promo-card-text span { font-size: 10.5px; }
.nav-badge { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 99px; background: var(--bad); color: #fff; font-size: .72rem; font-weight: 700; }
.menu-grid a, .menu-grid button { position: relative; }
.menu-grid .nav-badge { position: absolute; top: 6px; right: 6px; }
.tab-ic { position: relative; display: inline-flex; }
.tab-dot { position: absolute; top: -1px; right: -3px; width: 8px; height: 8px; border-radius: 50%; background: var(--bad); border: 2px solid var(--surface); }

/* ---------- Tìm nhanh Ctrl + K (mục 15) ---------- */
.qs-btn { display: flex; align-items: center; gap: 8px; margin: 0 2px 12px; padding: 8px 10px; border-radius: var(--r-sm);
  border: 1px solid rgba(255, 255, 255, .14); background: rgba(255, 255, 255, .06); color: rgba(255, 255, 255, .75); font: inherit; font-size: .88rem; cursor: pointer; text-align: left; }
.qs-btn:hover { background: rgba(255, 255, 255, .12); color: #fff; }
.qs-btn .grow { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.qs-btn kbd { white-space: nowrap; font: 600 .68rem/1 inherit; padding: 3px 5px; border-radius: 4px; background: rgba(255, 255, 255, .12); border: 0; }
.qs-btn.on-light { width: 100%; margin: 0 0 12px; border-color: var(--line); background: var(--surface-2); color: var(--muted); }
kbd { font-family: inherit; font-size: .78em; padding: 1px 5px; border: 1px solid var(--line); border-radius: 4px; background: var(--surface-2); }
.qs-inp { width: 100%; font-size: 1.05rem; min-height: 46px; }
.qs-res { margin-top: 4px; display: flex; flex-direction: column; gap: 2px; min-height: 60px; }
.qs-grp { font-size: .72rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); margin: 10px 4px 4px; }
.qs-hit { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border: 0; border-radius: var(--r-sm); background: transparent; color: var(--text); font: inherit; text-align: left; cursor: pointer; }
.qs-hit:hover, .qs-hit.on { background: var(--primary-soft); }
.qs-hit .grow { display: flex; flex-direction: column; min-width: 0; }
.qs-hit small { font-size: .78rem; }
.qs-ic { width: 28px; text-align: center; font-size: 18px; }

/* ---------- Băng trên đầu nội dung ---------- */
.demo-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 12px 16px 0; padding: 8px 12px; border-radius: var(--r-sm);
  background: var(--warn-soft); color: var(--text); border: 1px dashed color-mix(in srgb, var(--warn) 45%, transparent); font-size: .85rem; }
.demo-bar .chip { padding: 4px 10px; font-size: .8rem; }
.view-banner { display: flex; align-items: center; gap: 8px; margin: 12px 16px 0; padding: 8px 12px; border-radius: var(--r-sm); background: var(--primary-soft); color: var(--primary); font-size: .85rem; }
@media (min-width: 900px) { .demo-bar, .view-banner { margin: 16px 32px 0; } }

/* ---------- Nút Excel (giữ màu #217346 ở cả 2 chế độ) ---------- */
.btn.xls { background: #217346; border-color: #217346; color: #fff; }
.btn.xls:hover:not(:disabled) { background: #1a5c38; border-color: #1a5c38; transform: translateY(-1px); box-shadow: 0 8px 18px -8px rgba(33, 115, 70, .7); }
.btn.xls:disabled { opacity: .55; }
.xls-mini { flex: none; display: inline-flex; align-items: center; gap: 5px; height: 32px; padding: 0 11px 0 8px; border-radius: 999px;
  border: 0; background: linear-gradient(180deg, #2a8a55, #217346); color: #fff; font: inherit; font-size: .78rem; font-weight: 700; letter-spacing: .2px;
  cursor: pointer; box-shadow: 0 1px 0 rgba(255, 255, 255, .25) inset, 0 2px 6px -2px rgba(33, 115, 70, .6); transition: transform .15s, box-shadow .15s, filter .15s; }
.xls-mini:hover:not(:disabled) { transform: translateY(-1px); filter: brightness(1.06); box-shadow: 0 1px 0 rgba(255, 255, 255, .25) inset, 0 6px 14px -4px rgba(33, 115, 70, .7); }
.xls-mini:active { transform: none; }
.xls-mini:disabled { opacity: .75; cursor: wait; }
.spin.sm { width: 16px; height: 16px; border-width: 2px; display: inline-block; }
.xls-mini .spin.sm { width: 14px; height: 14px; border-color: rgba(255, 255, 255, .35); border-top-color: #fff; }
.btn.xls .spin.sm { border-color: rgba(255, 255, 255, .35); border-top-color: #fff; }

/* ---------- Bộ chọn thời gian: nút ‹ › + điện thoại (mục 12) ---------- */
.rg-nav { display: flex; gap: 4px; flex: none; align-items: center; }
.rg-nav .icon-btn { width: 38px; height: 38px; border: 1px solid var(--line); background: var(--surface); font-size: 1.2rem; }
.rg-nav .icon-btn:disabled { opacity: .4; cursor: default; }
.rg-br { display: none; }
@media (min-width: 1150px) { .range-dates.has-lead { width: 430px; } .range-dates.has-lead2 { width: 520px; } }
@media (max-width: 699px) {
  .range-dates.has-lead { flex-wrap: wrap; row-gap: 8px; }
  .range-dates.has-lead .rg-br { display: block; flex-basis: 100%; height: 0; }
  .range-dates.has-lead .inp { flex: 1 1 0; min-width: 0; }
}

/* ---------- Thanh công cụ, bộ lọc ---------- */
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.filters > .inp, .filters > select { min-height: 44px; }
.search-x { position: absolute; right: 4px; width: 34px; height: 34px; border: 0; border-radius: 50%; background: none; color: var(--muted); cursor: pointer; }
.search-x:hover { background: var(--surface-2); color: var(--text); }
.search .inp { padding-right: 36px; }
.filter-chip { align-self: flex-start; display: inline-flex; gap: 6px; align-items: center; padding: 4px 6px 4px 12px; border-radius: 99px; background: var(--primary-soft); color: var(--primary); font-size: .85rem; }
.filter-chip a { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; color: inherit; }
.filter-chip a:hover { background: color-mix(in srgb, var(--primary) 15%, transparent); }
.seg-n { display: inline-block; min-width: 18px; padding: 0 5px; margin-left: 2px; border-radius: 99px; background: var(--surface-2); color: var(--muted); font-size: .72rem; font-weight: 600; }
.seg button.on .seg-n { background: var(--primary-soft); color: var(--primary); }
.req { color: var(--bad); }
.upper { text-transform: uppercase; }
.pct-wrap { position: relative; display: flex; align-items: center; }
.pct-wrap .inp { padding-right: 28px; }
.pct-wrap > span { position: absolute; right: 10px; color: var(--muted); font-size: .9rem; pointer-events: none; }
.combo-list small { font-weight: 400; }
.combo-list li b { color: var(--primary); }
fieldset.plain { border: 0; margin: 0; padding: 0; min-width: 0; display: flex; flex-direction: column; gap: 10px; }
.form-grid.g3 { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 900px) { .form-grid.g3 { grid-template-columns: 1fr 1fr; } }
@media (max-width: 640px) { .form-grid.g3 { grid-template-columns: 1fr; } }
.inline-form { display: grid; grid-template-columns: 2fr auto auto auto; gap: 10px; align-items: end; padding: 12px; border-radius: var(--r-sm); background: var(--surface-2); }
@media (max-width: 760px) { .inline-form { grid-template-columns: 1fr; } }
a.btn.disabled { opacity: .5; pointer-events: none; }

/* ---------- Bảng dữ liệu có phân trang ---------- */
.dt { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.dt-tbl td { vertical-align: middle; }
.dt-tbl tbody tr { animation: gtFadeInUp .3s ease both; }
.dt-tbl tbody tr:nth-child(n+21) { animation: none; }
.tbl tr.dt-total td { background: var(--warn-soft); font-weight: 700; border-bottom: 2px solid var(--line); white-space: nowrap; }
.tbl tr.dt-total td .money { font-weight: 700; }
.tbl th.chk, .tbl td.chk { width: 34px; padding-right: 0; }
.tbl td.chk input, .tbl th.chk input { width: 18px; height: 18px; cursor: pointer; accent-color: var(--primary); }
.tbl tr.sel td { background: color-mix(in srgb, var(--primary) 10%, transparent); }
.tbl tr.hl td { background: var(--warn-soft); }
.tbl tr.dim td { opacity: .55; }
.tbl tr.dt-exp td { background: var(--surface-2); }
.exp-btn { width: 24px; height: 24px; border-radius: 6px; border: 1px solid var(--line); background: var(--surface); color: var(--muted); cursor: pointer; font-weight: 700; line-height: 1; }
.exp-btn:hover { color: var(--primary); border-color: var(--primary); }
.exp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px 16px; padding: 4px 0; }
.exp-grid span { display: block; font-size: .74rem; color: var(--muted); }
.pager { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.pager-size { width: auto; min-height: 36px; padding: 4px 8px; font-size: .85rem; }
.pager-n { font-size: .85rem; color: var(--muted); min-width: 44px; text-align: center; }
.acts { display: flex; gap: 2px; justify-content: flex-end; flex-wrap: nowrap; }
.act { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 8px; border: 0; background: transparent; color: var(--muted); cursor: pointer; text-decoration: none; flex: none; transition: background .15s, color .15s; }
.act:hover { background: var(--surface-2); color: var(--text); }
.act.primary { color: var(--primary); }
.act.primary:hover { background: var(--primary-soft); }
.act.warn { color: var(--warn); }
.act.danger:hover { background: var(--bad-soft); color: var(--bad); }
.sel-bar { position: sticky; top: 0; z-index: 3; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 10px; background: var(--primary); color: var(--on-primary); }
.sel-bar .btn { background: var(--surface); color: var(--primary); border-color: transparent; }
.badge.info { background: var(--info-soft); color: var(--info); }
.badge.st { white-space: nowrap; }
.bank-tag { display: inline-block; padding: 1px 7px; border-radius: 6px; background: var(--surface-2); border: 1px solid var(--line); font-size: .78rem; font-weight: 600; white-space: nowrap; font-variant-numeric: tabular-nums; }
.tag-list { display: flex; flex-wrap: wrap; gap: 4px; }
.note-cell { display: inline-block; max-width: 240px; font-size: .84rem; }
.mini-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.mini-list li { display: flex; gap: 10px; align-items: center; font-size: .88rem; }
.img-pick { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.img-pick img { width: 120px; height: 76px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); }
.w-dt { min-width: 200px; }

/* ---------- Khối tổng hợp đơn hàng ---------- */
.sum-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.sum-grid > div { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; border-radius: var(--r-sm); background: var(--surface-2); min-width: 0; }
.sum-grid span { font-size: .74rem; color: var(--muted); }
.sum-grid b { font-size: 1rem; font-variant-numeric: tabular-nums; }
.sum-grid .hero { grid-column: span 2; background: linear-gradient(135deg, var(--hero-a), var(--hero-b)); color: #fff; }
.sum-grid .hero span, .sum-grid .hero small { color: rgba(255, 255, 255, .85); font-size: .74rem; }
.sum-grid .hero b { font-size: 1.35rem; }
.sum-grid .hero .money.neg { color: #ffd1d1 !important; }
@media (max-width: 480px) { .sum-grid { grid-template-columns: 1fr 1fr; } }
.kpis-3 { grid-template-columns: repeat(2, 1fr); }
@media (min-width: 700px) { .kpis-3 { grid-template-columns: repeat(3, 1fr); } }
.kpis-3 .kpi:first-child:nth-last-child(3) { grid-column: auto; }
@media (max-width: 699px) { .kpis-3 > .kpi:last-child:nth-child(odd) { grid-column: 1 / -1; } .kpis-4 > .kpi:last-child:nth-child(even) { grid-column: 1 / -1; } }
.kpi.link { text-decoration: none; cursor: pointer; }
.kpi.link:hover { transform: translateY(-3px); }

/* ---------- Xử lý đơn ---------- */
.proc-stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 8px; }
.proc-stats > div { padding: 10px 12px; border-radius: var(--r-sm); background: var(--surface-2); border-left: 3px solid var(--line); }
.proc-stats > div.warn { border-left-color: var(--warn); }
.proc-stats > div.ok { border-left-color: var(--good); }
.proc-stats > div.bad { border-left-color: var(--bad); }
.proc-stats span { display: block; font-size: .74rem; color: var(--muted); }
.proc-stats b { font-variant-numeric: tabular-nums; }
.proc-status { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.proc-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 760px) { .proc-grid { grid-template-columns: 1fr; } }
.proc-box { display: flex; flex-direction: column; gap: 10px; padding: 14px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); }
.proc-box h3 { display: flex; align-items: center; gap: 8px; }
.pb-n { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--primary); color: var(--on-primary); font-size: .8rem; font-weight: 700; flex: none; }
.swipe-rows { display: flex; flex-direction: column; gap: 10px; }
.swipe-row { position: relative; display: grid; grid-template-columns: 1.6fr 1.2fr 1fr .7fr .7fr 1fr; gap: 8px; align-items: end; padding: 10px; border-radius: var(--r-sm); background: var(--surface-2); }
.swipe-row .fld > span { font-size: .74rem; }
.swipe-row .hint { display: none; }
.sw-x { position: absolute; top: 4px; right: 4px; width: 26px; height: 26px; }
@media (max-width: 900px) { .swipe-row { grid-template-columns: 1fr 1fr; } .sw-pos { grid-column: 1 / -1; } }
.proc-hist { display: flex; flex-direction: column; gap: 8px; }
.proc-hist h3 { margin-top: 6px; font-size: .92rem; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.proc-dl { grid-template-columns: repeat(2, minmax(90px, auto) 1fr); }
@media (max-width: 640px) { .proc-dl { grid-template-columns: minmax(90px, auto) 1fr; } }
.debt-line { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 14px; border-radius: var(--r-sm); background: var(--surface-2); }
.debt-line.bad { background: var(--bad-soft); color: var(--bad); }
.debt-line.good { background: var(--good-soft); color: var(--good); }
.debt-line b { font-size: 1.1rem; }
.bulk-tbl td { padding: 6px 4px; vertical-align: top; }
.bulk-tbl .inp { min-height: 40px; }
.bulk-tbl td:nth-child(4) { min-width: 130px; }
.bulk-tbl td:nth-child(5), .bulk-tbl td:nth-child(8) { min-width: 86px; }

/* ---------- Phiếu báo phí (ảnh gửi khách: luôn nền trắng) ---------- */
.inv-scroll { overflow-x: auto; margin: 0 -8px; padding: 0 8px; }
.inv { width: 720px; max-width: none; background: #fff; color: #111; padding: 22px 22px 18px; border: 1px solid #e5e7eb; border-radius: 10px; font-size: 14px; display: flex; flex-direction: column; gap: 12px; margin: 0 auto; }
.inv-h { display: flex; justify-content: space-between; gap: 16px; padding-bottom: 12px; border-bottom: 2px solid #1f3b66; }
.inv-h > div { display: flex; flex-direction: column; gap: 2px; }
.inv-shop { font-size: 18px; color: #1f3b66; }
.inv-h small { color: #555; }
.inv-title { text-align: right; }
.inv-title b { font-size: 20px; color: #1f3b66; letter-spacing: .04em; }
.inv-cust { display: flex; gap: 24px; flex-wrap: wrap; }
.inv-tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.inv-tbl th { background: #1f3b66; color: #fff; padding: 7px 6px; text-align: left; font-weight: 600; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.inv-tbl td { padding: 6px; border-bottom: 1px solid #e5e7eb; }
.inv-tbl small { color: #666; }
.inv-tbl .r { text-align: right; white-space: nowrap; }
.inv-tbl tfoot td { font-weight: 700; background: #fff2cc; border-bottom: 0; }
.inv-pay { display: flex; gap: 16px; align-items: center; padding: 12px; border-radius: 10px; background: #f4f6fa; }
.inv-pay p { margin: 2px 0; }
.inv-qr { width: 150px; height: 150px; border-radius: 8px; background: #fff; padding: 4px; flex: none; }
.inv-ask { font-weight: 700; color: #1f3b66; }
.inv-warn { color: #b45309; }
.inv-thanks { text-align: center; font-style: italic; color: #1f3b66; margin: 0; }
.msg-preview { padding: 10px 12px; border-radius: var(--r-sm); background: var(--surface-2); white-space: pre-wrap; font-size: .9rem; }
.var-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.var-chips .chip { font-size: .78rem; padding: 4px 10px; }
.var-chips small { color: var(--muted); font-size: .72rem; }

/* ---------- Tổng quan ---------- */
.tq-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 14px; }
.tq-list { display: flex; flex-direction: column; }
.tq-row { display: flex; align-items: center; gap: 10px; padding: 10px 6px; border: 0; border-bottom: 1px solid var(--line); background: transparent; color: var(--text); font: inherit; text-align: left; cursor: pointer; border-radius: 0; }
.tq-row:last-child { border-bottom: 0; }
.tq-row:hover { background: var(--surface-2); }
.tq-row .grow { display: flex; flex-direction: column; min-width: 0; }
.tq-row small { font-size: .8rem; }
.tq-ic { width: 30px; text-align: center; font-size: 20px; }
.period-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.period-grid > div { display: flex; flex-direction: column; gap: 2px; }
.period-grid span { font-size: .78rem; color: var(--muted); }
.period-grid b { font-size: 1.15rem; font-variant-numeric: tabular-nums; }
.period-grid .good b { color: var(--good); }
.kpi.hero .trend { display: inline-flex; align-items: center; gap: 3px; padding: 2px 8px; border-radius: 99px; font-weight: 700; font-size: .74rem; background: rgba(255, 255, 255, .18); color: #fff; }
.kpi.hero .trend.dn { background: rgba(0, 0, 0, .18); }
.kpi.hero .money.neg { color: #ffd1d1 !important; }
.rc { display: flex; flex-direction: column; gap: 8px; }
.rc-bars { display: flex; align-items: flex-end; gap: 4px; height: 200px; padding-top: 6px; border-bottom: 1px solid var(--line); }
.rc-col { flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 4px; cursor: pointer; min-width: 0; transition: opacity .15s; }
.rc-col.dim { opacity: .78; }
.rc-col small { font-size: .66rem; color: var(--muted); white-space: nowrap; height: 14px; }
.rc-stack { display: flex; flex-direction: column; gap: 2px; width: min(70%, 26px); transition: height .9s cubic-bezier(.34, 1.25, .5, 1); }
.rc-seg { display: block; min-height: 0; }
.rc-seg.c1 { background: var(--c1); }
.rc-seg.c2 { background: var(--c2); }
.rc-stack .rc-seg:first-child { border-radius: 4px 4px 0 0; }
.dot.c1 { background: var(--c1); }
.dot.c2 { background: var(--c2); }
.tx-row { display: flex; align-items: center; gap: 12px; padding: 10px 8px; }
.tx-row .grow { display: flex; flex-direction: column; }
.tx-row small { font-size: .78rem; }
.tx-date { font-size: .78rem; color: var(--muted); width: 104px; flex: none; }
.tx-row .money { font-weight: 700; }
@media (max-width: 520px) { .tx-date { width: 70px; } }
.cash-sum { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.cash-sum > div { flex: 1 1 140px; display: flex; flex-direction: column; padding: 12px 14px; border-radius: var(--r); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); }
.cash-sum > i { font-style: normal; font-weight: 700; color: var(--muted); }
.cash-sum span { font-size: .78rem; color: var(--muted); }
.cash-sum b { font-size: 1.2rem; font-variant-numeric: tabular-nums; }
.cash-sum .good b { color: var(--good); }
.cash-sum .bad b { color: var(--bad); }
.cash-sum .hero { background: linear-gradient(135deg, var(--hero-a), var(--hero-b)); color: #fff; border-color: transparent; }
.cash-sum .hero span { color: rgba(255, 255, 255, .85); }
@media (max-width: 640px) { .cash-sum > i { display: none; } .cash-sum > div { flex-basis: calc(50% - 4px); } }

/* ---------- Nhân viên & quyền (mục 16) ---------- */
.r-admin { --rc: var(--r-admin); --rs: var(--r-admin-soft); }
.r-soan { --rc: var(--warn); --rs: var(--warn-soft); }
.r-in { --rc: var(--primary); --rs: var(--primary-soft); }
.r-kiem { --rc: var(--r-kiem); --rs: var(--r-kiem-soft); }
.r-none { --rc: var(--muted); --rs: var(--surface-2); }
.nv-ic { display: grid; place-items: center; flex: none; width: 38px; height: 38px; border-radius: 11px; background: var(--rs); color: var(--rc); font-size: 18px; }
.nv-sum { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 10px; }
.nv-stat { display: flex; align-items: center; gap: 12px; text-align: left; font: inherit; color: var(--text); cursor: pointer;
  background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--rc); border-radius: var(--r); padding: 12px 14px; box-shadow: var(--shadow); transition: transform .15s, border-color .15s, background .15s; }
.nv-stat:hover { transform: translateY(-1px); }
.nv-stat.on { background: var(--rs); border-color: var(--rc); }
.nv-stat b { display: block; font-size: .95rem; }
.nv-stat small { display: block; color: var(--muted); font-size: .76rem; }
.nv-stat em { font-style: normal; font-weight: 700; font-size: 1.35rem; color: var(--rc); font-variant-numeric: tabular-nums; }
@media (max-width: 699px) {
  .nv-sum { grid-template-columns: 1fr 1fr; gap: 8px; }
  .nv-stat { padding: 9px 10px; gap: 8px; border-left-width: 3px; }
  .nv-stat small { display: none; }
  .nv-stat .nv-ic { width: 30px; height: 30px; font-size: 15px; border-radius: 9px; }
  .nv-stat b { font-size: .85rem; }
  .nv-stat em { font-size: 1.1rem; }
}
.nv-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 10px; }
.nv-card { position: relative; display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; align-items: center; text-align: left; font: inherit; color: var(--text);
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 14px; cursor: pointer; overflow: hidden; box-shadow: var(--shadow); transition: transform .15s, box-shadow .15s, border-color .15s; }
.nv-card::before { content: ''; position: absolute; inset: 0 0 auto; height: 3px; background: var(--rc); }
.nv-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); border-color: var(--rc); }
.nv-av { grid-row: span 2; display: grid; place-items: center; width: 46px; height: 46px; border-radius: 50%; background: var(--rs); color: var(--rc); font-weight: 700; font-size: .95rem; }
.nv-info { display: flex; flex-direction: column; min-width: 0; }
.nv-info b { font-size: .98rem; }
.nv-info small { font-size: .78rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nv-role { justify-self: start; display: inline-flex; gap: 5px; align-items: center; font-size: .76rem; font-weight: 600; padding: 3px 10px; border-radius: 99px; background: var(--rs); color: var(--rc); }
.nv-pick { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 8px; margin-top: 4px; }
.nv-opt { position: relative; display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1.5px solid var(--line); border-radius: var(--r-sm); cursor: pointer; background: var(--surface); transition: border-color .15s, background .15s; }
.nv-opt input { position: absolute; opacity: 0; pointer-events: none; }
.nv-opt b { display: block; font-size: .92rem; color: var(--text); }
.nv-opt small { display: block; font-size: .76rem; color: var(--muted); line-height: 1.35; font-weight: 400; }
.nv-opt:has(input:checked) { border-color: var(--rc); background: var(--rs); box-shadow: 0 0 0 3px var(--rs); }
.nv-opt:has(input:checked) b { color: var(--rc); }
.nv-opt:has(input:focus-visible) { outline: 2px solid var(--rc); outline-offset: 2px; }
.nv-opt:has(input:disabled) { cursor: not-allowed; opacity: .6; }

/* ---------- Nhập Excel ---------- */
.imp-backup { flex-direction: row; align-items: center; flex-wrap: wrap; }
.imp-step { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.imp-step .hint { margin-top: 2px; }
.drop { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; min-height: 150px; padding: 20px; text-align: center; cursor: pointer;
  border: 2px dashed var(--line); border-radius: var(--r); background: var(--surface-2); color: var(--muted); transition: border-color .15s, background .15s; }
.drop:hover, .drop.on { border-color: var(--primary); background: var(--primary-soft); color: var(--primary); }
.drop-ic { display: grid; place-items: center; width: 56px; height: 56px; border-radius: 50%; background: var(--surface); color: var(--primary); }
.drop.on .drop-ic { animation: promoBounce .8s ease-in-out infinite; }
.mode-pick { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 640px) { .mode-pick { grid-template-columns: 1fr; } }
.mode-card { display: flex; flex-direction: column; gap: 4px; align-items: flex-start; padding: 12px 14px; border: 1.5px solid var(--line); border-radius: var(--r-sm); background: var(--surface); color: var(--text); font: inherit; text-align: left; cursor: pointer; }
.mode-card small { color: var(--muted); }
.mode-card.on { border-color: var(--primary); background: var(--primary-soft); box-shadow: 0 0 0 3px var(--focus); }
.mode-card.danger.on { border-color: var(--bad); background: var(--bad-soft); box-shadow: 0 0 0 3px color-mix(in srgb, var(--bad) 20%, transparent); }
.imp-warn { margin: 0; padding: 10px 12px; border-radius: var(--r-sm); background: var(--bad-soft); color: var(--bad); font-weight: 600; }
.imp-tbl tr.err td { background: var(--bad-soft); }
.imp-tbl tr.skip td { color: var(--muted); }
.imp-note { min-width: 200px; font-size: .84rem; }
.imp-tbl tr.err .imp-note { color: var(--bad); font-weight: 600; }
.imp-bar { position: sticky; bottom: calc(var(--tabbar) + 10px + env(safe-area-inset-bottom)); z-index: 15; display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 10px 14px; border-radius: var(--r); background: var(--surface); border: 1px solid var(--primary); box-shadow: 0 10px 30px -10px var(--cta-shadow); }
@media (min-width: 900px) { .imp-bar { bottom: 16px; } }
.imp-prog { align-items: center; text-align: center; padding: 30px 20px; }
.prog { width: 100%; max-width: 520px; height: 14px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.prog i { display: block; height: 100%; border-radius: 99px; transition: width .3s;
  background: repeating-linear-gradient(45deg, var(--primary) 0 12px, var(--primary-2) 12px 24px); background-size: 34px 34px; animation: progMove 1s linear infinite; }
@keyframes progMove { to { background-position: 34px 0; } }
.imp-done { align-items: center; text-align: center; padding: 26px 20px; }
.draw-check { width: 64px; height: 64px; }
.draw-check circle { fill: none; stroke: var(--good); stroke-width: 3; stroke-dasharray: 160; stroke-dashoffset: 160; animation: drawLine .5s ease forwards; }
.draw-check path { fill: none; stroke: var(--good); stroke-width: 4; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 40; stroke-dashoffset: 40; animation: drawLine .35s .45s ease forwards; }
@keyframes drawLine { to { stroke-dashoffset: 0; } }
.imp-sum { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.imp-sum > div { display: flex; flex-direction: column; padding: 10px 16px; border-radius: var(--r-sm); background: var(--surface-2); animation: bootPopSm .3s ease both; }
.imp-sum b { font-size: 1.3rem; color: var(--primary); }
.imp-sum span { font-size: .8rem; color: var(--muted); }
@keyframes bootPopSm { from { transform: scale(.85); opacity: 0; } }

/* Màn hình chờ khi mở app */
.boot { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px;
  background: radial-gradient(circle at 50% 35%, #1d3a6e 0%, #0f2447 55%, #0b1c3a 100%); color: #fff; }

/* Tổng quan (mục 19): máy tính 4 ô một hàng, ô đầu rộng hơn; điện thoại ô đầu cả hàng */
@media (min-width: 900px) { .kpis-4 { grid-template-columns: 1.3fr 1fr 1fr 1fr; } .kpis-4 .kpi.hero { grid-column: auto; } }

/* ---------- Bảng dạng thẻ gọn trên điện thoại ---------- */
.dt-cards { display: flex; flex-direction: column; gap: 8px; }
.dt-card { display: flex; flex-direction: column; gap: 6px; padding: 12px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface); animation: gtFadeInUp .3s ease both; }
.dt-card.clickable { cursor: pointer; }
.dt-card.clickable:active { background: var(--surface-2); }
.dt-card.dim { opacity: .6; }
.dc-h { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.dc-sub { font-size: .84rem; line-height: 1.5; }
.dc-nums { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.dc-nums span { display: block; font-size: .7rem; color: var(--muted); }
.dc-nums b { font-size: .86rem; }
@media (max-width: 360px) { .dc-nums { grid-template-columns: 1fr 1fr; } }
.dc-act { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.dt-cardsum { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 10px; border-radius: var(--r-sm); background: var(--warn-soft); }
.dt-cardsum span { display: block; font-size: .7rem; color: var(--muted); }
.dt-cardsum b { font-size: .9rem; }
@media (max-width: 640px) { .demo-bar { font-size: .78rem; gap: 6px; margin: 8px 12px 0; } .demo-bar .muted.small { display: none; } }

/* Thông báo: xem trước kiểu thông báo Android */
.notif-preview { display: flex; gap: 10px; align-items: flex-start; padding: 12px; border-radius: 16px; background: var(--surface-2); border: 1px solid var(--line); }
.notif-preview img { border-radius: 10px; flex: none; }
.notif-preview .grow { display: flex; flex-direction: column; gap: 2px; }
.notif-preview span { font-size: .86rem; white-space: pre-line; color: var(--muted); }
.install-tip ol { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; line-height: 1.5; }
.ord-moved { display: inline-block; margin-top: 2px; font-size: .7rem; font-weight: 600; padding: 1px 6px; border-radius: 99px; background: var(--warn-soft); color: var(--warn); white-space: nowrap; }
