/* ============================================================================
   KC — Bản vẽ PDF · 3D (web/ban-ve.js). Dùng biến màu của app.css, tiền tố bv-.
   ========================================================================== */
/* ô "bản vẽ" trong bảng dòng hàng */
.bv-o { display: inline-flex; align-items: center; gap: 3px; flex-wrap: wrap; vertical-align: middle; }
td > .bv-o, [data-bv] { margin-top: 3px; }
.bv-chip { height: 22px; min-width: 30px; padding: 0 6px; border-radius: 6px; border: 1px solid var(--vien); background: var(--mat); font-size: 11px; font-weight: 700;
  cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 2px; color: var(--chu-2); line-height: 1; }
.bv-chip sup { font-size: 9px; font-weight: 600; }
.bv-chip.pdf { background: var(--chinh-nhat); border-color: #bfd3f6; color: var(--chinh); }
.bv-chip.d3 { background: var(--tim-nhat); border-color: #d9c9f6; color: var(--tim); }
.bv-chip.cad { background: #f1f5f9; color: var(--chu-2); }
.bv-chip.trong { color: var(--mo); border-style: dashed; min-width: 26px; padding: 0 4px; }
.bv-chip.trong .ic { width: 13px; height: 13px; }
.bv-chip.them { min-width: 22px; color: var(--nhat); }
.bv-chip:hover { filter: brightness(.96); border-color: var(--chinh); }
.bv-canh-nho { height: 22px; padding: 0 5px; border-radius: 6px; border: 1px solid; display: inline-flex; align-items: center; gap: 2px; font-size: 11px; font-weight: 700; cursor: pointer; }
.bv-canh-nho .ic { width: 13px; height: 13px; }
.bv-canh-nho.do { background: var(--do-nhat); color: var(--do); border-color: #f5c2c2; }
.bv-canh-nho.vang { background: var(--vang-nhat); color: var(--vang); border-color: #f3dfa6; }

/* dòng tóm tắt bản vẽ trên đầu bảng (yêu cầu / báo giá / đơn hàng…) */
.bv-tom { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 8px 12px; border-radius: 10px; background: #f8fafc; border: 1px solid var(--vien); font-size: 13px; margin-bottom: 10px; }
.bv-tom > .ic { color: var(--nhat); }
.bv-tom span { flex: 1; min-width: 200px; }
.bv-tom.do { background: var(--do-nhat); border-color: #f5c2c2; }
.bv-tom.vang { background: var(--vang-nhat); border-color: #f3dfa6; }
.bv-tom b.do { color: var(--do); }

.bv-tom-o { padding: 10px 12px 0; }
.bv-tom-o:empty { display: none; }
.bv-tom-o .bv-tom { margin-bottom: 0; }

/* ảnh nhỏ */
.bv-anh { width: 120px; height: 90px; object-fit: contain; background: #f3f6fa; border: 1px solid var(--vien); border-radius: 8px; display: inline-grid; place-items: center; font-size: 11px; color: var(--mo); flex: none; }
.bv-anh.nho { width: 64px; height: 48px; border-radius: 6px; }
.bv-anh.trong { font-weight: 700; }

/* hộp tải lên */
.bv-hop-tai .hop-than { min-height: 220px; }
.bv-tha { border: 2px dashed #c6d3e6; border-radius: 12px; padding: 18px; display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; color: var(--chu-2); background: #f8fafc; margin-bottom: 12px; outline: 0; }
.bv-tha .ic.lon { width: 30px; height: 30px; color: var(--chinh); }
.bv-tha.keo { border-color: var(--chinh); background: var(--chinh-nhat); }
.bv-hang-loat { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 8px 10px; background: var(--vang-nhat); border-radius: 8px; margin-bottom: 8px; font-size: 13px; }
.bv-hang-loat .ic { width: 15px; height: 15px; color: var(--vang); vertical-align: -3px; }
.bv-bang-tai td { vertical-align: top; }
.bv-bang-tai td input.ma { width: 100%; min-width: 180px; height: 30px; font-family: "JetBrains Mono", Consolas, monospace; font-size: 12.5px; font-weight: 600; }
.bv-bang-tai select { height: 30px; }
.bv-bang-tai tr.mo td { opacity: .55; }
.bv-ten-tep { word-break: break-all; }
.bv-trung { font-size: 12.5px; line-height: 1.45; padding: 4px 8px; border-radius: 7px; margin-bottom: 4px; }
.bv-trung .ic { width: 13px; height: 13px; vertical-align: -2px; }
.bv-trung.do { background: var(--do-nhat); color: var(--do); }
.bv-trung.vang { background: var(--vang-nhat); color: #8a5a00; }
.bv-goi-y { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.bv-goi-y button { cursor: pointer; border: 1px solid var(--vien); }
.bv-tien { height: 4px; background: #e5eaf1; border-radius: 4px; overflow: hidden; margin-top: 5px; }
.bv-tien i { display: block; height: 100%; background: var(--chinh); transition: width .2s; }
.xoay.nho { width: 12px; height: 12px; display: inline-block; vertical-align: -2px; }

/* hộp xem lớn */
.hop.bv-hop-xem { width: min(1500px, 100%); height: calc(100vh - 32px); }
/* KC 0.9.1: hộp so sánh TOÀN MÀN HÌNH (lớp phủ bỏ lề, hộp không bo góc) — thân là cột: thông tin trên, khung xem chiếm phần còn lại (≥ 55vh), thân cuộn khi thiếu chỗ */
.che.bv-che-ss { padding: 0; }
.che > .hop.bv-hop-ss { width: 100%; max-width: none; height: 100vh; height: 100dvh; max-height: none; border-radius: 0; }
.bv-hop-xem .hop-dau .hang-nut, .bv-hop-ss .hop-dau .hang-nut { gap: 6px; }
.bv-khung-xem { flex: 1; min-height: 0; width: 100%; height: 100%; position: relative; background: #e8edf3; display: flex; }
.bv-khung-xem > * { flex: 1; min-width: 0; }
.bv-khung-xem .trong { margin: auto; color: var(--chu-2); }

/* so sánh */
.hop-than.bv-ss-than { display: flex; flex-direction: column; gap: 10px; padding: 10px 14px 12px; flex: 1 1 auto; min-height: 0; overflow: auto; }
.bv-ss-tt-vung { flex: none; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.bv-ss-than.gon .bv-ss-tt-vung { display: none; }
.bv-ss-than.gon { padding-top: 8px; }
/* hàng 2: bảng vật liệu | giá — cạnh nhau khi màn rộng, chồng khi hẹp */
.bv-ss-hang2 { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; align-items: start; }
@media (min-width: 1280px) {
  .bv-ss-hang2 { grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); }
  .bv-ss-hang2.mot { grid-template-columns: minmax(0, 1fr); }
  .bv-ss-hang2:not(.mot) .bv-ss-gia-luoi { grid-template-columns: 1fr; max-height: 340px; }
  /* có bảng vật liệu: hai cột ngay từ đầu vùng thông tin — trái thẻ A | B + kết quả, phải bảng vật liệu rồi giá — để bảng vật liệu
     luôn thấy ngay khi mở (vùng thông tin chỉ cao ~42 % màn, xem dưới) */
  .bv-ss-tt-vung.co-ky { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); align-items: start; }
  .bv-ss-tt-vung.co-ky .bv-ss-ben { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .bv-ss-tt-vung.co-ky .bv-ss-ket { grid-column: 1 / -1; }
  .bv-ss-tt-vung.co-ky .bv-ss-hang2 { grid-template-columns: minmax(0, 1fr); }
}
/* dưới 1280px (một cột): bảng vật liệu lên ĐẦU vùng thông tin, trước thẻ A | B — vùng này chỉ cao ~42 % màn và cuộn riêng, bảng nằm sau thẻ thì mở
   hộp không thấy chút nào (1366×768 thu phóng 125 % → 1093×614, 1024×700); giá vẫn sau thẻ */
@media (max-width: 1279.98px) {
  .bv-ss-tt-vung.co-ky .bv-ss-hang2 { display: contents; }
  .bv-ss-tt-vung.co-ky .bv-ss-ky { order: -1; }
  .bv-ss-tt-vung.co-ky .bv-ss-ky, .bv-ss-tt-vung.co-ky .bv-ss-gia { flex: none; }   /* mục của cột flex trong vùng cuộn: không bị ép còn đường viền */
}
.bv-ss-ky { border: 1px solid var(--vien); border-radius: 10px; background: var(--mat); min-width: 0; overflow: hidden; }
.bv-ss-ky-dau { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; padding: 6px 10px; border-bottom: 1px solid var(--vien); font-size: 13px; color: var(--chu); }
.bv-ss-ky-cuon { overflow-x: auto; }
.bv-ss-ky .bv-tt-bang tbody tr:last-child > * { border-bottom: 0; }
.hop-dau [data-ky-tom]:empty { display: none; }
.bv-ss-ben { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1.25fr); gap: 10px; }
.bv-ss-the { display: flex; gap: 10px; align-items: flex-start; border: 1px solid var(--vien); border-radius: 10px; padding: 8px; background: var(--mat); min-width: 0; position: relative; }
.bv-ss-the > div { min-width: 0; font-size: 13px; }
.bv-ss-the .mo-ta { word-break: break-all; }
.bv-ss-the .hang-nut { margin-top: 6px; gap: 6px; }
.bv-ab { position: absolute; top: -8px; left: -8px; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-weight: 800; font-size: 12px; }
.bv-ab.A { background: #2563eb; } .bv-ab.B { background: #ea580c; }
.bv-ss-ket { border: 1px solid var(--vien); border-radius: 10px; padding: 8px; background: var(--mat); display: flex; gap: 10px; align-items: flex-start; min-width: 0; }
.bv-ss-diem { font-size: 26px; font-weight: 800; letter-spacing: -.02em; display: flex; flex-direction: column; min-width: 92px; color: var(--chu-2); }
.bv-ss-diem small { font-size: 12px; font-weight: 600; }
.bv-ss-diem.do { color: var(--do); } .bv-ss-diem.vang { color: var(--vang); }
.bv-bang-so { font-size: 12.5px; flex: 1; }
.bv-bang-so td, .bv-bang-so th { padding: 3px 6px; }
.bv-ss-chinh { flex: 1 0 55vh; min-height: 55vh; display: flex; flex-direction: column; border: 1px solid var(--vien); border-radius: 10px; overflow: hidden; }
/* máy tính: phần thông tin (thẻ A · B, vật liệu, giá) cuộn RIÊNG, tối đa ~42 % chiều cao — khung xem luôn thấy trọn phần còn lại (thân hộp cuộn
   thì ở 1366×768 khung xem nằm hẳn dưới mép màn, và lăn chuột khi con trỏ đã nằm trên khung 3D là thu phóng chứ không cuộn) */
@media (min-width: 861px) {
  .bv-ss-tt-vung { max-height: 42vh; max-height: 42dvh; overflow: auto; padding: 8px 4px 2px 8px; margin: -8px -4px 0 -8px; }   /* lề trong để huy hiệu A · B (lệch -8px) không bị vùng cuộn cắt */
  .bv-ss-chinh { flex: 1 1 0; min-height: 260px; }
}
/* bảng số PDF của thẻ kết quả: cột nhãn không bị ép còn một chữ mỗi dòng; mã ghi trong bản vẽ (chuỗi dài) xuống dòng */
.bv-bang-so-pdf td:first-child { min-width: 120px; }
.bv-bang-so-pdf td.so { white-space: normal; overflow-wrap: break-word; }
.bv-ss-thanh { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-bottom: 1px solid var(--vien); background: var(--mat); flex-wrap: wrap; }
.bv-ss-tuy { display: inline-flex; gap: 12px; align-items: center; }
.bv-ss-tuy input { vertical-align: -2px; }
.bv-ss-khung { flex: 1; min-height: 0; position: relative; display: flex; background: #e8edf3; }
.bv-ss-khung > * { flex: 1; min-width: 0; }
.bv-ss-khung > .dang-tai, .bv-ss-khung > .trong { margin: auto; flex: none; }
.bv-hai { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; height: 100%; width: 100%; }
.bv-hai > div { position: relative; min-width: 0; min-height: 0; height: 100%; display: flex; }
.bv-hai > div > * { flex: 1; min-width: 0; }

/* chọn bản vẽ để so */
.bv-h3 { font-size: 13px; color: var(--nhat); margin: 10px 0 6px; text-transform: uppercase; letter-spacing: .04em; }
.bv-ds-chon { display: flex; flex-direction: column; gap: 6px; margin-top: 6px; }
.bv-chon { display: flex; align-items: center; gap: 10px; text-align: left; padding: 6px; border: 1px solid var(--vien); border-radius: 10px; background: var(--mat); cursor: pointer; font-size: 13px; }
.bv-chon:hover { border-color: var(--chinh); background: var(--chinh-nhat); }
.bv-chon > span:nth-child(2) { flex: 1; min-width: 0; }
.bv-chon .bv-anh { width: 64px; height: 48px; }

/* bảng giá của một mã (mọi lần) — cạnh chỗ báo giống / khớp */
.bv-gia { width: 100%; border-collapse: collapse; font-size: 12px; margin-top: 4px; background: var(--mat); border-radius: 6px; }
.bv-gia th, .bv-gia td { padding: 3px 6px; border-bottom: 1px solid #edf1f6; text-align: left; vertical-align: top; color: var(--chu-2); white-space: nowrap; }
.bv-gia th { font-weight: 600; color: var(--chu); background: #f8fafc; white-space: normal; min-width: 92px; }
.bv-gia th small { display: block; font-weight: 500; color: var(--nhat); font-size: 11px; }
.bv-gia td.so { text-align: right; }
.bv-gia tr:last-child td, .bv-gia tr:last-child th { border-bottom: 0; }
.bv-gia-trong { font-size: 12px; margin-top: 4px; }
.bv-gia-ma { margin-top: 6px; background: rgba(255, 255, 255, .55); border-radius: 8px; padding: 4px 8px; color: var(--chu-2); }
.bv-gia-ma > summary { cursor: pointer; font-size: 12.5px; }
.bv-gia-ma .bv-gia { overflow-x: auto; display: block; }
.bv-gia-gon { font-size: 12px; color: var(--chinh); font-weight: 600; }
.bv-gia-o { min-width: 300px; max-width: 520px; }
td.bv-gia-o .bv-gia { display: block; max-height: 150px; overflow: auto; }
.bv-ss-gia { border: 1px solid var(--vien); border-radius: 10px; padding: 6px 10px; background: var(--mat); }
.bv-ss-gia > summary { cursor: pointer; font-size: 13px; font-weight: 600; color: var(--chu); }
.bv-ss-gia-luoi { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; margin-top: 6px; max-height: 190px; overflow: auto; }
.bv-ss-gia-o { min-width: 0; overflow-x: auto; }
.bv-ss-gia-dau { display: flex; align-items: center; gap: 6px; font-size: 12.5px; position: relative; }
.bv-ss-gia-dau .bv-ab { position: static; width: 20px; height: 20px; font-size: 11px; }
@media (max-width: 860px) { .bv-ss-gia-luoi { grid-template-columns: 1fr; } }

/* hộp bản vẽ của một mã */
.bv-ds-canh { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.bv-canh { display: flex; gap: 8px; align-items: flex-start; padding: 8px 10px; border-radius: 9px; font-size: 13px; background: #f1f5f9; color: var(--chu-2); }
.bv-canh > .ic { width: 16px; height: 16px; flex: none; margin-top: 2px; }
.bv-canh.do { background: var(--do-nhat); color: var(--do); }
.bv-canh.vang { background: var(--vang-nhat); color: #8a5a00; }
.bv-canh.lam { background: var(--chinh-nhat); color: var(--chinh); }
.bv-canh .nut { color: var(--chu); }

/* thư viện */
.bv-bang-tv td { vertical-align: middle; }
.bv-o-tep { display: flex; align-items: center; gap: 6px; font-size: 12.5px; margin: 2px 0; }
.bv-o-tep a { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bv-canh-dong { font-size: 12px; line-height: 1.35; padding: 2px 6px; border-radius: 6px; margin: 2px 0; background: #f1f5f9; color: var(--chu-2); }
.bv-canh-dong.do { background: var(--do-nhat); color: var(--do); }
.bv-canh-dong.vang { background: var(--vang-nhat); color: #8a5a00; }
.bv-canh-dong.lam { background: var(--chinh-nhat); color: var(--chinh); }

/* màn một bản vẽ */
.bv-ct { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(300px, 1fr); gap: 12px; align-items: start; }
.bv-ct-xem { height: calc(100vh - 230px); min-height: 420px; display: flex; overflow: hidden; padding: 0; }
.bv-ct-ben { display: flex; flex-direction: column; gap: 0; min-width: 0; }
.bv-ct-ben .tt { grid-template-columns: 1fr; }
.bv-ct-ben .the-than.bv-gia-o { max-width: none; overflow-x: auto; }   /* KC 0.9.1: bảng giá dài (nhiều lần · tên NCC) cuộn trong thẻ, không đẩy cả trang cuộn ngang */
.bv-dong-nho { display: flex; align-items: center; gap: 8px; font-size: 13px; margin: 4px 0; }
.bv-dong-nho > span { flex: 1; min-width: 0; }
tr.chon td { background: var(--chinh-nhat); }

@media (max-width: 860px) {
  .bv-ct { grid-template-columns: 1fr; }
  .bv-ct-xem { height: 60vh; }
  .bv-ss-ben { grid-template-columns: 1fr 1fr; }
  .bv-ss-ket { grid-column: 1 / -1; }
  .bv-ss-the .bv-anh { display: none; }
  .hop-than.bv-ss-than { padding: 8px 10px 10px; }
  .bv-ss-chinh { flex: 1 0 70vh; min-height: 70vh; }
  .bv-hai { grid-template-columns: 1fr; grid-template-rows: 1fr 1fr; }
  .hop.bv-hop-xem { height: calc(100vh - 16px); }
}

/* đầu hộp xem / so sánh: tên dài (mã + tệp) cắt gọn, nút xuống dòng khi màn hẹp */
.bv-hop-xem .hop-dau, .bv-hop-ss .hop-dau, .bv-hop-tai .hop-dau { flex-wrap: wrap; padding: 10px 14px; gap: 8px; }
.bv-hop-xem .hop-dau h2, .bv-hop-ss .hop-dau h2 { min-width: 0; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: flex; align-items: center; gap: 6px; }
.bv-hop-ss .hop-dau h2 .h1-phu { font-size: 13px; font-weight: 500; color: var(--nhat); overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.hop-dau h2 .ic { width: 16px; height: 16px; flex: none; }
@media (max-width: 860px) {
  .bv-hop-xem .hop-dau h2, .bv-hop-ss .hop-dau h2 { flex-basis: 100%; order: -1; }
  .bv-hop-ss .hop-dau { padding: 8px 10px; }
  .bv-hop-ss .hop-dau > [data-dong] { position: absolute; top: 6px; right: 6px; }
  .bv-hop-ss .hop-dau { position: relative; padding-right: 44px; }
  .bv-hop-xem .hop-dau .hang-nut .nut { padding: 0 8px; }
}
.bv-so-khac { font-family: "JetBrains Mono", Consolas, monospace; font-size: 11.5px; white-space: normal; word-break: break-word; text-align: left !important; }

/* ---------- KC 0.9.1: thông tin kỹ thuật của mã (vật liệu · bề mặt · gia công…) kèm nguồn ---------- */
.bv-tt-bang { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.bv-tt-bang th, .bv-tt-bang td { padding: 5px 8px; border-bottom: 1px solid #edf1f6; text-align: left; vertical-align: top; }
.bv-tt-bang tbody th { font-weight: 600; color: var(--nhat); white-space: nowrap; width: 1%; font-size: 12px; }
.bv-tt-bang thead th { background: #f8fafc; font-weight: 600; color: var(--nhat); font-size: 11.5px; white-space: nowrap; }
.bv-tt-ss td { width: 44%; min-width: 150px; }
.bv-tt-ss td.bv-tt-kq { width: 1%; min-width: 0; white-space: nowrap; text-align: right; }
.bv-tt-ss tr.khac td, .bv-tt-ss tr.khac th { background: #fff8f8; }
.bv-tt-dau { display: inline-flex; align-items: center; gap: 6px; color: var(--chu); }
.bv-tt-dau .bv-ab { position: static; width: 20px; height: 20px; font-size: 11px; flex: none; }
.bv-tt-dau .nut { height: 22px; padding: 0 6px; font-size: 11.5px; color: var(--chinh); }
.bv-tt-dau .nut .ic { width: 13px; height: 13px; }
.bv-tt-gt { display: flex; flex-wrap: wrap; align-items: center; gap: 3px 6px; min-width: 0; }
.bv-tt-chu { color: var(--chu); font-weight: 600; word-break: break-word; }
.bv-tt-dich { color: var(--nhat); font-weight: 400; font-size: 12px; }
.nhan.bv-tt-ng { font-size: 10.5px; padding: 0 7px; line-height: 1.7; border: 0; text-decoration: none; cursor: default; font-family: inherit; }
a.nhan.bv-tt-ng, button.nhan.bv-tt-ng { cursor: pointer; }
a.nhan.bv-tt-ng:hover, button.nhan.bv-tt-ng:hover { text-decoration: underline; filter: brightness(.96); }
.bv-tt-them { border: 1px solid var(--vien); background: var(--mat); border-radius: 999px; font-size: 10.5px; font-weight: 600; padding: 0 6px; line-height: 1.6; color: var(--nhat); cursor: pointer; font-family: inherit; }
.bv-tt-them.lech { background: var(--vang-nhat); border-color: #f3dfa6; color: var(--vang); }
.bv-tt-them.on { box-shadow: 0 0 0 2px rgba(37, 99, 235, .25); }
span.bv-tt-them { cursor: help; }
.bv-tt-ds { margin-top: 4px; padding: 4px 8px; background: #f8fafc; border: 1px solid #edf1f6; border-radius: 6px; display: flex; flex-direction: column; gap: 3px; font-size: 12px; color: var(--chu-2); }
.bv-tt-ds[hidden] { display: none; }
.bv-tt-ds > div { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.bv-tt-chan { display: flex; align-items: center; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.bv-tt-chan .mo-ta { flex: 1; min-width: 180px; }
/* điện thoại: bảng A | B gọn lại (nhãn, mã xuống dòng) cho vừa bề ngang; bảng số của thẻ kết quả xuống dưới điểm */
@media (max-width: 600px) {
  .bv-tt-bang th, .bv-tt-bang td { padding: 4px 5px; }
  .bv-tt-ss tbody th { white-space: normal; min-width: 62px; }
  .bv-tt-ss td { min-width: 104px; }
  .bv-tt-ss thead th { white-space: normal; }
  .bv-tt-dau { flex-wrap: wrap; gap: 3px 5px; }
  .bv-tt-dau b { word-break: break-all; font-size: 11.5px; }
  .bv-ss-ket { flex-wrap: wrap; }
  .bv-ss-ket .bv-bang-so { flex-basis: 100%; }
}
/* dòng gọn trên đầu hộp xem một bản vẽ */
.bv-tt-gon { flex-basis: 100%; order: 3; display: flex; align-items: center; gap: 4px 14px; flex-wrap: wrap; font-size: 12.5px; color: var(--nhat); }
.bv-tt-gon > span { display: inline-flex; align-items: center; gap: 5px; flex-wrap: wrap; min-width: 0; }
.bv-tt-gon b { color: var(--chu); font-weight: 600; }
.bv-tt-gon .nut { height: 22px; padding: 0 5px; }
.bv-tt-gon .nut .ic { width: 13px; height: 13px; }

/* ---------- KC 0.9.6: BẢN VẼ CỦA YÊU CẦU (ghim theo dòng) ---------- */
/* huy hiệu bản ĐÃ GHIM: viền đậm cùng màu chữ (bản «theo mã» viền nhạt) */
.bv-chip.ghim { border-width: 1.5px; border-color: currentColor; box-shadow: inset 0 -2px 0 rgba(15, 27, 45, .08); }
.bv-chip.tinh, .bv-chip.bv-tinh { cursor: default; gap: 4px; }
.bv-chip.bv-tinh:hover { filter: none; border-color: var(--vien); }
.bv-chip.trong .ic + *, .bv-yc .bv-chip.trong { gap: 4px; }
.bv-yc .bv-chip.trong { padding: 0 7px; font-weight: 600; }
/* «Dùng bản đang lưu (bản N, ngày …)» — lời mời, bấm mới ghim */
.bv-chip.tv { background: var(--mat); border-style: dashed; border-color: #9fb7e8; color: var(--chinh); font-weight: 600; padding: 0 8px; gap: 4px; white-space: nowrap; }
.bv-chip.tv small { font-weight: 500; color: var(--nhat); font-size: 10.5px; }
.bv-chip.tv:hover { background: var(--chinh-nhat); border-style: solid; }
.bv-canh-nho.lam { background: var(--chinh-nhat); color: var(--chinh); border-color: #bfd3f6; font-weight: 600; white-space: nowrap; }
/* vùng «Bản vẽ của yêu cầu» trên đầu bảng mã + nền khi đang kéo tệp vào */
.bv-yc-vung .bv-tom { margin-bottom: 0; }
.bv-yc-goi { padding: 4px 2px 0; }
.bv-keo { outline: 2px dashed var(--chinh); outline-offset: -2px; border-radius: 12px; background: rgba(37, 99, 235, .04); }
.bv-keo .bv-yc-vung .bv-tom { background: var(--chinh-nhat); border-color: #9fb7e8; }
.bv-tom .ic { flex: none; }
.bv-tom span .ic { width: 13px; height: 13px; vertical-align: -2px; color: var(--chinh); }
.bv-chu-do { color: var(--do); }
/* hộp kiểm · gắn: mỗi tệp một kết luận có màu */
.bv-tha.bv-tha-gon { flex-direction: column; padding: 10px 12px; gap: 4px; margin-bottom: 10px; }
.bv-tha.bv-tha-gon > div:first-child { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: center; }
.bv-tha.bv-tha-gon .ic { width: 18px; height: 18px; color: var(--chinh); }
.bv-bang-yc td { vertical-align: top; }
.bv-bang-yc select { height: 30px; max-width: 100%; border: 1px solid var(--vien-2); border-radius: 7px; background: var(--mat); padding: 0 6px; font: inherit; }
.bv-bang-yc select.bv-can-chon { border-color: var(--do); box-shadow: 0 0 0 2px rgba(198, 40, 40, .12); }
.bv-bang-yc tr.mo td { opacity: .6; }
.bv-o-tep-yc { min-width: 170px; }
.bv-o-dong-yc { min-width: 200px; }
.bv-o-dong-yc select { width: 100%; }
.bv-o-kl-yc { min-width: 300px; }
.bv-o-xl-yc { min-width: 190px; }
.bv-loi-tep { display: flex; gap: 5px; align-items: flex-start; margin-top: 4px; padding: 3px 7px; border-radius: 6px; font-size: 12px; line-height: 1.4; color: var(--do); background: var(--do-nhat); overflow-wrap: anywhere; }
.bv-loi-tep .ic { width: 13px; height: 13px; margin-top: 2px; }
.bv-xl { display: flex; align-items: center; gap: 4px; }
.bv-xl select { flex: 1; min-width: 0; }
.bv-kl { display: flex; gap: 7px; align-items: flex-start; padding: 6px 9px; border-radius: 8px; font-size: 12.5px; line-height: 1.45; margin-bottom: 4px; background: #f1f5f9; color: var(--chu-2); }
.bv-kl > .ic { width: 15px; height: 15px; flex: none; margin-top: 2px; }
.bv-kl > div { min-width: 0; flex: 1; }
.bv-kl .hang-nut { margin-top: 5px; gap: 5px; }
.bv-kl .nut { color: var(--chu); max-width: 100%; height: auto; min-height: 26px; white-space: normal; text-align: left; overflow-wrap: anywhere; }
.bv-kl.xanh { background: var(--xanh-nhat); color: #14532d; }
.bv-kl.do { background: var(--do-nhat); color: #8f1d1d; }
.bv-kl.vang { background: var(--vang-nhat); color: #7c4a03; }
.bv-kl.lam { background: var(--chinh-nhat); color: #1e3a8a; }
.bv-kl .ma { font-family: "JetBrains Mono", Consolas, monospace; font-size: 12px; font-weight: 600; }
.bv-kl-ma { display: flex; align-items: center; justify-content: space-between; gap: 6px; flex-wrap: wrap; margin-top: 5px; padding-top: 5px; border-top: 1px dashed rgba(15, 27, 45, .14); }
.bv-kl-ma .hang-nut { margin-top: 0; }
/* hộp bản vẽ của một dòng */
.bv-hop-dong .bv-h3 { display: flex; align-items: center; gap: 6px; }
.bv-hop-dong .bv-h3 .ic { width: 14px; height: 14px; }
.bv-bang-dong td { vertical-align: middle; }
.bv-bang-dong td:nth-child(3) { word-break: break-word; min-width: 150px; }
.bv-nut-phai { justify-content: flex-end; gap: 5px; flex-wrap: wrap; }
.bv-hop-dong .bv-dong-nho { flex-wrap: wrap; padding: 5px 8px; border: 1px solid var(--vien); border-radius: 8px; }
.bv-hop-dong .bv-dong-nho .hang-nut { gap: 5px; }
/* danh sách mã thiếu bản vẽ trước khi gửi hỏi giá */
.bv-ds-thieu { display: flex; flex-wrap: wrap; gap: 4px 6px; max-height: 180px; overflow: auto; }
.bv-ds-thieu .ma { font-family: "JetBrains Mono", Consolas, monospace; font-size: 12px; font-weight: 600; background: #f1f5f9; border-radius: 6px; padding: 2px 7px; }
/* màn một bản vẽ: bản đang được ghim ở yêu cầu */
.canh-bao.bv-dang-ghim { border-color: #bfd3f6; background: var(--chinh-nhat); color: #1e3a8a; align-items: flex-start; }
.canh-bao.bv-dang-ghim > .ic { margin-top: 2px; }
@media (max-width: 600px) {
  .bv-chip.tv small { display: none; }
  .bv-yc-vung .bv-tom span { min-width: 0; flex-basis: 100%; }
}
/* điện thoại / hộp hẹp: bảng kiểm · bảng bản vẽ của dòng xếp thành thẻ (mỗi tệp một khối, các ô chồng dọc) — khỏi cuộn ngang mới thấy kết luận */
@media (max-width: 760px) {
  .bv-bang-yc thead, .bv-bang-dong thead { display: none; }
  .bv-bang-yc, .bv-bang-yc tbody, .bv-bang-yc tr, .bv-bang-yc td, .bv-bang-dong, .bv-bang-dong tbody, .bv-bang-dong tr, .bv-bang-dong td { display: block; width: 100%; min-width: 0; }
  .bv-bang-yc tr, .bv-bang-dong tr { padding: 8px 0; border-bottom: 1px solid var(--vien); }
  .bv-bang-yc td, .bv-bang-dong td { border: 0; padding: 3px 0; }
  .bv-bang-yc td:first-child { padding: 0; font-weight: 700; }
  .bv-bang-yc td:first-child::before { content: "Tệp #"; }
  .bv-bang-dong td:first-child { display: none; }
  .bv-bang-dong td.so { text-align: left; }
  .bv-nut-phai { justify-content: flex-start; }
  .bv-hop-yc .hop-chan, .bv-hop-dong .hop-chan { gap: 6px; }
  .bv-hop-yc .hop-chan .nho { flex-basis: 100%; }
}

/* ---------- KC 0.9.7: HIỆU LỰC · bản sửa mới · chi tiết khác (mã mới) · giống 100 % ---------- */
.bv-ky { display: inline-block; padding: 0 6px; border-radius: 6px; background: #eef2ff; color: #3730a3; font-size: 11px; font-weight: 700; font-family: "JetBrains Mono", Consolas, monospace; line-height: 1.6; vertical-align: 1px; white-space: nowrap; }
.bv-nut-chu { border: 0; background: none; padding: 0; color: var(--chinh); font: inherit; font-size: 12px; cursor: pointer; text-decoration: underline; }
.bv-nut-chu:disabled { color: var(--mo); cursor: default; text-decoration: none; }
/* ô nhập thêm dưới lựa chọn: hiệu lực từ · ký hiệu · mã mới */
.bv-xl-them { margin-top: 6px; padding: 6px 8px; border: 1px dashed var(--vien-2); border-radius: 8px; background: #fafcff; display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; }
.bv-xl-dong { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin: 0; }
.bv-xl-dong > span { min-width: 76px; color: var(--nhat); font-weight: 600; font-size: 12px; }
.bv-xl-dong input { height: 28px; flex: 1 1 140px; min-width: 0; max-width: 100%; border: 1px solid var(--vien-2); border-radius: 7px; padding: 0 6px; font: inherit; font-size: 12.5px; background: var(--mat); }
.bv-xl-dong input.ma { font-family: "JetBrains Mono", Consolas, monospace; font-weight: 600; }
.bv-xl-canh { color: var(--do); font-size: 12px; line-height: 1.4; }
.bv-xl-canh .ic { width: 13px; height: 13px; vertical-align: -2px; }
.bv-xl-chu { color: var(--chinh); font-size: 12px; line-height: 1.4; }
.bv-goi-y .nhan small { font-weight: 500; color: var(--nhat); font-size: 10px; }
.bv-ma-goc { margin-top: 4px; font-size: 12px; line-height: 1.45; color: #7c4a03; background: var(--vang-nhat); border-radius: 6px; padding: 3px 7px; }
.bv-ma-goc .mo-ta { color: #8a6a2a; }
.bv-o-ma-tai { min-width: 200px; }
.bv-o-ma-tai input.ma { width: 100%; min-width: 0; }
/* «áp cho mọi tệp cùng kết luận» */
.bv-loat-nhom { display: inline-flex; align-items: center; gap: 4px; flex-wrap: wrap; padding: 2px 10px 2px 0; border-right: 1px solid rgba(15, 27, 45, .12); }
.bv-loat-nhom:last-of-type { border-right: 0; }
.bv-loat-hl { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 12.5px; }
.bv-loat-hl input { height: 28px; border: 1px solid var(--vien-2); border-radius: 7px; padding: 0 6px; font: inherit; font-size: 12.5px; background: var(--mat); }
/* bảng các bản theo loại (hộp bản vẽ của mã, màn một bản vẽ) */
.bv-h3.bv-h3-loai { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; text-transform: none; letter-spacing: 0; font-size: 13px; color: var(--chu); margin-top: 14px; }
.bv-bang-ban td { vertical-align: middle; }
.bv-bang-ban tr.bv-ban-cu td { background: #fbfcfe; }
.bv-bang-ban tr.bv-ban-cu td:nth-child(n+3):not(:last-child) { color: var(--nhat); }
.bv-bang-ban td a.nowrap { display: inline-flex; align-items: center; gap: 3px; font-size: 12.5px; }
.bv-bang-ban td a .ic { width: 12px; height: 12px; }
.bv-o-ten { word-break: break-word; min-width: 150px; max-width: 300px; }
.bv-luat-hl { margin: 8px 0 0; color: var(--nhat); line-height: 1.45; }
.nhan.bv-nhan-thay { white-space: normal; text-align: left; }
.canh-bao.bv-hl-xem { margin: 10px 0 6px; }
.canh-bao.bv-hl-xem[hidden] { display: none; }
.bv-o-tep.bv-sap .bv-chip { border-style: dashed; }
.bv-dt-nhan { display: none; }
.bv-hop-tai .bv-bang-yc td { vertical-align: top; }
@media (max-width: 760px) {
  .bv-bang-ban thead { display: none; }
  .bv-bang-ban, .bv-bang-ban tbody, .bv-bang-ban td { display: block; width: 100%; min-width: 0; max-width: none; }
  .bv-bang-ban tr { display: grid; grid-template-columns: auto auto 1fr; gap: 2px 8px; align-items: start; padding: 8px 0; border-bottom: 1px solid var(--vien); }
  .bv-bang-ban td { border: 0; padding: 0; }
  .bv-bang-ban td:nth-child(n+4) { grid-column: 1 / -1; }
  .bv-bang-ban td.so { text-align: left; }
  .bv-bang-ban .bv-dt-nhan { display: inline; color: var(--nhat); font-size: 12px; }
  .bv-o-ma-tai { min-width: 0; }
  .bv-loat-nhom { border-right: 0; padding-right: 0; }
}
