/* ============================================================================
   KC — CÔNG NỢ PHẢI THU THEO ĐƠN HÀNG (0.9.13 · web/cong-no.js)
   ========================================================================== */
/* nhãn trạng thái đơn / đợt thu */
.cn-tt { display: inline-flex; align-items: center; padding: 2px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 600; white-space: nowrap; background: #eef2f7; color: var(--chu-2); line-height: 1.5; }
.cn-tt.da_thu { background: var(--xanh-nhat); color: var(--xanh); }
.cn-tt.tat_toan { background: #e7f1ec; color: #3f6f56; }
.cn-tt.qua_han { background: var(--do-nhat); color: var(--do); }
.cn-tt.den_han { background: var(--vang-nhat); color: var(--vang); }
.cn-tt.dang_thu, .cn-tt.mot_phan { background: var(--lam-nhat); color: var(--lam); }
.cn-tt.chua_thu, .cn-tt.chua_den_han { background: var(--chinh-nhat); color: var(--chinh-dam); }
.cn-tt.cho_moc, .cn-tt.khong { background: var(--mat-2); color: var(--nhat); border: 1px dashed var(--vien-2); }

/* thẻ «Công nợ» ở trang đơn hàng */
.cn-the .the-dau h2 { display: inline-flex; align-items: center; gap: 6px; }
.cn-mau-chon { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--nhat); }
.cn-mau-chon select { height: 28px; max-width: 300px; padding: 0 8px; border: 1px solid var(--vien-2); border-radius: 7px; background: var(--mat); color: var(--chu); font: inherit; font-size: 12.5px; }
.cn-mau-chon select:focus { outline: none; border-color: var(--chinh); box-shadow: 0 0 0 3px rgba(37,99,235,.15); }
.cn-kpi { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 1px; background: var(--vien); border-bottom: 1px solid var(--vien); }
.cn-k { background: var(--mat); padding: 9px 14px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.cn-k > span { font-size: 11px; font-weight: 600; color: var(--nhat); text-transform: uppercase; letter-spacing: .04em; }
.cn-k b { font-size: 17px; font-weight: 700; color: var(--chu); font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cn-k b i { font-style: normal; font-size: 11px; font-weight: 600; color: var(--nhat); margin-left: 4px; }
.cn-k small { font-size: 11.5px; color: var(--nhat); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cn-k.do b { color: var(--do); }
.cn-k.xong b { color: var(--xanh); }
.cn-thanh { height: 6px; border-radius: 99px; background: var(--mat-2); border: 1px solid var(--vien); overflow: hidden; margin-top: 3px; }
.cn-thanh i { display: block; height: 100%; background: linear-gradient(90deg, #34a36b, var(--xanh)); }
.cn-nguon { display: flex; align-items: center; gap: 7px; padding: 7px 14px; font-size: 12px; color: var(--nhat); border-bottom: 1px solid var(--vien); background: var(--mat-2); }
.cn-nguon .ic { width: 14px; height: 14px; color: var(--mo); flex: none; }
.cn-the > .canh-bao { margin: 8px 14px; }
.cn-lich td small, .cn-tien td small { display: block; font-size: 10.5px; color: var(--nhat); white-space: nowrap; }
.cn-lich td { vertical-align: top; font-variant-numeric: tabular-nums; }
.cn-lich tr.qua_han td:nth-child(4) { color: var(--do); font-weight: 600; }
.cn-lich tr.den_han td:nth-child(4) { color: var(--vang); font-weight: 600; }
.cn-lich tr.da_thu td { color: var(--nhat); }
.cn-lich tr.da_thu td b { color: var(--xanh); }
.cn-phan { padding: 10px 14px 12px; border-top: 1px solid var(--vien); }
.cn-phan h3 { display: flex; align-items: center; gap: 6px; font-size: 13px; margin: 0 0 8px; color: var(--chu-2); }
.cn-phan h3 .ic { width: 15px; height: 15px; color: var(--nhat); }
.cn-tien { width: 100%; }
.cn-tien td { vertical-align: top; font-variant-numeric: tabular-nums; }
.cn-trong { padding: 2px 0; }
.cn-hd { display: flex; flex-wrap: wrap; gap: 8px; }
.cn-hd-o { display: flex; flex-direction: column; gap: 1px; padding: 7px 11px; border: 1px solid var(--vien-2); border-radius: var(--bo-nho); background: var(--mat); color: var(--chu); min-width: 170px; }
.cn-hd-o:hover { border-color: var(--chinh); text-decoration: none; background: var(--chinh-nhat); }
.cn-hd-o span { font-size: 12px; color: var(--chu-2); }
.cn-hd-o small { font-size: 11.5px; color: var(--vang); }
.cn-hd-o.da_tt small { color: var(--xanh); }
.cn-hd-o.huy { opacity: .6; text-decoration: line-through; }

/* hộp gán mẫu · tất toán · ghi tiền về */
.cn-dot-ds { margin: 8px 0 10px 18px; padding: 0; }
.cn-dot-ds li { margin: 2px 0; }
.cn-tich { display: flex; align-items: flex-start; gap: 8px; margin: 8px 0 4px; cursor: pointer; }
.cn-tich input { margin-top: 3px; accent-color: var(--chinh); }
.cn-o { display: flex; flex-direction: column; gap: 3px; }
.cn-o span { font-size: 11.5px; color: var(--nhat); font-weight: 500; }
.hop.cn-hop-thu { width: min(760px, 100%); }
.cn-thu .luoi select { height: 30px; }
.cn-goi-y { margin-top: 10px; line-height: 1.5; }

/* hộp khai báo mẫu công nợ */
.hop.cn-hop-mau { width: min(860px, 100%); }
.cn-mau-ghi { line-height: 1.55; margin-bottom: 10px; }
.cn-mau-kb .canh-bao { font-size: 12.5px; }
.cn-mau { border: 1px solid var(--vien-2); border-radius: var(--bo); padding: 10px 12px; margin-bottom: 10px; background: var(--mat); display: flex; flex-direction: column; gap: 7px; }
.cn-mau:has([data-md]:checked) { border-color: #93b4f5; box-shadow: 0 0 0 3px var(--chinh-nhat); }
.cn-mau-dau { display: flex; align-items: center; gap: 8px; }
.cn-md { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; color: var(--nhat); white-space: nowrap; cursor: pointer; }
.cn-md input { accent-color: var(--chinh); }
.cn-mau-ten { flex: 1; min-width: 0; font-weight: 600; }
.cn-mau-tt { display: flex; }
.cn-mau-tt > input { flex: 1; min-width: 0; height: 30px; padding: 4px 9px; border: 1px solid var(--vien-2); border-radius: var(--bo-nho) 0 0 var(--bo-nho); background: var(--mat); font-size: 12.5px; }
.cn-mau-tt > input:focus, .cn-dot-dong .o-nhap:focus, .cn-dot-dong select:focus { outline: none; border-color: var(--chinh); box-shadow: 0 0 0 3px rgba(37,99,235,.15); }
.cn-dot-sua { display: flex; flex-direction: column; gap: 5px; }
.cn-dot-dong { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 12.5px; }
.cn-dot-dong > .mo-ta { width: 44px; }
.cn-dot-dong .o-nhap.so { width: 64px; height: 30px; text-align: right; }
.cn-dot-dong select { height: 30px; padding: 0 8px; border: 1px solid var(--vien-2); border-radius: var(--bo-nho); background: var(--mat); font: inherit; font-size: 12.5px; min-width: 230px; }
.cn-mau-chan { display: flex; align-items: center; gap: 10px; justify-content: space-between; }
.cn-tong { font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; }
.cn-tong.du { color: var(--xanh); }
.cn-tong.lech { color: var(--do); }

/* màn tổng hợp #/cong-no */
.cn-tong-tt { display: flex; flex-direction: column; gap: 10px; margin-bottom: 12px; }
.cn-tong-o { background: var(--mat); border: 1px solid var(--vien); border-radius: var(--bo); box-shadow: var(--bong); overflow: hidden; }
.cn-tong-dau { padding: 7px 14px; font-weight: 700; border-bottom: 1px solid var(--vien); background: var(--mat-2); }
.cn-tong-luoi { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 1px; background: var(--vien); }
.cn-tong-luoi > div { background: var(--mat); padding: 9px 14px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.cn-tong-luoi span { font-size: 11px; font-weight: 600; color: var(--nhat); text-transform: uppercase; letter-spacing: .04em; }
.cn-tong-luoi b { font-size: 17px; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cn-tong-luoi .do b { color: var(--do); }
.cn-tong-luoi .vang b { color: var(--vang); }
.cn-loat { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 7px 12px; border-bottom: 1px solid var(--vien); background: var(--chinh-nhat); font-size: 12.5px; font-weight: 600; color: var(--chinh-dam); }
.cn-loat[hidden] { display: none; }
.cn-ds td { font-variant-numeric: tabular-nums; }
.cn-ds tr.mb-chon > td { background: var(--chinh-nhat); }
.cn-ds input[type=checkbox] { accent-color: var(--chinh); width: 14px; height: 14px; }

@media (max-width: 1100px) {
  .cn-kpi, .cn-tong-luoi { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
