/**
 * bb.css — Biên bản kiểm toán cửa hàng (BBKK). Tiền tố bb- ; dùng chung biến màu --nd-* của ndtc.css.
 */
#kstSubView-bb { min-width: 0; }
.bb-banner { display: flex; gap: 10px; align-items: flex-start; padding: 11px 14px; border-radius: 12px; font-size: .82rem; margin: 0 0 14px; border: 1px solid var(--nd-border); background: var(--nd-surface); color: var(--nd-dim); }
.bb-banner.warn { background: rgba(250, 178, 25, .12); border-color: rgba(250, 178, 25, .55); color: var(--nd-warn-text); }
.bb-banner.crit { background: rgba(208, 59, 59, .08); border-color: rgba(208, 59, 59, .4); color: var(--nd-crit-text); }
.bb-banner.good { background: rgba(12, 163, 12, .08); border-color: rgba(12, 163, 12, .35); color: var(--nd-good-text); }
.bb-banner b { color: inherit; }

/* Danh sách */
.bb-st { display: inline-flex; align-items: center; gap: 6px; font-size: .74rem; font-weight: 800; padding: 4px 10px; border-radius: 999px; background: color-mix(in srgb, var(--c, #94a3b8) 14%, transparent); color: var(--c, #64748b); white-space: nowrap; }
.bb-st::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--c, #94a3b8); }
.bb-st.draft { --c: #d99a06; }
.bb-st.final { --c: #0ca30c; }
.bb-st.view { --c: #64748b; }
.bb-neg { color: var(--nd-crit-text); font-weight: 700; }
.bb-pos { color: var(--nd-good-text); font-weight: 700; }
.bb-mine td:first-child { box-shadow: inset 3px 0 0 var(--nd-brand); }

/* Thanh trên của trình soạn */
.bb-top { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 0 0 12px; }
.bb-top h2 { margin: 0; font-size: 1.25rem; font-weight: 800; color: #0f172a; letter-spacing: -.01em; }
.bb-top .bb-grow { flex: 1 1 auto; }
.bb-save { font-size: .76rem; font-weight: 700; color: var(--nd-faint); }
.bb-save.err { color: var(--nd-crit-text); }
.bb-save.ok { color: var(--nd-good-text); }

/* Bước */
.bb-steps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin: 0 0 16px; }
.bb-step { display: flex; align-items: center; gap: 10px; padding: 11px 14px; border: 1px solid var(--nd-border); background: var(--nd-surface); border-radius: 14px; cursor: pointer; text-align: left; font-family: inherit; color: var(--nd-dim); }
.bb-step i { flex: 0 0 auto; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-style: normal; font-weight: 800; font-size: .85rem; background: var(--nd-surface-2); border: 1px solid var(--nd-border); color: var(--nd-faint); }
.bb-step b { display: block; font-size: .86rem; color: var(--nd-text); }
.bb-step small { display: block; font-size: .72rem; color: var(--nd-faint); margin-top: 1px; }
.bb-step.on { border-color: var(--nd-brand); box-shadow: 0 0 0 3px rgba(185, 28, 28, .1); }
.bb-step.on i { background: var(--nd-brand); border-color: var(--nd-brand); color: #fff; }
.bb-step.done i { background: var(--nd-good); border-color: var(--nd-good); color: #fff; }

/* Form thông tin */
.bb-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px 16px; }
.bb-f { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.bb-f > span { font-size: .68rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--nd-faint); }
.bb-f .nd-input, .bb-f .nd-select { height: 40px; padding-top: 0; padding-bottom: 0; }
.bb-f.wide { grid-column: 1 / -1; }
.bb-h3 { margin: 18px 0 10px; font-size: .78rem; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; color: var(--nd-faint); border-top: 1px dashed var(--nd-border); padding-top: 14px; }
.bb-h3:first-child { margin-top: 0; border-top: 0; padding-top: 0; }
.bb-foot { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-top: 18px; }
.bb-ro .bb-f .nd-input, .bb-ro .bb-f .nd-select, .bb-ro .bb-f .nd-textarea { background: var(--nd-surface-2); pointer-events: none; }

/* Thả file */
.bb-drop { border: 2px dashed var(--nd-border); border-radius: 16px; padding: 34px 20px; text-align: center; background: var(--nd-surface-2); transition: .15s; }
.bb-drop.over { border-color: var(--nd-brand); background: var(--nd-brand-soft); }
.bb-drop h4 { margin: 0 0 6px; font-size: 1.05rem; font-weight: 800; color: var(--nd-text); }
.bb-drop p { margin: 0 0 14px; color: var(--nd-faint); font-size: .84rem; }
.bb-prog { height: 6px; background: var(--nd-border); border-radius: 99px; overflow: hidden; margin-top: 14px; }
.bb-prog i { display: block; height: 100%; width: 40%; background: var(--nd-brand); animation: bbslide 1s infinite ease-in-out; }
@keyframes bbslide { 0% { margin-left: -40%; } 100% { margin-left: 100%; } }

/* Tab con */
.bb-sub { display: flex; gap: 6px; flex-wrap: wrap; margin: 0 0 14px; }
.bb-sub button { border: 1px solid var(--nd-border); background: var(--nd-surface); color: var(--nd-dim); font-family: inherit; font-weight: 800; font-size: .84rem; padding: 9px 14px; border-radius: 12px; cursor: pointer; display: inline-flex; gap: 8px; align-items: center; }
.bb-sub button:hover { border-color: var(--nd-brand); }
.bb-sub button.on { background: var(--nd-brand-soft); border-color: var(--nd-brand); color: var(--nd-brand); }
.bb-sub button em { font-style: normal; font-size: .72rem; font-weight: 800; background: var(--nd-surface-2); border: 1px solid var(--nd-border); color: var(--nd-faint); padding: 1px 7px; border-radius: 99px; }
.bb-sub button.on em { background: #fff; border-color: var(--nd-brand); color: var(--nd-brand); }

/* Bảng nhập */
.bb-tw { overflow: auto; max-height: calc(100vh - 250px); border: 1px solid var(--nd-border); border-radius: 14px; background: var(--nd-surface); }
.bb-t { border-collapse: separate; border-spacing: 0; width: 100%; min-width: 1360px; font-size: .78rem; font-variant-numeric: tabular-nums; }
.bb-t th { position: sticky; top: 0; z-index: 3; background: var(--nd-surface-2); color: var(--nd-faint); font-size: .68rem; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; padding: 8px 8px; border-bottom: 1px solid var(--nd-border); text-align: right; white-space: nowrap; }
.bb-t th.l, .bb-t td.l { text-align: left; }
.bb-t th.c, .bb-t td.c { text-align: center; }
.bb-t td { padding: 6px 8px; border-bottom: 1px solid var(--nd-border); text-align: right; white-space: nowrap; color: var(--nd-text); }
.bb-t td.q { white-space: normal; min-width: 250px; max-width: 360px; line-height: 1.3; text-align: left; }
.bb-t td.l { white-space: nowrap; }
.bb-t tbody tr:hover td { background: var(--nd-surface-2); }
.bb-t tr.sec td { background: color-mix(in srgb, var(--nd-brand) 8%, var(--nd-surface)); font-weight: 800; color: var(--nd-text); cursor: pointer; text-align: left; border-bottom: 1px solid var(--nd-border); }
.bb-t tr.sec td.n { text-align: right; }
.bb-sh { position: sticky; left: 0; display: inline-flex; align-items: center; gap: 10px; flex-wrap: wrap; max-width: calc(100vw - 420px); }
.bb-sh .bb-sec-tot { font-weight: 600; font-size: .76rem; color: var(--nd-dim); }
.bb-t tr.sec .car { display: inline-block; width: 14px; transition: transform .15s; color: var(--nd-faint); }
.bb-t tr.sec.closed .car { transform: rotate(-90deg); }
.bb-t tr.sub td, .bb-t tr.tot td { font-weight: 800; background: var(--nd-surface-2); }
.bb-t tr.tot td { background: color-mix(in srgb, var(--nd-brand) 10%, var(--nd-surface)); }
.bb-t tr.hit td { background: color-mix(in srgb, var(--nd-warn) 14%, var(--nd-surface)); }
.bb-t td.in, .bb-t th.in { background: color-mix(in srgb, var(--nd-blue) 6%, var(--nd-surface)); border-left: 1px solid var(--nd-border); border-right: 1px solid var(--nd-border); }
.bb-t th.in { background: color-mix(in srgb, var(--nd-blue) 12%, var(--nd-surface-2)); color: var(--nd-blue); }
.bb-t .bb-in { width: 88px; height: 30px; text-align: right; border: 1px solid var(--nd-border); border-radius: 8px; padding: 0 8px; font: inherit; font-weight: 700; background: var(--nd-input); color: var(--nd-text); font-variant-numeric: tabular-nums; }
.bb-t .bb-in:focus { outline: 0; border-color: var(--nd-brand); box-shadow: 0 0 0 3px rgba(185, 28, 28, .14); }
.bb-t .bb-in.t { width: 120px; text-align: left; font-weight: 500; }
.bb-t .bb-in.p { width: 58px; }
.bb-t .bb-in.d { width: 106px; text-align: left; font-weight: 500; }
.bb-t .bb-in:disabled { background: transparent; border-color: transparent; color: var(--nd-dim); }
.bb-lot { font-size: .72rem; color: var(--nd-faint); display: block; }
.bb-tag { display: inline-block; font-size: .64rem; font-weight: 800; padding: 1px 6px; border-radius: 99px; background: rgba(250, 178, 25, .2); color: var(--nd-warn-text); margin-left: 4px; }
.bb-more { padding: 12px; text-align: center; }

/* Quỹ */
.bb-quy { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 16px; align-items: start; }
@media (max-width: 1100px) { .bb-quy { grid-template-columns: 1fr; } }
.bb-qt { width: 100%; border-collapse: collapse; font-size: .86rem; font-variant-numeric: tabular-nums; }
.bb-qt th { text-align: left; font-size: .68rem; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; color: var(--nd-faint); padding: 8px 10px; border-bottom: 1px solid var(--nd-border); }
.bb-qt td { padding: 6px 10px; border-bottom: 1px solid var(--nd-border); }
.bb-qt td.n, .bb-qt th.n { text-align: right; }
.bb-qt .nd-input { height: 34px; text-align: right; font-weight: 700; padding: 0 10px; }
.bb-qt tr.tot td { font-weight: 800; background: var(--nd-surface-2); }
.bb-big { font-size: 1.15rem; font-weight: 800; }

/* Tổng hợp */
.bb-act { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 12px; margin: 12px 0 0; }
.bb-act .nd-btn { justify-content: center; height: 46px; }
.bb-links a { color: var(--nd-blue); font-weight: 700; text-decoration: none; }
.bb-links a:hover { text-decoration: underline; }
.bb-sum { width: 100%; border-collapse: collapse; font-size: .82rem; font-variant-numeric: tabular-nums; }
.bb-sum th { text-align: right; font-size: .68rem; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; color: var(--nd-faint); padding: 8px 10px; border-bottom: 1px solid var(--nd-border); }
.bb-sum th:first-child, .bb-sum td:first-child { text-align: left; }
.bb-sum td { padding: 7px 10px; border-bottom: 1px solid var(--nd-border); text-align: right; }
.bb-sum tr.tot td { font-weight: 800; background: var(--nd-surface-2); }

/* Xem trước bản in (phủ toàn màn hình) */
.bb-prev { position: fixed; inset: 0; z-index: 1000050; background: rgba(15, 23, 42, .72); display: none; flex-direction: column; }
.bb-prev.open { display: flex; }
.bb-prev-bar { display: flex; gap: 10px; align-items: center; padding: 10px 16px; background: #0f172a; color: #fff; flex-wrap: wrap; }
.bb-prev-bar b { font-size: .95rem; flex: 1 1 auto; }
.bb-prev-bar .nd-btn { background: #1e293b; border-color: #334155; color: #fff; }
.bb-prev-bar .nd-btn.primary { background: linear-gradient(135deg, var(--nd-brand-2), #c8102e); border-color: transparent; }
.bb-prev-body { flex: 1 1 auto; overflow: auto; padding: 18px; }
.bb-prev-body .bbp { width: max-content; margin: 0 auto; }
.bb-prev-body .bbp-sheet { box-shadow: 0 6px 24px rgba(0, 0, 0, .35); padding: 8mm; margin-bottom: 18px; }
.bb-prev-body .bbp-sheet.land { width: 297mm; }
.bb-prev-body .bbp-sheet.port { width: 210mm; }

@media print {
  body > *:not(#bbPrev) { display: none !important; }
  #bbPrev { position: static !important; display: block !important; background: #fff !important; }
  #bbPrev .bb-prev-bar { display: none !important; }
  #bbPrev .bb-prev-body { padding: 0 !important; overflow: visible !important; }
  #bbPrev .bbp { width: auto !important; }
  #bbPrev .bbp-sheet { box-shadow: none !important; padding: 0 !important; margin: 0 !important; }
  #bbPrev .bbp-sheet.land { width: 281mm !important; }
  #bbPrev .bbp-sheet.port { width: 186mm !important; }
}

@media (max-width: 760px) {
  .bb-steps { grid-template-columns: 1fr; }
  .bb-tw { max-height: none; }
}

.bb-banner > div { min-width: 0; overflow-wrap: anywhere; }
@media (max-width: 760px) {
  #bbKpis .nd-kpi-val { font-size: 1.25rem; }
  #bbKpis { grid-template-columns: 1fr; }
  .bb-top h2 { font-size: 1.05rem; }
  .bb-sub button { padding: 8px 11px; font-size: .8rem; }
}

/* ===== BBKT ===== */
.kt-bar { position: sticky; top: 118px; z-index: 20; padding: 10px 14px; display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; }
.kt-kpis { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.kt-chip { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--nd-line, #e2e8f0); background: var(--nd-card, #fff); color: var(--nd-text, #0f172a); border-radius: 999px; padding: 5px 11px; font-size: .8rem; font-weight: 700; cursor: pointer; }
span.kt-chip { cursor: default; }
.kt-chip em { font-style: normal; background: rgba(100, 116, 139, .16); border-radius: 999px; padding: 0 7px; min-width: 22px; text-align: center; }
.kt-chip.on { border-color: #c8102e; box-shadow: 0 0 0 2px rgba(200, 16, 46, .15); }
.kt-chip.ok em { background: rgba(22, 163, 74, .18); color: #15803d; }
.kt-chip.bad em { background: rgba(220, 38, 38, .18); color: #b91c1c; }
.kt-chip.warn em { background: rgba(217, 119, 6, .2); color: #b45309; }
.kt-warn { font-size: .8rem; color: #b45309; font-weight: 700; margin-left: 6px; }
.kt-tools { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.kt-tools .nd-fs { margin: 0; min-width: 180px; }
.kt-grp { padding: 0; margin-top: 12px; overflow: hidden; }
.kt-gh { display: flex; align-items: center; gap: 10px; padding: 11px 14px; cursor: pointer; background: rgba(148, 163, 184, .12); }
.kt-gh b { flex: 1 1 auto; font-size: .95rem; }
.kt-gh span { font-size: .78rem; color: var(--nd-muted, #64748b); }
.kt-gh i { width: 8px; height: 8px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg); transition: transform .15s; margin-right: 4px; }
.kt-gh.closed i { transform: rotate(-45deg); }
.kt-it { display: grid; grid-template-columns: 34px 1fr auto; gap: 8px 12px; padding: 11px 14px; border-top: 1px solid var(--nd-line, #e2e8f0); align-items: start; border-left: 4px solid transparent; }
.kt-it.s-kd { border-left-color: #dc2626; background: rgba(220, 38, 38, .05); }
.kt-it.s-dat { border-left-color: #16a34a; }
.kt-it.s-none { border-left-color: #f59e0b; }
.kt-no { font-weight: 800; color: var(--nd-muted, #64748b); font-size: .85rem; padding-top: 2px; }
.kt-c { font-weight: 800; font-size: .9rem; }
.kt-d { font-size: .86rem; white-space: pre-line; margin-top: 2px; }
.kt-e { font-size: .76rem; color: var(--nd-muted, #64748b); margin-top: 3px; }
.kt-seg { display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
.kt-b { border: 1px solid var(--nd-line, #cbd5e1); background: var(--nd-card, #fff); color: var(--nd-text, #0f172a); border-radius: 8px; padding: 6px 10px; font-size: .78rem; font-weight: 700; cursor: pointer; white-space: nowrap; }
.kt-b:disabled { opacity: .45; cursor: not-allowed; }
.kt-b.dat.on { background: #16a34a; border-color: #16a34a; color: #fff; }
.kt-b.kd.on { background: #dc2626; border-color: #dc2626; color: #fff; }
.kt-b.kps.on, .kt-b.ckt.on { background: #64748b; border-color: #64748b; color: #fff; }
.kt-bad { grid-column: 2 / -1; display: grid; grid-template-columns: 2fr 1.2fr 150px 1fr; gap: 10px; align-items: start; }
.kt-bad .kt-w { grid-column: auto; }
.kt-bad textarea { resize: vertical; min-height: 54px; }
.kt-chips { display: flex; gap: 5px; flex-wrap: wrap; margin-top: 5px; }
.kt-ch { border: 1px solid var(--nd-line, #cbd5e1); background: var(--nd-card, #fff); color: var(--nd-text, #0f172a); border-radius: 999px; padding: 2px 10px; font-size: .74rem; font-weight: 700; cursor: pointer; }
.kt-ch.on { background: #c8102e; border-color: #c8102e; color: #fff; }
.kt-ns { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 6px; margin-bottom: 8px; }
.kt-nsr { display: flex; align-items: center; gap: 8px; border: 1px solid var(--nd-line, #e2e8f0); border-radius: 8px; padding: 6px 10px; }
.kt-nsr span { flex: 1 1 auto; min-width: 0; }
.kt-nsr small { display: block; color: var(--nd-muted, #64748b); font-size: .74rem; }
.kt-nsadd { display: grid; grid-template-columns: 1fr 1fr auto; gap: 8px; margin-top: 4px; }
@media (max-width: 860px) {
  .kt-bar { top: 0; position: static; }
  .kt-it { grid-template-columns: 28px 1fr; }
  .kt-b { padding: 6px 8px; font-size: .74rem; }
  .kt-chip { padding: 4px 9px; font-size: .75rem; }
  .kt-seg { grid-column: 2; justify-content: flex-start; }
  .kt-bad { grid-template-columns: 1fr; }
  .kt-nsadd { grid-template-columns: 1fr; }
}

/* ---- BBKT: 5 bước, Misc (INV 044), PL 01 ---- */
.bb-steps.s5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
@media (max-width: 1100px) { .bb-steps.s5 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 760px) { .bb-steps.s5 { grid-template-columns: 1fr; } }
.kt-pick { margin-top: 8px; }
.kt-pk { max-height: 220px; overflow: auto; margin-top: 8px; display: grid; gap: 4px; border: 1px solid var(--nd-border); border-radius: 10px; padding: 8px 10px; background: var(--nd-surface, #fff); }
.kt-pk label { display: flex; gap: 6px; align-items: baseline; font-size: .82rem; cursor: pointer; }
.kt-pk small { color: var(--nd-faint); }
.kt-ms td { vertical-align: top; font-size: .82rem; }
.kt-ms summary { cursor: pointer; color: var(--nd-brand); font-weight: 700; }
.kt-ml { margin: 6px 0 0; padding-left: 16px; font-size: .78rem; }
.kt-vc { display: inline-block; border-radius: 999px; padding: 2px 10px; font-size: .74rem; font-weight: 800; }
.kt-vc.ok { background: rgba(22, 163, 74, .16); color: #15803d; }
.kt-vc.warn { background: rgba(217, 119, 6, .18); color: #b45309; }
.kt-vc.bad { background: rgba(220, 38, 38, .16); color: #b91c1c; }
.kt-ms tr.kt-v-bad td:first-child { box-shadow: inset 4px 0 0 #dc2626; }
.kt-ms tr.kt-v-warn td:first-child { box-shadow: inset 4px 0 0 #f59e0b; }
.kt-ms tr.kt-v-ok td:first-child { box-shadow: inset 4px 0 0 #16a34a; }
.kt-pl td, .kt-pl th { font-size: .82rem; vertical-align: middle; }
.kt-pl tr.sec td { background: rgba(148, 163, 184, .16); }
.kt-pl tr.tot td { font-weight: 800; background: rgba(148, 163, 184, .12); }
.kt-pl .nd-input { padding: 5px 8px; font-size: .82rem; min-width: 110px; }
.kt-pl .nd-input.kt-s { min-width: 80px; }
.kt-pl .nd-input.kt-num { text-align: right; min-width: 120px; }
.kt-pt { width: 100%; min-height: 52px; resize: vertical; line-height: 1.45; font-size: .86rem; }
.bb-grow { flex: 1 1 auto; }

/* ---- BBKK: dòng hàng ngoài sổ + phân loại tay ---- */
.bb-xsel { display: block; margin-top: 4px; max-width: 100%; font-size: .74rem; padding: 3px 6px; border-radius: 8px; border: 1px solid var(--nd-border); background: var(--nd-surface, #fff); color: var(--nd-text); }
.bb-xa { font-size: .72rem; color: var(--nd-brand); font-weight: 700; margin-left: 4px; }
.nd-kpi-note { font-size: .72rem; color: var(--nd-faint); margin-top: 4px; line-height: 1.4; }

/* ---- Xem trước: tùy chỉnh bản in + sửa trực tiếp ---- */
.bb-pv-opt { flex: 0 0 auto; display: none; background: var(--nd-surface, #fff); color: var(--nd-text, #0f172a); border-bottom: 1px solid var(--nd-border); padding: 12px 16px; max-height: 42vh; overflow: auto; }
.bb-pv-opt.open { display: block; }
.bb-pv-sec { margin: 0 0 12px; }
.bb-pv-cols { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 4px 14px; margin-top: 6px; }
.bb-pv-c { font-size: .8rem; display: flex; gap: 6px; align-items: center; cursor: pointer; }
.bb-pv-c.lock { opacity: .55; cursor: default; }
.bb-pv-fs { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 8px 14px; margin-top: 6px; }
.bb-pv-f { display: flex; flex-direction: column; gap: 3px; font-size: .74rem; font-weight: 700; color: var(--nd-faint); }
.bb-prev-body.editing { outline: 3px dashed #c8102e; outline-offset: -3px; cursor: text; }
@media print { #bbPrev .bb-pv-opt { display: none !important; } #bbPrev .bb-prev-body.editing { outline: none !important; } }

/* CNT 002 – công nợ */
.kt-cnt { border: 1px solid var(--nd-border); border-radius: 14px; padding: 12px 14px; margin-bottom: 12px; background: var(--nd-surface-2); }
.kt-cnt-h { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; font-size: .88rem; }
.kt-cnt-k { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; margin: 10px 0; }
.kt-cnt-k > div { background: var(--nd-surface, #fff); border: 1px solid var(--nd-border); border-radius: 10px; padding: 8px 10px; display: flex; flex-direction: column; }
.kt-cnt-k span { font-size: .7rem; color: var(--nd-faint); text-transform: uppercase; letter-spacing: .04em; font-weight: 700; }
.kt-cnt-k b { font-size: 1.05rem; font-variant-numeric: tabular-nums; }
.kt-cnt-k .hi { border-color: var(--nd-brand); background: var(--nd-brand-soft); }
.kt-cnt-k small { color: var(--nd-faint); font-size: .72rem; }
.kt-cnt summary { cursor: pointer; font-weight: 700; font-size: .85rem; padding: 4px 0; }

.kt-cn td:nth-child(2) .nd-input { min-width: 100px; }
.kt-cn td:nth-child(3) .nd-input { min-width: 250px; }
.kt-cn td:nth-child(4) .nd-input { min-width: 190px; }
.kt-cn td:nth-child(5) .nd-input { min-width: 150px; }
.kt-cn td:nth-child(6) .nd-input, .kt-cn td:nth-child(7) .nd-input { min-width: 140px; }
.kt-cn td:nth-child(9) .nd-input { min-width: 220px; }

.kt-khos { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; margin: 0 0 12px; font-size: .86rem; }
.kt-kho { display: inline-flex; gap: 6px; align-items: center; padding: 4px 10px; border: 1px solid var(--nd-border); border-radius: 999px; background: var(--nd-surface-2); cursor: pointer; }

/* bảng đối chiếu công nợ: thanh cuộn luôn trong tầm nhìn, tiêu đề + cột tên đứng yên */
.kt-cnwrap { max-height: 66vh; overflow: auto; border: 1px solid var(--nd-border); border-radius: 12px; }
.kt-cn { min-width: 1080px; }
.kt-cn thead th { position: sticky; top: 0; z-index: 3; background: var(--nd-surface-2, #f1f5f9); }
.kt-cn td:nth-child(3), .kt-cn th:nth-child(3) { position: sticky; left: 0; z-index: 2; background: var(--nd-surface, #fff); box-shadow: 1px 0 0 var(--nd-border); }
.kt-cn thead th:nth-child(3) { z-index: 4; background: var(--nd-surface-2, #f1f5f9); }
.kt-cn td:nth-child(3) .nd-input { min-width: 200px; }
.kt-cn td:nth-child(4) .nd-input { min-width: 150px; }
.kt-cn td:nth-child(5) .nd-input, .kt-cn .kt-ht { min-width: 160px; }
.kt-cn td:nth-child(6) .nd-input, .kt-cn td:nth-child(7) .nd-input { min-width: 125px; }
.kt-cn td:nth-child(9) .nd-input { min-width: 200px; }
.kt-cn td:nth-child(2) .nd-input { min-width: 84px; }

/* ô chọn người ký (gõ tay hoặc chọn từ danh sách) */
.bb-combo { display: flex; width: 100%; position: relative; }
.bb-combo .nd-input { flex: 1 1 auto; min-width: 0; border-top-right-radius: 0; border-bottom-right-radius: 0; border-right: none; }
.bb-combo-b { flex: 0 0 auto; border: 1px solid var(--nd-border); border-left: none; border-radius: 0 10px 10px 0; background: var(--nd-surface-2); color: var(--nd-text); padding: 0 12px; cursor: pointer; font-size: .9rem; }
.bb-combo-b:hover { background: var(--nd-brand-soft, #fee2e2); }
.bb-combo-pop { position: fixed; z-index: 100000; max-height: 280px; overflow: auto; background: var(--nd-surface, #fff); color: var(--nd-text, #0f172a); border: 1px solid var(--nd-border); border-radius: 12px; box-shadow: 0 12px 34px rgba(15, 23, 42, .22); padding: 6px; display: flex; flex-direction: column; gap: 2px; }
.bb-combo-pop button { text-align: left; border: 0; background: transparent; padding: 7px 10px; border-radius: 8px; cursor: pointer; display: flex; flex-direction: column; font: inherit; color: inherit; }
.bb-combo-pop button:hover { background: var(--nd-brand-soft, #fee2e2); }
.bb-combo-pop small { color: var(--nd-faint, #64748b); font-size: .74rem; }
.bb-combo-empty { padding: 10px; color: var(--nd-faint); font-size: .84rem; }
.bb-ky { display: grid; grid-template-columns: 1fr 1.4fr auto; gap: 8px; align-items: center; margin-bottom: 8px; }
.bb-date.kms-date-input-group { width: 100%; }
.bb-date .nd-input { cursor: pointer; }

/* ======================================================================
   BBKK mở rộng (bb-extra.js): thanh mục có chấm trạng thái, bảng nhập, ảnh quầy kệ
   ====================================================================== */
.bx-bar { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: flex-start; margin: 0 0 14px; padding: 10px 12px; border: 1px solid var(--nd-border); border-radius: 14px; background: var(--nd-surface); }
.bx-grp { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; padding-right: 14px; border-right: 1px dashed var(--nd-border); }
.bx-grp.last { border-right: 0; padding-right: 0; margin-left: auto; }
.bx-gl { font-size: .64rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--nd-faint); margin-right: 2px; }
.bx-tab { display: inline-flex; align-items: center; gap: 7px; border: 1px solid var(--nd-border); background: var(--nd-surface-2); color: var(--nd-text); border-radius: 999px; padding: 6px 12px; font: inherit; font-size: .8rem; font-weight: 700; cursor: pointer; white-space: nowrap; transition: background .15s, border-color .15s; }
.bx-tab:hover { border-color: var(--nd-brand); }
.bx-tab.on { background: var(--nd-brand); border-color: var(--nd-brand); color: #fff; }
.bx-tab em { font-style: normal; font-size: .7rem; font-weight: 800; background: rgba(0, 0, 0, .09); border-radius: 999px; padding: 1px 7px; }
.bx-tab.on em { background: rgba(255, 255, 255, .25); }
.bx-tab.tong { background: var(--nd-surface); border-color: var(--nd-brand); color: var(--nd-brand); }
.bx-tab.tong.on { background: var(--nd-brand); color: #fff; }
.bx-dot { width: 9px; height: 9px; border-radius: 50%; flex: 0 0 auto; background: #94a3b8; box-shadow: 0 0 0 2px rgba(148, 163, 184, .25); }
.bx-tab.st-ok .bx-dot, .bx-dot.st-ok { background: #16a34a; box-shadow: 0 0 0 2px rgba(22, 163, 74, .25); }
.bx-tab.st-warn .bx-dot, .bx-dot.st-warn { background: #f59e0b; box-shadow: 0 0 0 2px rgba(245, 158, 11, .3); }
.bx-tab.st-empty .bx-dot, .bx-dot.st-empty { background: #cbd5e1; box-shadow: 0 0 0 2px rgba(148, 163, 184, .2); }
.bx-tab.st-na .bx-dot, .bx-dot.st-na { background: transparent; border: 2px solid #94a3b8; box-shadow: none; }
.bx-tab.on .bx-dot { box-shadow: 0 0 0 2px rgba(255, 255, 255, .55); }
.bx-chip { display: inline-block; font-size: .7rem; font-weight: 800; padding: 3px 9px; border-radius: 999px; white-space: nowrap; }
.bx-chip.st-ok { background: rgba(22, 163, 74, .15); color: #15803d; }
.bx-chip.st-warn { background: rgba(245, 158, 11, .2); color: #b45309; }
.bx-chip.st-empty { background: rgba(148, 163, 184, .22); color: #475569; }
.bx-chip.st-na { background: rgba(100, 116, 139, .12); color: #64748b; }
.bx-prog { font-size: .8rem; font-weight: 700; color: var(--nd-faint); margin-left: 8px; }
.bx-pbar { height: 8px; border-radius: 999px; background: var(--nd-surface-2); overflow: hidden; margin: 6px 0 12px; border: 1px solid var(--nd-border); }
.bx-pbar i { display: block; height: 100%; background: linear-gradient(90deg, #16a34a, #22c55e); border-radius: 999px; transition: width .3s; }
.bx-ptbl td, .bx-ptbl th { text-align: left; }

.bx-head { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; margin: 0 0 12px; }
.bx-head h3 { margin: 0; font-size: 1.02rem; font-weight: 800; color: var(--nd-text); }
.bx-legend { display: flex; flex-wrap: wrap; gap: 8px 16px; font-size: .76rem; margin: 0 0 10px; }
.bx-k { display: inline-flex; align-items: center; gap: 6px; }
.bx-k::before { content: ''; width: 14px; height: 14px; border-radius: 4px; border: 1px solid rgba(0, 0, 0, .15); }
.bx-k.auto::before { background: rgba(42, 120, 214, .18); border-color: rgba(42, 120, 214, .5); }
.bx-k.hand::before { background: rgba(250, 204, 21, .28); border-color: rgba(202, 138, 4, .6); }
.bx-tw { max-height: calc(100vh - 300px); }
.bx-t th.au { color: #1d5fb4; }
.bx-t th.hd { color: #a16207; }
.bx-t td { vertical-align: middle; }
.bx-t td.q { min-width: 220px; white-space: normal; }
.bx-t td.hd, .bx-t th.hd.l { min-width: 170px; }
.bx-in { width: 100%; min-width: 60px; box-sizing: border-box; font: inherit; font-size: .78rem; color: var(--nd-text); padding: 5px 7px; border-radius: 7px; border: 1px solid var(--nd-border); outline: none; }
.bx-in.auto { background: rgba(42, 120, 214, .08); border-color: rgba(42, 120, 214, .32); }
.bx-in.hand { background: rgba(250, 204, 21, .13); border-color: rgba(202, 138, 4, .4); }
.bx-in:focus { border-color: var(--nd-brand); box-shadow: 0 0 0 2px color-mix(in srgb, var(--nd-brand) 25%, transparent); background: var(--nd-surface); }
.bx-in.n { text-align: right; }
.bx-in.bad { border-color: #dc2626; background: rgba(220, 38, 38, .08); }
.bx-in.off, .bx-in:disabled { opacity: .6; background: var(--nd-surface-2); cursor: not-allowed; }
.bx-in.p { max-width: 70px; }
select.bx-in { padding: 4px 4px; }
.bx-x { border: 0; background: rgba(220, 38, 38, .1); color: #dc2626; width: 26px; height: 26px; border-radius: 8px; font-size: .95rem; font-weight: 800; line-height: 1; cursor: pointer; }
.bx-x:hover { background: #dc2626; color: #fff; }
.bx-empty { text-align: center; color: var(--nd-faint); padding: 18px 12px !important; font-size: .86rem; }
.bx-mass { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 0 0 10px; font-size: .8rem; color: var(--nd-dim); }
.bx-mass .nd-input { flex: 1 1 260px; max-width: 420px; }
.bx-none { display: flex; align-items: center; gap: 8px; margin: 0 0 10px; font-size: .84rem; cursor: pointer; }
.bx-rad { width: 18px; height: 18px; cursor: pointer; }
.bx-rad.ok { accent-color: #16a34a; }
.bx-rad.no { accent-color: #dc2626; }
.bx-t tr.hit td { background: rgba(250, 204, 21, .1); }

.bx-phgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; margin-top: 10px; }
.bx-ph { border: 1px solid var(--nd-border); border-radius: 12px; padding: 8px; background: var(--nd-surface-2); display: flex; flex-direction: column; gap: 6px; }
.bx-ph img { width: 100%; height: 150px; object-fit: contain; background: #fff; border-radius: 8px; border: 1px solid var(--nd-border); }
.bx-ph-n { font-size: .7rem; font-weight: 800; color: var(--nd-faint); text-transform: uppercase; letter-spacing: .04em; }
.bx-ph-b { display: flex; gap: 6px; }
.bx-ph-b button { flex: 1; }
.bx-ph.over, #bxPhDrop.over { outline: 2px dashed var(--nd-brand); outline-offset: 2px; }

.bx-sug { position: fixed; z-index: 1000050; max-height: 300px; overflow: auto; background: var(--nd-surface, #fff); color: var(--nd-text, #0f172a); border: 1px solid var(--nd-border); border-radius: 12px; box-shadow: 0 14px 38px rgba(15, 23, 42, .25); padding: 4px; }
.bx-sug button { display: flex; flex-direction: column; width: 100%; text-align: left; border: 0; background: transparent; padding: 7px 10px; border-radius: 8px; cursor: pointer; font: inherit; font-size: .82rem; color: inherit; }
.bx-sug button:hover { background: var(--nd-brand-soft, #fee2e2); }
.bx-sug small { color: var(--nd-faint, #64748b); font-size: .72rem; }
@media (max-width: 760px) { .bx-grp { border-right: 0; padding-right: 0; } .bx-grp.last { margin-left: 0; } }
.bx-t th { text-align: left; }
