/* Màn vận hành iTN (anh Nghĩa chọn P2, 26/09/2026): KPI matrix Tổng quan · trung tâm thông báo · bảng lương.
   Chỉ dùng token theme (themes.css / app-shell.css) để 7 theme đều đạt tương phản. Bo góc ≤ 8px, viền chỉ để phân tách dữ liệu,
   không bóng đổ nặng, không gradient. Chữ số tiền: tabular-nums + không xuống dòng. */

/* ══ KPI MATRIX ══════════════════════════════════════════════════════════════════════════════════════
   Một khối, các ô ngăn bằng đường 1px. Bố cục theo BỀ RỘNG KHỐI (container query), không theo viewport:
   ≥ 720px 4 cột · 330–719px 2×2 · < 330px 1 cột. Cỡ số co theo bề rộng ô (cqi) trong khoảng 20–30px. */
.kmx-bao { container: kmx / inline-size; width: 100%; margin: 16px 0 8px; }
.kmx { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
  background: var(--bg-card); border: 1px solid var(--border-color); border-radius: 8px; overflow: hidden; }
.kmx-o { container: kmxo / inline-size; min-width: 0; padding: 14px 16px 12px; border-left: 1px solid var(--border-color); }
.kmx-o:first-child { border-left: 0; }
@container kmx (max-width: 719px) {
  .kmx { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kmx-o:nth-child(odd) { border-left: 0; }
  .kmx-o:nth-child(n + 3) { border-top: 1px solid var(--border-color); }
}
@container kmx (max-width: 329px) {
  .kmx { grid-template-columns: minmax(0, 1fr); }
  .kmx-o { border-left: 0; }
  .kmx-o + .kmx-o { border-top: 1px solid var(--border-color); }
}
/* Hàng Trả góp (tổng + từng nhà tài chính) và hàng Kho dời xuống (anh Nghĩa 09/11/2026). Máy tính: góp tự chia cột; điện thoại 2 cột như trên. */
.kmx-bao.kmx-bao-gop, .kmx-bao.kmx-bao-kho { margin-top: 8px; }
.kmx.kmx-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@container kmx (min-width: 720px) {
  .kmx.kmx-gop { grid-template-columns: repeat(var(--gop-cot, 4), minmax(0, 1fr)); }
  .kmx.kmx-gop .kmx-o:nth-child(n + 5) { border-top: 1px solid var(--border-color); }
}
@container kmx (max-width: 329px) { .kmx.kmx-2 { grid-template-columns: minmax(0, 1fr); } }
/* Tránh container query không được hỗ trợ (WebKit rất cũ): điện thoại vẫn 2×2. */
@supports not (container-type: inline-size) { @media (max-width: 719px) { .kmx { grid-template-columns: repeat(2, minmax(0, 1fr)); } } }
.kmx-nhan { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 24px; font-size: 13px; line-height: 1.3; color: var(--text-muted); white-space: nowrap; }
.kmx-nhan > span { overflow: hidden; text-overflow: ellipsis; }
/* Số chính: nút (bấm = xem số đầy đủ). Không viền, không nền — nhìn như chữ; focus rõ. */
.kmx-so { display: inline-flex; align-items: baseline; gap: 4px; max-width: 100%; margin: 4px 0 0; padding: 0; border: 0; background: none; font: inherit;
  color: var(--text-main); white-space: nowrap; font-variant-numeric: tabular-nums; text-align: left; cursor: pointer; border-radius: 6px; }
.kmx-so:focus-visible { outline: 2px solid var(--theme-accent-strong); outline-offset: 3px; }
.kmx-v { font-size: clamp(20px, 13cqi, 30px); line-height: 1.15; font-weight: 700; letter-spacing: -.01em; }
.kmx-dv { font-size: 14px; font-weight: 600; color: var(--text-muted); }
.kmx-so.kmx-dem { cursor: default; }
/* Số bấm được → mở màn Hóa đơn lọc sẵn (10/11/2026): gạch chân nhẹ để biết bấm được, màu chữ giữ nguyên. */
.kmx-so.kmx-hd .kmx-v { text-decoration: underline; text-decoration-color: var(--border-color); text-underline-offset: 4px; text-decoration-thickness: 2px; }
.kmx-so.kmx-hd:hover .kmx-v { text-decoration-color: var(--txt-accent, #0a66c2); }
.kmx-so.is-am .kmx-v, .kmx-so.is-am .kmx-dv { color: var(--txt-bad); }
.kmx-so.is-an, .kmx-so.is-trong { display: block; font-size: 24px; line-height: 1.15; font-weight: 700; letter-spacing: .08em; color: var(--text-muted); cursor: default; }
.kmx-phu { min-height: 18px; margin-top: 4px; font-size: 12.5px; line-height: 1.4; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }
/* Dòng "máy đang Spa" dưới ô Máy tồn sẵn sàng (30/09/2026): được xuống dòng ở khổ hẹp thay vì cắt chữ; số đậm để quét nhanh. */
.kmx-phu.kmx-spa { margin-top: 2px; white-space: normal; }
.kmx-phu.kmx-spa strong { color: var(--text-main); font-weight: 700; }
.kmx-phu.kmx-spa .kmx-spa-cn { white-space: nowrap; }
.kmx-day { color: var(--text-main); font-weight: 600; }
.kmx-canh { display: inline-flex; align-items: center; gap: 4px; color: var(--txt-warn); }
.kmx-canh.is-bad { color: var(--txt-bad); }
.kmx-canh svg { flex: none; }
.kmx-xh { margin-top: 6px; height: 24px; color: var(--txt-accent); }
.kmx-xh .itn-spark { display: block; }
@container kmxo (max-width: 200px) { .kmx-xh { display: none; } }
/* Không có quyền: chữ mờ + ổ khoá, không số, không nút mắt. */
.kmx-khoa { display: flex; align-items: center; gap: 6px; min-height: 52px; margin-top: 4px; font-size: 13px; color: var(--text-muted); }
.kmx-khoa svg { flex: none; }
/* Đang tải: vạch mờ đúng chỗ số (không nhảy bố cục khi số về). */
.kmx-so.is-cho { display: block; cursor: default; }
.kmx-sk { display: block; width: 72%; max-width: 140px; height: 26px; border-radius: 6px; background: var(--bg-input); animation: kmx-nhip 1.4s ease-in-out infinite; }
.kmx-sk.is-ngan { width: 50%; height: 12px; margin-top: 4px; }
@keyframes kmx-nhip { 50% { opacity: .5; } }
@media (prefers-reduced-motion: reduce) { .kmx-sk { animation: none; } }
@media (max-width: 640px) { .kmx-bao { margin-top: 12px; } .kmx-o { padding: 12px 14px 10px; } }
/* Điện thoại (13/10/2026, đo 390px): số KPI là nút chỉ cao một dòng chữ (~24px) — dưới chuẩn ô bấm 44px. Nới VÙNG CHẠM bằng ::after
   (10px trên / dưới) chứ không nới hộp nút: khung 2×2 giữ nguyên chiều cao, số vẫn một dòng. Phần nới chỉ đè lên chữ nhãn / dòng phụ
   (không bấm được); nút mắt nằm cuối dòng nhãn, cách xa số nên hai vùng không chồng nhau. Chỉ nút thật (button), không ô đang ẩn. */
@media (max-width: 760px) {
  button.kmx-so { position: relative; }
  button.kmx-so::after { content: ""; position: absolute; inset: -10px -4px; }
}

/* ══ TRUNG TÂM THÔNG BÁO ═════════════════════════════════════════════════════════════════════════════
   Chuông 44×44 ở thanh đầu, trước nút tài khoản; số chưa đọc là nhãn nhỏ lệch góc (không che hình chuông).
   Ngăn bên phải 400px (điện thoại: toàn bề ngang, dừng ngay trên thanh tab đáy — không che điều hướng). */
.tb-nut { position: relative; display: inline-grid; place-items: center; flex: none; width: 44px; height: 44px; padding: 0; border: 1px solid var(--border-color);
  border-radius: 8px; background: var(--bg-card); color: var(--text-main); cursor: pointer; }
.tb-nut:hover { background: var(--bg-card-hover, var(--bg-card)); }
.tb-nut:focus-visible { outline: 2px solid var(--theme-accent-strong); outline-offset: 2px; }
.tb-nut[aria-expanded="true"] { border-color: var(--theme-accent-strong); color: var(--txt-accent); }
.tb-dem { position: absolute; top: -9px; right: -9px; min-width: 20px; height: 20px; padding: 0 5px; box-sizing: border-box; display: grid; place-items: center;
  border-radius: 8px; border: 2px solid var(--bg-card); background: var(--theme-danger, #c0262d); color: var(--bg-card); font-size: 11px; font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums; }
.tb-ic { flex: none; }
.tb-nen { position: fixed; inset: var(--tb-tren, 0px) 0 var(--tb-day, 0px) 0; z-index: 45; background: rgba(15, 23, 42, .18); }
.tb-ngan { position: fixed; top: var(--tb-tren, 0px); right: 0; bottom: var(--tb-day, 0px); z-index: 46; width: min(400px, 100%); display: flex; flex-direction: column;
  background: var(--bg-app, var(--bg-card)); color: var(--text-main); border-left: 1px solid var(--border-color); box-shadow: -8px 0 24px rgba(15, 23, 42, .12); }
.tb-dau { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: calc(12px + env(safe-area-inset-top, 0px)) 12px 8px 16px; background: var(--bg-card); }
@media (max-width: 760px) { .tb-dau { padding-top: 10px; } .tb-ngan { border-top: 1px solid var(--border-color); } }
.tb-dau h2 { margin: 0; font-size: 18px; display: flex; align-items: baseline; gap: 8px; }
.tb-dem-chu { font-size: 13px; font-weight: 600; color: var(--text-muted); }
.tb-cong { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; padding: 4px 12px 10px 16px; background: var(--bg-card); border-bottom: 1px solid var(--border-color); }
.tb-loc { display: inline-flex; padding: 2px; border: 1px solid var(--border-color); border-radius: 8px; background: var(--bg-input); }
.tb-loc button { min-height: 40px; padding: 0 14px; border: 0; border-radius: 6px; background: none; color: var(--text-muted); font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; }
.tb-loc button[aria-pressed="true"] { background: var(--bg-card); color: var(--text-main); box-shadow: 0 0 0 1px var(--border-color); }
.tb-loc button:focus-visible, .tb-link:focus-visible, .tb-btn:focus-visible, .tb-muc:focus-visible, .tb-nguon summary:focus-visible { outline: 2px solid var(--theme-accent-strong); outline-offset: 2px; }
.tb-link { min-height: 44px; padding: 0 4px; border: 0; background: none; color: var(--txt-accent); font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; }
.tb-link:disabled { color: var(--text-muted); cursor: default; }
.tb-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; min-width: 44px; padding: 0 14px; border: 1px solid var(--border-color); border-radius: 8px; background: var(--bg-card); color: var(--text-main); font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; }
.tb-btn.tb-icon { padding: 0; width: 44px; }
.tb-than { flex: 1; overflow: auto; overscroll-behavior: contain; padding: 8px 0 16px; }
.tb-ds { list-style: none; margin: 0; padding: 0; }
.tb-ds li + li { border-top: 1px solid var(--border-color); }
.tb-muc { display: flex; align-items: flex-start; gap: 12px; min-height: 64px; padding: 12px 16px; color: var(--text-main); text-decoration: none; }
.tb-muc:hover { background: var(--bg-card-hover, var(--bg-card)); }
.tb-muc-ic { display: grid; place-items: center; width: 36px; height: 36px; flex: none; border-radius: 8px; background: var(--theme-accent-soft); color: var(--txt-accent); }
.tb-muc-b { display: grid; gap: 2px; min-width: 0; flex: 1; }
.tb-muc-t { font-size: 14px; font-weight: 600; line-height: 1.35; }
.tb-muc.is-moi .tb-muc-t { font-weight: 700; }
.tb-muc-m { font-size: 13px; line-height: 1.4; color: var(--text-muted); overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.tb-muc-p { font-size: 12px; color: var(--text-muted); }
.tb-cham { flex: none; width: 10px; height: 10px; margin-top: 6px; border-radius: 50%; background: var(--theme-accent-strong); }
.tb-trong { display: grid; justify-items: center; gap: 6px; padding: 40px 20px; text-align: center; color: var(--text-muted); }
.tb-trong-t { margin: 0; font-size: 16px; font-weight: 700; color: var(--text-main); }
.tb-trong-h { margin: 0 0 8px; font-size: 14px; line-height: 1.45; }
.tb-trong.is-loi .tb-ic { color: var(--txt-bad); }
.tb-muc.is-cho { pointer-events: none; }
.tb-sk { display: block; height: 12px; width: 80%; border-radius: 6px; background: var(--bg-input); animation: kmx-nhip 1.4s ease-in-out infinite; }
.tb-sk.is-ngan { width: 50%; margin-top: 6px; }
.tb-sk-ic { width: 36px; height: 36px; border-radius: 8px; flex: none; }
.tb-nguon { margin: 12px 16px 0; padding-top: 8px; border-top: 1px solid var(--border-color); font-size: 13px; }
.tb-nguon summary { min-height: 44px; display: flex; align-items: center; font-weight: 600; color: var(--text-muted); cursor: pointer; }
.tb-nguon ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.tb-nguon li { display: flex; justify-content: space-between; gap: 10px; }
.tb-nguon-t { display: inline-flex; align-items: center; gap: 6px; color: var(--text-main); }
.tb-nguon-s { text-align: right; color: var(--text-muted); }
.tb-nguon-s.is-co { color: var(--txt-ok); }
.tb-nguon-s.is-loi { color: var(--txt-bad); }
.tb-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.tb-sr-nho { margin: 8px 0 0; color: var(--text-muted); font-size: 12px; }
body.tb-mo { overflow: hidden; }
@media (max-width: 760px) {
  .tb-ngan { width: 100%; border-left: 0; }
}
@media (prefers-reduced-motion: no-preference) { .tb-ngan { animation: tb-vao .18s ease-out; } @keyframes tb-vao { from { transform: translateX(16px); opacity: .6; } } }
@media (prefers-reduced-motion: reduce) { .tb-sk { animation: none; } }
.tb-dau-nut { display: inline-flex; gap: 4px; flex: none; }
.tb-nguon-s.is-tat { color: var(--text-muted); font-style: italic; }
/* ── Cài đặt thông báo (27/09/2026): cùng ngăn; mỗi dòng = tên + mô tả | ô Chuông | ô iPhone (44×44). Không thẻ trong thẻ. ── */
.tb-cd .tb-dau h2 { flex: 1; min-width: 0; }
.tb-cd .tb-dau h2:focus { outline: none; }
.tb-cd .tb-dau h2:focus-visible { outline: 2px solid var(--theme-accent-strong); outline-offset: 2px; }
.tb-cd-cong { flex-wrap: nowrap; align-items: flex-start; padding-top: 0; }
.tb-cd-gt { margin: 0; font-size: 13px; line-height: 1.4; color: var(--text-muted); min-width: 0; }
.tb-cd-tt { flex: none; display: inline-flex; align-items: center; gap: 4px; min-height: 20px; font-size: 13px; font-weight: 600; }
.tb-cd-luu { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.tb-cd-luu.is-dang { color: var(--text-muted); }
.tb-cd-luu.is-xong { color: var(--txt-ok); }
.tb-cd-luu.is-loi { color: var(--txt-bad); white-space: normal; }
.tb-cd-tt .tb-link { min-height: 32px; }
.tb-cd .tb-than { padding-top: 0; }
.tb-cd-cot { position: sticky; top: 0; z-index: 1; display: grid; grid-template-columns: 1fr 52px 52px; gap: 0 4px; align-items: center; padding: 8px 12px 6px 16px;
  background: var(--bg-card); border-bottom: 1px solid var(--border-color); font-size: 12px; font-weight: 600; color: var(--text-muted); }
.tb-cd-cot span + span { text-align: center; }
.tb-cd-nhom + .tb-cd-nhom { border-top: 1px solid var(--border-color); }
.tb-cd-nhom-dau { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 12px 0 16px; }
.tb-cd-nhom-dau h3 { margin: 0; font-size: 14px; font-weight: 700; color: var(--text-main); }
.tb-cd-nhom-dau .tb-link { flex: none; font-size: 13px; }
.tb-cd-ds { list-style: none; margin: 0; padding: 0 0 6px; }
.tb-cd-dong { display: grid; grid-template-columns: 1fr 52px 52px; gap: 0 4px; align-items: center; min-height: 44px; padding: 6px 12px 6px 16px; }
.tb-cd-ten { display: grid; gap: 2px; min-width: 0; }
.tb-cd-t { font-size: 14px; font-weight: 600; line-height: 1.35; color: var(--text-main); }
.tb-cd-m { font-size: 13px; line-height: 1.4; color: var(--text-muted); overflow-wrap: anywhere; }
.tb-cd-ghi { font-size: 12px; line-height: 1.4; color: var(--text-muted); }
.tb-cd-ghi-nhom { margin: 2px 12px 0 16px; }
.tb-cd-dong.is-mo .tb-cd-t { color: var(--text-muted); font-weight: 500; }
.tb-cd-o { display: grid; place-items: center; width: 44px; height: 44px; margin: 0 auto; border-radius: 8px; cursor: pointer; }
.tb-cd-o:hover { background: var(--bg-card-hover, var(--bg-input)); }
.tb-cd-o input { width: 22px; height: 22px; margin: 0; accent-color: var(--theme-accent-strong); cursor: pointer; }
.tb-cd-o input:focus-visible { outline: 2px solid var(--theme-accent-strong); outline-offset: 3px; }
.tb-cd-o.is-khoa { cursor: default; color: var(--txt-accent); }
.tb-cd-o.is-khoa:hover, .tb-cd-o.is-khong:hover { background: none; }
.tb-cd-o.is-khong { cursor: default; color: var(--text-muted); font-size: 14px; }
.tb-cd-chu { margin: 12px 16px 0; line-height: 1.45; }

/* ══ BẢNG LƯƠNG ══════════════════════════════════════════════════════════════════════════════════════
   Một màn, công tắc Bảng / Tóm tắt; chung bộ lọc + chung ngăn chi tiết. Số tiền căn phải, chữ số đều, không xuống dòng.
   Máy tính / tablet: bảng (tablet bớt cột phụ). Điện thoại: danh sách tóm tắt — không bảng ngang. */
.bl-trang { max-width: 1180px; margin: 0 auto; padding: 4px 0 24px; color: var(--text-main); min-width: 0; }
.bl-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.bl-head h1 { margin: 0; font-size: 26px; letter-spacing: -.01em; }
.bl-sub { margin: 4px 0 0; font-size: 14px; color: var(--text-muted); }
.bl-mau { margin: 2px 0 0; font-size: 12px; color: var(--text-muted); }   /* Cửa hàng trải nghiệm: nguồn là dữ liệu mẫu (28/09/2026) */
.bl-dk { display: flex; gap: 8px; align-items: center; }
.bl-xem { display: inline-flex; padding: 2px; border: 1px solid var(--border-color); border-radius: 8px; background: var(--bg-input); }
.bl-xem button { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 14px; border: 0; border-radius: 6px; background: none; color: var(--text-muted); font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; }
.bl-xem button[aria-pressed="true"] { background: var(--bg-card); color: var(--text-main); box-shadow: 0 0 0 1px var(--border-color); }
.bl-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; min-width: 44px; padding: 0 14px; border: 1px solid var(--border-color); border-radius: 8px; background: var(--bg-card); color: var(--text-main); font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; white-space: nowrap; }
.bl-btn.bl-sm { padding: 0 8px 0 12px; gap: 2px; font-size: 13px; }
.bl-btn.bl-icon { padding: 0; width: 44px; }
.bl-trang :focus-visible, .bl-ngan :focus-visible { outline: 2px solid var(--theme-accent-strong); outline-offset: 2px; }
.bl-loc { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; padding: 12px 14px; background: var(--bg-card); border: 1px solid var(--border-color); border-radius: 8px; }
.bl-sel { display: grid; gap: 4px; flex: 0 1 180px; font-size: 13px; font-weight: 600; color: var(--text-muted); }
.bl-sel select, .bl-tim input { min-height: 44px; box-sizing: border-box; width: 100%; padding: 0 12px; border: 1px solid var(--border-color); border-radius: 8px; background: var(--bg-input); color: var(--text-main); font: inherit; font-size: 15px; }
.bl-tim-o { flex: 1 1 200px; position: relative; min-width: 0; }
.bl-tim { display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 0 0 12px; border: 1px solid var(--border-color); border-radius: 8px; background: var(--bg-input); color: var(--text-muted); }
.bl-tim input { border: 0; padding-left: 0; background: transparent; outline: none; }
/* 10/11/2026: luật chung của giao diện (themes.css `body[data-itn-theme] :focus-visible` 3px !important) thắng `outline: none` ở trên → ô tìm bị
   hai viền xanh chồng nhau, viền trong lệch khỏi khung; viền focus chỉ để ở khung .bl-tim (:focus-within). */
body .bl-trang .bl-tim input:focus-visible, body[data-itn-theme] .bl-trang .bl-tim input:focus-visible { outline: none !important; }
.bl-goi-y { position: absolute; z-index: 30; left: 0; right: 0; top: calc(100% + 6px); margin: 0; padding: 4px; list-style: none; max-height: 320px; overflow-y: auto; background: var(--bg-card); border: 1px solid var(--border-color); border-radius: 10px; box-shadow: 0 10px 28px rgba(0, 0, 0, .16); }
.bl-goi-y li { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; min-height: 44px; box-sizing: border-box; padding: 10px 12px; border-radius: 8px; cursor: pointer; color: var(--text-main); }
.bl-goi-y li strong { font-weight: 600; overflow-wrap: anywhere; }
.bl-goi-y li small { flex: none; color: var(--text-muted); font-size: 13px; }
.bl-goi-y li:hover, .bl-goi-y li[aria-selected="true"] { background: var(--bg-input); }
/* Bảng chấm công chi tiết trong ngăn lương (10/11/2026): nút ở khối Công, bảng từng ngày của kỳ. */
.bl-cc-nut { margin: 12px 0 0; }
.bl-cc-nut .bl-btn { min-height: 44px; }
.bl-cc { margin-top: 10px; }
.bl-cc-tom, .bl-cc-cho { margin: 0 0 8px; font-size: 14px; color: var(--text-main); line-height: 1.5; }
.bl-cc-cho { display: flex; align-items: center; gap: 8px; color: var(--text-muted); }
.bl-cc-cho .bl-spin { width: 18px; height: 18px; border-width: 2px; }
.bl-cc-bao { max-height: 420px; overflow: auto; border: 1px solid var(--border-color); border-radius: 8px; }
.bl-cc-bang { width: 100%; border-collapse: collapse; font-size: 14px; }
.bl-cc-bang th, .bl-cc-bang td { padding: 8px 10px; text-align: left; border-bottom: 1px solid var(--border-color); vertical-align: top; }
.bl-cc-bang thead th { position: sticky; top: 0; z-index: 1; background: var(--bg-card); font-size: 12px; font-weight: 600; color: var(--text-muted); }
.bl-cc-bang tbody th { font-weight: 600; white-space: nowrap; }
.bl-cc-bang tbody tr:last-child th, .bl-cc-bang tbody tr:last-child td { border-bottom: 0; }
.bl-cc-bang tr.is-trong th, .bl-cc-bang tr.is-trong td { color: var(--text-muted); font-weight: 400; }
.bl-cc-so { white-space: nowrap; font-variant-numeric: tabular-nums; }
.bl-cc-st { display: inline-block; padding: 1px 8px; border-radius: 999px; background: var(--bg-input); font-size: 12px; white-space: nowrap; }
.bl-cc-st.is-canh { background: color-mix(in srgb, #ff9500 18%, transparent); color: var(--text-main); }
/* Tạm ứng nhanh (10/11/2026): hộp nhập trong khung ngăn phải .bl-ngan — chọn nhân viên (gợi ý) + số tiền + dòng xem trước. */
.bl-dk { flex-wrap: wrap; justify-content: flex-end; }
.bl-tu-f { display: grid; gap: 14px; }
.bl-tu-o { display: block; margin-bottom: 6px; font-size: 13px; font-weight: 600; color: var(--text-muted); }
.bl-tu-i { display: block; min-height: 48px; box-sizing: border-box; width: 100%; padding: 0 12px; border: 1px solid var(--border-color); border-radius: 8px; background: var(--bg-input); color: var(--text-main); font: inherit; font-size: 16px; }
.bl-tu-i.bl-tu-tien { font-size: 20px; font-weight: 600; font-variant-numeric: tabular-nums; }
.bl-tu .bl-tim-o { flex: none; }
.bl-tu .bl-goi-y li { flex-direction: column; align-items: flex-start; gap: 2px; }   /* tên một dòng, chi tiết (phòng · chi nhánh · đã ứng) dòng dưới — không bẻ tên ở màn hẹp */
.bl-tu-nguoi:empty, .bl-tu-xem:empty { display: none; }
.bl-tu-nguoi { padding: 12px 14px; border: 1px solid var(--border-color); border-radius: 8px; background: var(--bg-card); }
.bl-tu-nguoi p { margin: 0 0 4px; font-size: 14px; line-height: 1.5; }
.bl-tu-nguoi p:last-child { margin-bottom: 0; }
.bl-tu-nguoi .bl-canh { margin-top: 8px; }
.bl-tu-ten { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px; }
.bl-tu-ten strong { font-size: 16px; overflow-wrap: anywhere; }
.bl-tu-ten span { color: var(--text-muted); font-size: 13px; }
.bl-tu-xem { margin: 0; font-size: 14px; line-height: 1.5; color: var(--text-main); }
.bl-tu-qua, .bl-canh.is-loi { color: var(--txt-bad); }
.bl-tu-f > .bl-canh { margin: 0; }
.bl-tu-nut { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 4px; }
.bl-tu-nut .bl-btn { min-height: 48px; }
.bl-tu-nut .bl-btn.is-chinh { flex: 1 1 160px; }
.bl-tu-nut .bl-btn:disabled { opacity: .5; cursor: not-allowed; }
.bl-tu-xong p { margin: 0 0 10px; font-size: 14px; line-height: 1.5; }
.bl-tu-ok { display: flex; align-items: flex-start; gap: 8px; font-size: 16px !important; }
.bl-tu-ok .bl-ic { flex: none; margin-top: 2px; color: var(--txt-good, #1a7f37); }
.bl-tim:focus-within { outline: 2px solid var(--theme-accent-strong); outline-offset: 1px; }
.bl-ghi { flex-basis: 100%; margin: 8px 2px 0; font-size: 12.5px; line-height: 1.45; color: var(--text-muted); }
.bl-loc .bl-ghi { margin: 0; }
.bl-canh { display: flex; align-items: flex-start; gap: 6px; margin: 10px 0 0; font-size: 13.5px; color: var(--txt-warn); }
/* Tổng các dòng đang hiện — một dải, ô ngăn bằng đường mảnh */
.bl-tong { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); margin: 12px 0; background: var(--bg-card); border: 1px solid var(--border-color); border-radius: 8px; overflow: hidden; }
.bl-tong > div { display: grid; gap: 2px; padding: 10px 14px; border-left: 1px solid var(--border-color); min-width: 0; }
.bl-tong > div:first-child { border-left: 0; }
.bl-tong span { font-size: 12.5px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bl-tong strong { font-size: 20px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.bl-tong .is-canh strong { color: var(--txt-warn); }
/* A · Bảng */
.bl-bang-bao { background: var(--bg-card); border: 1px solid var(--border-color); border-radius: 8px; overflow: hidden; }
.bl-bang { width: 100%; border-collapse: collapse; font-size: 14px; }
.bl-bang th { text-align: left; vertical-align: bottom; font-size: 12px; font-weight: 700; letter-spacing: .02em; text-transform: uppercase; color: var(--text-muted); padding: 10px 12px; border-bottom: 1px solid var(--border-color); background: var(--bg-card-hover, var(--bg-card)); white-space: nowrap; }
.bl-th-phu { display: block; font-size: 11px; font-weight: 600; text-transform: none; letter-spacing: 0; }
.bl-bang td { padding: 10px 12px; border-bottom: 1px solid var(--border-color); vertical-align: middle; }
.bl-bang tbody tr:last-child td { border-bottom: 0; }
.bl-tr { cursor: pointer; }
.bl-tr:hover td { background: var(--bg-card-hover, transparent); }
.bl-tr.is-mo td { background: var(--theme-accent-soft); }
.bl-so, .bl-bang th.bl-so { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.bl-act { width: 1%; text-align: right; white-space: nowrap; }
.bl-dim { color: var(--text-muted); }
.bl-num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.bl-st { display: inline-block; padding: 3px 8px; border-radius: 8px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.bl-st.is-ok { background: color-mix(in srgb, var(--txt-ok) 14%, transparent); color: var(--txt-ok); }
.bl-st.is-warn { background: color-mix(in srgb, var(--txt-warn) 14%, transparent); color: var(--txt-warn); }
.bl-st.is-bad { background: color-mix(in srgb, var(--txt-bad) 12%, transparent); color: var(--txt-bad); }
.bl-sk { display: block; height: 12px; width: 70%; border-radius: 6px; background: var(--bg-input); animation: kmx-nhip 1.4s ease-in-out infinite; }
.bl-sk.is-ngan { width: 50%; margin-left: auto; }
@media (max-width: 1180px) { .bl-c-phu { display: none; } }       /* tablet: bớt cột Thưởng / phạt, Đã chi nóng (xem trong ngăn) */
@media (max-width: 1024px) { .bl-c-cn, .bl-act .bl-dai { display: none; } .bl-bang th, .bl-bang td { padding-left: 10px; padding-right: 10px; } .bl-btn.bl-sm { padding: 0; width: 44px; } }
.bl-bang td:first-child, .bl-bang td.bl-c-vt { white-space: nowrap; }
/* B · Tóm tắt */
.bl-tt { list-style: none; margin: 12px 0 0; padding: 0; background: var(--bg-card); border: 1px solid var(--border-color); border-radius: 8px; overflow: hidden; }
.bl-tt li + li { border-top: 1px solid var(--border-color); }
.bl-tt-d { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 64px; padding: 10px 12px 10px 14px; border: 0; background: none; color: var(--text-main); font: inherit; text-align: left; cursor: pointer; }
.bl-tt-d:hover { background: var(--bg-card-hover, transparent); }
.bl-tt-b { display: grid; gap: 3px; min-width: 0; flex: 1; }
.bl-tt-1 { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.bl-tt-2, .bl-tt-3 { font-size: 13px; color: var(--text-muted); }
.bl-tt-so { display: grid; justify-items: end; flex: none; }
.bl-tt-so .bl-num { font-size: 17px; font-weight: 700; }
.bl-tt-dv { font-size: 11.5px; color: var(--text-muted); }
.bl-chev { font-size: 22px; color: var(--text-muted); }
/* Trạng thái rỗng / lỗi / đang tính */
.bl-trong { display: grid; justify-items: center; gap: 6px; margin-top: 12px; padding: 40px 16px; text-align: center; color: var(--text-muted); background: var(--bg-card); border: 1px dashed var(--border-color); border-radius: 8px; }
.bl-trong-t { margin: 0; font-size: 16px; font-weight: 700; color: var(--text-main); }
.bl-trong-h { margin: 0 0 6px; font-size: 14px; }
.bl-trong.is-loi .bl-ic { color: var(--txt-bad); }
.bl-spin { width: 26px; height: 26px; border-radius: 50%; border: 3px solid var(--border-color); border-top-color: var(--theme-accent-strong); animation: bl-quay .8s linear infinite; }
@keyframes bl-quay { to { transform: rotate(360deg); } }
.bl-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
/* Ngăn chi tiết từng khoản */
.bl-nen { position: fixed; inset: 0; z-index: 10040; background: rgba(15, 23, 42, .18); }
.bl-ngan { position: fixed; top: 0; right: 0; bottom: 0; z-index: 10050; width: min(520px, 100%); display: flex; flex-direction: column; background: var(--bg-app, var(--bg-card)); color: var(--text-main); border-left: 1px solid var(--border-color); box-shadow: -8px 0 24px rgba(15, 23, 42, .12); }
.bl-ngan-h { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; padding: calc(14px + env(safe-area-inset-top, 0px)) 14px 12px 18px; background: var(--bg-card); border-bottom: 1px solid var(--border-color); }
.bl-ngan-h h2 { margin: 0; font-size: 18px; display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.bl-ngan-h p { margin: 4px 0 0; font-size: 13px; color: var(--text-muted); }
.bl-ngan-b { flex: 1; overflow: auto; overscroll-behavior: contain; padding: 14px 18px calc(18px + env(safe-area-inset-bottom, 0px)); }
.bl-ks { margin: 0; background: var(--bg-card); border: 1px solid var(--border-color); border-radius: 8px; overflow: hidden; }
.bl-k { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 12px 14px; border-top: 1px solid var(--border-color); }
.bl-k:first-child { border-top: 0; }
.bl-k dt { display: grid; gap: 2px; font-size: 14px; font-weight: 600; min-width: 0; }
.bl-k-ghi { font-size: 12px; font-weight: 400; color: var(--text-muted); }
.bl-k dd { margin: 0; text-align: right; font-size: 15px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.bl-k dd .bl-dim { white-space: normal; font-size: 13px; }
.bl-k.is-tong { background: var(--bg-card-hover, var(--bg-card)); }
.bl-k.is-tong dd { font-size: 18px; }
body.bl-mo { overflow: hidden; }
@media (max-width: 760px) {
  .bl-head h1 { font-size: 22px; }
  .bl-dai { display: none; }
  .bl-sel { flex: 1 1 calc(50% - 10px); }
  .bl-tim-o { flex: 1 1 100%; }
  /* Người dùng tự chọn "Bảng" trên điện thoại: chỉ còn Nhân viên · Tạm tính · Chi tiết — không kéo ngang (chi tiết đủ khoản ở ngăn). */
  .bl-c-vt, .bl-c-dot, .bl-c-st { display: none; }

  .bl-tong { grid-template-columns: 1fr 1fr; }
  .bl-tong > div:nth-child(odd) { border-left: 0; }
  .bl-tong > div:nth-child(n + 3) { border-top: 1px solid var(--border-color); }
  .bl-ngan { width: 100%; border-left: 0; }
}
@media (prefers-reduced-motion: no-preference) { .bl-ngan { animation: tb-vao .18s ease-out; } }
@media (prefers-reduced-motion: reduce) { .bl-sk { animation: none; } .bl-spin { animation-duration: 2.4s; } }
/* Phạt biên bản (025, 26/09/2026 khuya): số âm màu cảnh báo (chữ + dấu −, không chỉ màu); dòng lỗi công thức được xuống dòng (không đẩy bảng tràn) */
.bl-bang td.bl-loi-o { white-space: normal; min-width: 0; }
.bl-bang td.bl-loi-o .bl-dim { display: block; max-width: 48ch; }
.bl-trang .is-am, .bl-ngan .is-am { color: var(--txt-bad, #c0262d); }
.bl-k-con { padding-top: 0; border-top: 0; }
.bl-bb { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; font-size: 13px; }
.bl-bb li { display: flex; justify-content: space-between; gap: 12px; }
.bl-bb li span:first-child { color: var(--text-muted); white-space: nowrap; }
/* ── Ngưỡng tồn kho (27/09/2026, nguong-ton.js): cùng ngăn phải; mỗi dòng = dòng máy | tồn | ô ngưỡng 44px. ── */
.nt-mo { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 14px; margin: 0 0 10px; border: 1px solid var(--border-color); border-radius: 8px;
  background: var(--bg-card); color: var(--text-main); font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; }
.nt-mo:hover { background: var(--bg-card-hover, var(--bg-card)); }
.nt-mo:focus-visible, .nt-o:focus-visible, .nt-tim input:focus-visible, .nt-them select:focus-visible { outline: 2px solid var(--theme-accent-strong); outline-offset: 2px; }
.nt .tb-loc.nt-cn { margin: 10px 16px 0; }
.nt .tb-loc.nt-cn button { min-height: 44px; }
.nt-tim { display: block; margin: 10px 12px 8px 16px; }
.nt-tim input { width: 100%; box-sizing: border-box; min-height: 44px; padding: 0 12px; border: 1px solid var(--border-color); border-radius: 8px; background: var(--bg-input); color: var(--text-main); font: inherit; font-size: 15px; }
.nt-cot, .nt-dong { grid-template-columns: 1fr 44px 72px; }
.nt-cot span:last-child { text-align: right; padding-right: 4px; }
.nt-ton { text-align: center; font-variant-numeric: tabular-nums; font-weight: 600; color: var(--text-main); }
.nt-o { box-sizing: border-box; width: 64px; height: 44px; margin-left: auto; padding: 0 10px; border: 1px solid var(--border-color); border-radius: 8px; background: var(--bg-input);
  color: var(--text-main); font: inherit; font-size: 15px; text-align: right; font-variant-numeric: tabular-nums; }
.nt-o[aria-invalid="true"] { border-color: var(--txt-bad); }
.nt-thap { font-size: 12px; font-weight: 600; color: var(--txt-warn); }
.nt-loi { font-size: 12px; color: var(--txt-bad); }
.nt-them { margin: 12px 12px 0 16px; padding-top: 8px; border-top: 1px solid var(--border-color); }
.nt-them-o { display: grid; grid-template-columns: 1fr 120px auto; gap: 8px; margin-top: 6px; }
.nt-them select { min-height: 44px; min-width: 0; padding: 0 8px; border: 1px solid var(--border-color); border-radius: 8px; background: var(--bg-input); color: var(--text-main); font: inherit; font-size: 14px; }
@media (max-width: 420px) { .nt-them-o { grid-template-columns: 1fr 1fr; } .nt-them-o .tb-btn { grid-column: 1 / -1; } }

/* ══ TỔNG QUAN PRO (15/10/2026) — 3 LỚP THÔNG TIN · CẦN CHÚ Ý · CÁ NHÂN HÓA · CHUYỂN ĐỘNG MƯỢT ══════
   Chuẩn DESIGN.md: chỉ dùng biến màu theme, bo góc ≤ 8px, số tabular-nums không gãy dòng, vùng chạm ≥ 44px,
   không lồng thẻ nhiều tầng, không chạy lại hiệu ứng xuất hiện mỗi lần render. */

/* 1. Quản lý chuyển động (Motion System):
   - Lần đầu mở Tổng quan (.tq-lan-dau): xuất hiện nhẹ theo lớp (180ms).
   - Các lần vẽ lại tiếp theo (.tq-da-mo): tắt hoàn toàn staggerFadeUp để không nhấp nháy hay giật trang. */
.dash-wrapper.tq-da-mo .stagger-item {
  animation: none !important;
  opacity: 1 !important;
  transform: none !important;
}
.dash-wrapper.tq-lan-dau .stagger-item {
  animation-duration: 200ms;
  animation-timing-function: cubic-bezier(0.22, 1, 0.36, 1);
}
/* Thanh tiến độ mảnh khi làm mới / đổi kỳ: giữ nguyên số cũ trên màn, không xóa trắng */
.tq-thanh-tai {
  height: 2px;
  width: 100%;
  background: var(--border-color);
  border-radius: 2px;
  overflow: hidden;
  opacity: 0;
  transition: opacity 150ms ease;
  margin: -6px 0 2px;
}
.tq-thanh-tai.is-dang-tai {
  opacity: 1;
}
.tq-thanh-tai.is-dang-tai::after {
  content: "";
  display: block;
  width: 40%;
  height: 100%;
  background: var(--theme-accent-strong);
  animation: tq-chay-ngang 1.1s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}
@keyframes tq-chay-ngang {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(260%); }
}
#btn-dash-refresh.is-dang-tai svg {
  animation: tq-xoay 0.85s linear infinite;
}
@keyframes tq-xoay {
  to { transform: rotate(360deg); }
}
/* Nháy sáng tinh tế khi giá trị số thay đổi sau khi cập nhật (không đếm lại từ 0) */
@keyframes tq-nhay-so {
  0% { background-color: var(--theme-accent-soft); }
  100% { background-color: transparent; }
}
.tq-so-doi {
  animation: tq-nhay-so 520ms cubic-bezier(0.22, 1, 0.36, 1);
  border-radius: 4px;
}
/* Nổi nhẹ thẻ vừa xem chi tiết khi bấm Quay lại Tổng quan */
@keyframes tq-vua-xem {
  0% { box-shadow: 0 0 0 2px var(--theme-accent-strong); }
  100% { box-shadow: 0 0 0 0 transparent; }
}
.tq-vua-quay-lai {
  animation: tq-vua-xem 1.1s ease-out;
}

/* 2. Thanh ngữ cảnh gọn & Tóm tắt nhịp hoạt động (.tq-ctx) */
.tq-ctx {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 14px;
  padding: 8px 12px;
  margin-bottom: 12px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 8px;
}
.tq-ctx-left, .tq-ctx-right {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 10px;
  min-width: 0;
}
.tq-ctx-pills {
  display: inline-flex;
  padding: 2px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  gap: 2px;
}
.tq-ctx-pill {
  min-height: 34px;
  padding: 0 11px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  font-size: 12.5px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 140ms ease, color 140ms ease;
}
.tq-ctx-pill:hover {
  color: var(--text-main);
}
.tq-ctx-pill[aria-pressed="true"] {
  background: var(--bg-card);
  color: var(--txt-accent);
  box-shadow: 0 0 0 1px var(--border-color);
}
.tq-ctx-meta {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12.5px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  min-width: 0;
}
.tq-ctx-meta strong {
  color: var(--text-main);
  font-weight: 600;
}
.tq-ctx-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--txt-ok, #1d8348);
  flex: none;
}
.tq-ctx-dot.is-loading {
  background: var(--theme-accent-strong);
  animation: tq-nhay-so 900ms infinite alternate;
}
.tq-ctx-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: var(--bg-input);
  color: var(--text-main);
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  text-decoration: none;
  transition: border-color 140ms ease, background-color 140ms ease, color 140ms ease;
}
.tq-ctx-btn:hover {
  border-color: var(--theme-accent-strong);
  background: var(--theme-accent-soft);
  color: var(--txt-accent);
}
.tq-ctx-btn.is-saved {
  color: var(--txt-ok);
  border-color: color-mix(in srgb, var(--txt-ok) 40%, var(--border-color));
  background: color-mix(in srgb, var(--txt-ok) 8%, var(--bg-input));
}
.tq-ctx-pill:focus-visible,
.tq-ctx-btn:focus-visible,
.tq-ext-link:focus-visible,
.tq-cy-btn:focus-visible,
.tq-chuy-fbtn:focus-visible,
.tq-khoi-gon-btn:focus-visible,
.tq-chart-tab:focus-visible {
  outline: 2px solid var(--theme-accent-strong);
  outline-offset: 2px;
}
@media (max-width: 760px) {
  .tq-ctx { padding: 8px 10px; gap: 8px; }
  .tq-ctx-pills { width: 100%; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .tq-ctx-pill { min-height: 38px; padding: 0 6px; font-size: 12px; text-align: center; }
  .tq-ctx-meta { width: 100%; font-size: 12px; line-height: 1.35; }
  .tq-ctx-right { width: 100%; justify-content: space-between; }
  .tq-ctx-btn { min-height: 38px; flex: 1; justify-content: center; }
}

/* 3. Dải thẻ chỉ số điều hành mở rộng (.tq-ext-grid) — Lớp 1 bổ sung cho KPI Matrix */
.tq-ext-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-top: 10px;
}
@media (max-width: 1180px) {
  .tq-ext-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 560px) {
  .tq-ext-grid { grid-template-columns: minmax(0, 1fr); gap: 8px; }
}
.tq-ext-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 6px;
  padding: 12px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  min-width: 0;
  transition: border-color 150ms ease;
}
.tq-ext-card:hover {
  border-color: var(--itn-nut-vien, var(--border-color));
}
.tq-ext-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 4px 6px;
  min-width: 0;
}
.tq-ext-label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-muted);
}
.tq-ext-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 7px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  flex: none;
}
.tq-ext-badge.is-ok {
  background: color-mix(in srgb, var(--txt-ok) 12%, transparent);
  color: var(--txt-ok);
}
.tq-ext-badge.is-warn {
  background: color-mix(in srgb, var(--txt-warn) 14%, transparent);
  color: var(--txt-warn);
}
.tq-ext-badge.is-bad {
  background: color-mix(in srgb, var(--txt-bad) 12%, transparent);
  color: var(--txt-bad);
}
.tq-ext-badge.is-neutral {
  background: var(--bg-input);
  color: var(--text-muted);
  border: 1px solid var(--border-color);
}
.tq-ext-main {
  display: flex;
  align-items: baseline;
  gap: 5px;
  min-width: 0;
  margin: 1px 0;
}
.tq-ext-v {
  font-size: 21px;
  font-weight: 700;
  line-height: 1.18;
  color: var(--text-main);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.tq-ext-dv {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
}
.tq-ext-sub {
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 11.5px;
  line-height: 1.4;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  padding-top: 6px;
  border-top: 1px dashed var(--border-color);
}
.tq-ext-sub strong {
  color: var(--text-main);
  font-weight: 600;
}
.tq-ext-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-top: 4px;
}
.tq-ext-src {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tq-ext-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 30px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--txt-accent);
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  flex: none;
}
.tq-ext-link:hover {
  text-decoration: underline;
}

/* 4. Lớp 2 — Khối "Cần chú ý & Việc chờ xử lý" (.tq-chuy) */
.tq-chuy {
  margin-top: 16px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 14px 16px;
}
.tq-chuy-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 12px;
  margin-bottom: 12px;
}
.tq-chuy-title {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 15px;
  font-weight: 700;
  color: var(--text-main);
}
.tq-chuy-title svg {
  color: var(--txt-warn);
  flex: none;
}
.tq-chuy-count {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 6px;
  background: color-mix(in srgb, var(--txt-warn) 14%, transparent);
  color: var(--txt-warn);
  font-size: 11.5px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.tq-chuy-filters {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
  padding: 2px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 8px;
}
.tq-chuy-fbtn {
  min-height: 32px;
  padding: 0 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 140ms ease, color 140ms ease;
}
.tq-chuy-fbtn:hover {
  color: var(--text-main);
}
.tq-chuy-fbtn[aria-pressed="true"] {
  background: var(--bg-card);
  color: var(--txt-accent);
  box-shadow: 0 0 0 1px var(--border-color);
}
.tq-cy-ds {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
@media (max-width: 920px) {
  .tq-cy-ds { grid-template-columns: minmax(0, 1fr); }
}
.tq-cy-muc {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 6px 10px;
  padding: 11px 13px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-left-width: 3px;
  border-radius: 8px;
  min-width: 0;
}
.tq-cy-muc.is-quan-trong { border-left-color: var(--txt-bad); }
.tq-cy-muc.is-luu-y { border-left-color: var(--txt-warn); }
.tq-cy-muc.is-thong-tin { border-left-color: var(--theme-accent-strong); }
.tq-cy-tag {
  grid-column: 1 / -1;
  justify-self: start;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 6px;
  white-space: nowrap;
}
.tq-cy-tag.is-quan-trong {
  background: color-mix(in srgb, var(--txt-bad) 12%, transparent);
  color: var(--txt-bad);
}
.tq-cy-tag.is-luu-y {
  background: color-mix(in srgb, var(--txt-warn) 14%, transparent);
  color: var(--txt-warn);
}
.tq-cy-tag.is-thong-tin {
  background: var(--theme-accent-soft);
  color: var(--txt-accent);
}
.tq-cy-body {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.tq-cy-what {
  font-size: 13.5px;
  font-weight: 700;
  line-height: 1.35;
  color: var(--text-main);
}
.tq-cy-why {
  font-size: 12px;
  line-height: 1.42;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}
.tq-cy-why strong {
  color: var(--text-main);
  font-weight: 600;
}
.tq-cy-act {
  align-self: center;
}
.tq-cy-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 36px;
  padding: 0 11px;
  border: 1px solid var(--itn-nut-vien, var(--border-color));
  border-radius: 8px;
  background: var(--bg-card);
  color: var(--txt-accent);
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 140ms ease, border-color 140ms ease;
}
.tq-cy-btn:hover {
  background: var(--theme-accent-soft);
  border-color: var(--theme-accent-strong);
}
@media (max-width: 640px) {
  .tq-chuy { padding: 12px; }
  .tq-cy-muc { grid-template-columns: minmax(0, 1fr); }
  .tq-cy-act { width: 100%; margin-top: 2px; }
  .tq-cy-btn { width: 100%; min-height: 40px; justify-content: center; }
}
.tq-cy-ok {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px;
  border-radius: 8px;
  background: var(--bg-input);
  color: var(--txt-ok);
  font-size: 13px;
  font-weight: 600;
}
.tq-cy-thieu {
  margin-top: 10px;
  padding: 9px 12px;
  border-radius: 8px;
  background: var(--bg-input);
  border: 1px dashed var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 12px;
  font-size: 11.5px;
  line-height: 1.45;
  color: var(--text-muted);
}
.tq-cy-thieu strong { color: var(--text-main); }
.tq-cy-thieu-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 30px;
  padding: 0 9px;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  background: var(--bg-card);
  color: var(--txt-accent);
  font: inherit;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.tq-cy-thieu-chip:hover {
  border-color: var(--theme-accent-strong);
  background: var(--theme-accent-soft);
}

/* 5. Thu gọn / Mở rộng khối (.tq-khoi) & Chuyển chế độ biểu đồ (.tq-chart-tabs) */
.tq-khoi-gon-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 14px;
  padding: 10px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 8px;
}
.tq-khoi-gon-title {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-main);
}
.tq-khoi-gon-title svg {
  color: var(--txt-accent);
  flex: none;
}
.tq-khoi-gon-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 32px;
  padding: 0 10px;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  background: var(--bg-input);
  color: var(--text-muted);
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: color 140ms ease, border-color 140ms ease;
}
.tq-khoi-gon-btn:hover {
  color: var(--text-main);
  border-color: var(--theme-accent-strong);
}
.tq-chart-tabs {
  display: inline-flex;
  padding: 2px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  flex-wrap: wrap;
  gap: 2px;
}
.tq-chart-tab {
  min-height: 32px;
  padding: 0 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 140ms ease, color 140ms ease;
}
.tq-chart-tab:hover {
  color: var(--text-main);
}
.tq-chart-tab[aria-selected="true"],
.tq-chart-tab[aria-pressed="true"] {
  background: var(--bg-card);
  color: var(--txt-accent);
  box-shadow: 0 0 0 1px var(--border-color);
}
@media (max-width: 760px) {
  .tq-chart-tab { min-height: 44px; min-width: 44px; font-size: 12px; padding: 0 10px; }
}
@media (max-width: 1023px), (pointer: coarse) {
  .tb-loc button,
  .bl-xem button,
  .tq-ctx-pill,
  .tq-ctx-btn,
  .tq-ext-link,
  .tq-chuy-fbtn,
  .tq-cy-thieu-chip,
  .tq-khoi-gon-btn,
  .tq-chart-tab {
    min-height: 44px;
    min-width: 44px;
  }
}

/* 6. Hộp Tùy chỉnh & Sắp xếp Tổng quan (.tq-tc-*) */
.tq-tc-loc-box {
  margin: 0 16px 10px;
  padding: 10px 12px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  display: grid;
  gap: 8px;
}

/* 7. Chế độ giảm chuyển động (Reduced Motion) */
@media (prefers-reduced-motion: reduce) {
  .dash-wrapper .stagger-item,
  .tq-thanh-tai.is-dang-tai::after,
  #btn-dash-refresh.is-dang-tai svg,
  .tq-so-doi,
  .tq-vua-quay-lai {
    animation: none !important;
    transition: none !important;
  }
}


/* 124 (20/10/2026): khu "Cảnh báo vốn vượt ngưỡng" trong ngăn Ngưỡng tồn kho — ô 44px như ô ngưỡng tồn, bo 8px */
.nt-von { padding: 0 0 12px; margin: 0 0 12px; border-bottom: 1px solid var(--border-color); }
.nt-von .tb-cd-ghi { margin: 0 0 8px; }
.nt-von-ghi { font-weight: 500; color: var(--text-muted); }
.nt-von-o { display: grid; gap: 8px; }
.nt-von-dong { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 6px 10px; font-size: 13.5px; }
.nt-von-cot { display: inline-flex; align-items: center; gap: 6px; }
.nt-o.nt-o-von { width: 150px; text-align: right; }
.nt-von-dv { color: var(--text-muted); font-size: 13px; min-width: 14px; }
.nt-von-dong .nt-loi { grid-column: 1 / -1; }

/* Tổng chi lương theo phòng: chỉ cộng số API theo bộ lọc; mobile không ép bảng ngang. */
.bl-phong { margin: 20px 0; }
.bl-phong h2, .bl-p-detail h2 { font-size: 20px; margin: 0 0 8px; }
.bl-p-link { display: inline-flex; flex-direction: column; justify-content: center; align-items: inherit; gap: 4px; min-height: 44px; max-width: 100%; border: 0; border-radius: 6px; padding: 6px 4px; background: transparent; color: var(--text-main); font: inherit; text-align: inherit; cursor: pointer; }
.bl-p-link:hover { background: var(--theme-accent-soft); text-decoration: underline; }
.bl-p-name { font-weight: 650; text-align: left; }
.bl-p-thieu { display: block; font-size: 11px; color: var(--text-muted); font-weight: 400; white-space: normal; line-height: 1.4; }
.bl-p-meta { display: block; font-size: 12px; font-weight: 400; color: var(--text-muted); margin: 3px 0; white-space: normal; }
.bl-p-totals { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); margin: 14px 0; border: 1px solid var(--border-color); border-radius: 8px; background: var(--bg-card); }
.bl-p-totals > div { padding: 16px 18px; border-left: 1px solid var(--border-color); min-width: 0; }
.bl-p-totals > div:first-child { border-left: 0; }
.bl-p-totals > div > span { display: block; color: var(--text-muted); font-size: 13px; }
.bl-p-totals strong { font-size: 24px; }
.bl-p-table { background: var(--bg-card); border: 1px solid var(--border-color); border-radius: 8px; overflow: hidden; }
.bl-p-table table { width: 100%; border-collapse: collapse; }
.bl-p-table th, .bl-p-table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border-color); font-size: 14px; }
.bl-p-table thead th { font-size: 12px; color: var(--text-muted); background: var(--bg-card-hover); }
.bl-p-table .bl-so { text-align: right; }
.bl-p-table tbody tr:last-child > * { border-bottom: 0; }
.bl-p-grand > * { background: var(--theme-accent-soft); }
.bl-p-cards { display: none; }
.bl-p-detail { margin: 20px 0; padding: 20px; background: var(--bg-card); border: 1px solid var(--border-color); border-radius: 8px; scroll-margin-top: 16px; }
.bl-p-detail header { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.bl-p-subtotal { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; padding: 16px; margin: 18px 0 6px; border-radius: 6px; background: var(--bg-card-hover); }
.bl-p-subtotal strong { font-size: 22px; }
.bl-p-detail ul { padding: 0; margin: 0; list-style: none; }
.bl-p-detail li { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 14px 0; border-bottom: 1px solid var(--border-color); }
.bl-p-detail li:last-child { border-bottom: 0; }
.bl-p-detail li > div { min-width: 0; }
.bl-nangcao summary { min-height: 44px; display: flex; align-items: center; cursor: pointer; color: var(--text-main); }
.bl-nangcao .bl-sel { min-width: 200px; }
@media (max-width: 1100px) { .bl-p-table th, .bl-p-table td { padding: 10px 8px; font-size: 13px; } .bl-p-totals strong { font-size: 22px; } }
@media (max-width: 760px) {
  .bl-p-table { display: none; }
  .bl-p-totals { grid-template-columns: 1fr; }
  .bl-p-totals > div { border-left: 0; border-top: 1px solid var(--border-color); padding: 12px 14px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
  .bl-p-totals > div:first-child { border-top: 0; }
  .bl-p-totals strong { font-size: 20px; }
  .bl-p-totals .bl-p-link { text-align: right; }
  .bl-p-cards { display: grid; gap: 12px; }
  .bl-p-cards article { padding: 14px; border: 1px solid var(--border-color); border-radius: 8px; background: var(--bg-card); }
  .bl-p-cards h3 { display: flex; align-items: center; justify-content: space-between; margin: 0; font-size: 17px; }
  .bl-p-cards h3 small { font-weight: 400; color: var(--text-muted); font-size: 12px; }
  .bl-p-cards dl { margin: 8px 0 0; }
  .bl-p-cards dl > div { display: grid; grid-template-columns: 1fr 1fr; align-items: center; gap: 8px; }
  .bl-p-cards dt { color: var(--text-muted); font-size: 13px; }
  .bl-p-cards dd { margin: 0; text-align: right; }
  .bl-p-cards dl > div:last-child { border-top: 1px solid var(--border-color); padding-top: 8px; margin-top: 6px; }
  .bl-p-detail { padding: 14px; }
  .bl-p-detail header { flex-direction: column; align-items: flex-start; }
  .bl-p-detail li > .bl-num { font-size: 13px; white-space: normal; text-align: right; max-width: 40%; }
}
.bl-mobile-filter { display: none; }
.bl-chip-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 14px 0; font-size: 12px; color: var(--text-muted); }
.bl-filter-chip { padding: 5px 9px; background: var(--theme-accent-soft); border-radius: 6px; color: var(--text-main); overflow-wrap: anywhere; }
@media (max-width: 760px) { .bl-mobile-filter { display: flex; width: 100%; justify-content: space-between; } .bl-loc:not(.is-open) { display: none; } .bl-loc.is-open { margin-top: 10px; } }

/* Hai quỹ chi theo chốt 05/11: tổng net Đợt1 riêng, KPI T-1 riêng. */
.bl-cash-grid.bl-p-totals { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 20px; border: 0; background: transparent; }
.bl-cash-panel { min-width: 0; background: var(--bg-card); border: 1px solid var(--border-color); border-radius: 8px; overflow: hidden; }
.bl-cash-panel > header { padding: 18px; border-bottom: 1px solid var(--border-color); }
.bl-cash-panel h3 { font-size: 18px; margin: 0 0 8px; color: var(--text-main); }
.bl-cash-total { padding: 14px 18px; background: var(--theme-accent-soft); border-bottom: 1px solid var(--border-color); }
.bl-cash-total > span { font-size: 12px; color: var(--text-muted); display: block; }
.bl-cash-total .bl-p-link { width: 100%; align-items: flex-start; text-align: left; }
.bl-cash-total .bl-num { font-size: 28px; }
.bl-cash-panel .bl-p-table { border: 0; border-radius: 0; }
.bl-cash-panel .bl-p-table th { white-space: normal; }
.bl-cash-panel .bl-p-table th, .bl-cash-panel .bl-p-table td { padding: 12px 14px; }
.bl-cash-panel .bl-cash-note { padding: 14px 18px; margin: 0; border-top: 1px solid var(--border-color); }
@media(max-width:760px) {
 .bl-cash-grid.bl-p-totals { grid-template-columns: 1fr; gap: 16px; }
 .bl-cash-panel .bl-p-cards { gap: 0; }
 .bl-cash-panel .bl-p-cards article { display:flex;justify-content:space-between;align-items:center;gap:12px;border:0;border-radius:0;border-bottom:1px solid var(--border-color);margin:0;padding:12px 14px; }
 .bl-cash-panel .bl-p-cards article > .bl-p-link { text-align:right; }
 .bl-cash-panel .bl-p-cards article strong { font-size:17px; }
}
