/* Bản in PDF của tab «Nhóm SP» (SPEC-XUAT-NHOM-SP.md, 12/10/2026).
   CHỈ ăn khi <body> mang lớp `in-nsp` — xuat-nhom-sp.js bật lớp này ngay trước window.print()
   và gỡ ngay sau. Bấm Ctrl+P tay ở tab khác thì file này không đụng gì. */

.in-dau-nsp,.in-chan-nsp{display:none}

/* Hai nút xuất nằm cuối dòng tiêu đề khối đầu tab: h2 là flex, vệt kẻ ::after (flex:1) đẩy
   nút sang phải — đổi `order` để vệt kẻ đứng GIỮA chữ và nút, không phải sau nút. */
.the.km>h2:has(>.nut-xuat-nsp){flex-wrap:wrap;row-gap:8px}
.the.km>h2:has(>.nut-xuat-nsp)::after{order:1}
.nut-xuat-nsp{order:2;display:flex;gap:8px}
.nut-xuat-nsp .nut-p{padding:6px 12px;font-size:12.5px;font-weight:700;text-transform:none;
  letter-spacing:0;display:inline-flex;align-items:center;gap:6px}
.nut-xuat-nsp .nut-p:disabled{opacity:.55;cursor:not-allowed}
@media(max-width:640px){
  .nut-xuat-nsp{width:100%;margin-bottom:8px}
  .nut-xuat-nsp .nut-p{flex:1;justify-content:center}
}

@media print{
  @page{size:A4 portrait;margin:10mm 9mm 12mm}
  body.in-nsp{background:#fff !important;-webkit-print-color-adjust:exact;print-color-adjust:exact}
  body.in-nsp header,body.in-nsp nav,body.in-nsp footer,body.in-nsp #thanhLocChung,
  body.in-nsp main>section:not(#tabNsp),body.in-nsp #nspQuanLy,body.in-nsp .nut-xuat-nsp,
  body.in-nsp #nspChonTop{display:none !important}
  body.in-nsp main{padding:0 !important;max-width:none !important}

  /* Dải đầu báo cáo — chèn bằng JS lúc bấm, gỡ khi in xong. */
  body.in-nsp .in-dau-nsp{display:flex;align-items:center;gap:12px;padding:0 0 10px;
    margin-bottom:12px;border-bottom:2px solid #067686}
  body.in-nsp .in-dau-nsp .in-logo{height:34px;width:auto}
  body.in-nsp .in-dau-nsp .in-cty{font-size:10px;font-weight:700;color:#067686;letter-spacing:.04em}
  body.in-nsp .in-dau-nsp .in-ten{font-size:17px;font-weight:800;color:#045864;line-height:1.3}
  body.in-nsp .in-dau-nsp .in-ky{font-size:10.5px;color:#4d5f6b}
  body.in-nsp .in-chan-nsp{display:block;margin-top:8px;padding-top:6px;border-top:1px solid #d8e0e4;
    font-size:9.5px;color:#6b7785}

  /* Thẻ: bỏ bóng (máy in đổ thành vệt xám), giữ viền + màu khối. */
  body.in-nsp .the{box-shadow:none !important;margin-bottom:10px;padding:12px 14px}
  body.in-nsp .so-lon{box-shadow:none !important;break-inside:avoid}
  body.in-nsp .luoi.the6{grid-template-columns:repeat(3,1fr) !important}
  body.in-nsp .the.km>h2{break-after:avoid}
  body.in-nsp .mo-ta{break-after:avoid}

  /* Chỉ in pill của nhóm đang chọn — các pill kia là nút bấm, giấy không bấm được. */
  body.in-nsp #nspChonNhom button:not(.chon){display:none}
  body.in-nsp #nspChonNhom button{transform:none !important;box-shadow:none !important}

  /* In ĐỦ cả 3 góc nhìn top, mỗi bảng có nhãn riêng. */
  body.in-nsp [data-bang-top].an{display:block !important}
  body.in-nsp [data-bang-top]{margin-top:8px}
  body.in-nsp [data-bang-top]::before{display:block;margin:4px 0 6px;font-size:11.5px;font-weight:800;
    color:#c2410c;break-after:avoid}
  body.in-nsp [data-bang-top="tatCa"]::before{content:"Góc nhìn: Tất cả kênh"}
  body.in-nsp [data-bang-top="san"]::before{content:"Góc nhìn: Trên sàn TMĐT"}
  body.in-nsp [data-bang-top="ngoai"]::before{content:"Góc nhìn: Ngoài sàn"}

  /* Bỏ khung cuộn: bảng tồn kho dài phải chảy hết ra giấy, không bị cắt ở 380px. */
  body.in-nsp .cuon,body.in-nsp .bd-cuon{overflow:visible !important;max-height:none !important}
  body.in-nsp table.bh th{position:static !important}
  body.in-nsp table.bh thead{display:table-header-group}
  body.in-nsp table.bh tr{break-inside:avoid}
  body.in-nsp table.bh{font-size:11.5px}
  body.in-nsp table.bh th,body.in-nsp table.bh td{padding:5px 7px}
  /* Khổ A4 chỉ ~718px nên cột chia % cứng (table-layout:fixed của màn hình) cắt số thành "2…",
     "88.350.00…" (soi PDF thử 12/10). Lúc in cho bảng tự co cột theo nội dung: số không có chỗ
     ngắt nên luôn đủ chỗ, tên hàng dài tự xuống dòng. Bỏ luôn dấu "…" — giấy không rê chuột được. */
  body.in-nsp table.bh{table-layout:auto}
  body.in-nsp table.bh td{overflow:visible;text-overflow:clip}
  body.in-nsp table.bh tr>:first-child{padding-left:3px;padding-right:3px}
  body.in-nsp table.bh tbody tr:hover{background:inherit}
}
