/* ============================================================
   AUTOSALES PRO — PHIẾU IN / XUẤT PDF
   Mẫu lấy nguyên từ dự án Sổ Tay Sale (CRM_Hyundai) — class giữ
   tiền tố "pi-" (phiếu in) thay vì "bq-" gốc để không trùng tên,
   nhưng CÙNG cấu trúc/màu (navy #0c447c) như mẫu công ty gửi —
   không thiết kế lại. Bớt so với bản gốc: không có khối "xem trước
   trên màn hình" song song (app này không có màn xem lại khách cũ),
   không có "Lộ trình thanh toán" kiểu đặt cọc (AutoSales Pro không
   thu tiền cọc) — thay bằng khối Trả góp khi khách vay ngân hàng.
   ============================================================ */
#in-khung{
  display:none;
  font-family:'Be Vietnam Pro', system-ui, sans-serif;
  font-size:12.5px; color:#1a1a1a; background:#fff;
  padding:10px 16px 12px;
}
#in-khung *{ box-sizing:border-box; font-variant-numeric:tabular-nums; }
#in-vay-khung{ display:none; font-family:'Be Vietnam Pro',system-ui,sans-serif; font-size:12px; color:#1a1a1a; background:#fff; padding:10px 16px 12px; }
#in-vay-khung *{ box-sizing:border-box; font-variant-numeric:tabular-nums; }
.pi-vay-table .pi-tien{ width:auto; }
.pi-vay-tong{ margin-top:8px; }

.pi-top-row{ display:flex; justify-content:space-between; align-items:flex-start; }
.pi-logo{ height:26px; }
.pi-so{ text-align:right; font-size:11px; }
.pi-so input{ border:none; background:transparent; font:inherit; font-weight:700; text-align:right; width:90px; }
.pi-so div{ font-size:10px; margin-top:2px; }

.pi-title-row{ display:flex; align-items:center; gap:10px; margin:6px 0 10px; }
.pi-title-line{ flex:1; height:2px; background:#0c447c; }
.pi-title{ font-size:19px; font-weight:700; color:#0c447c; text-transform:uppercase; white-space:nowrap; }

.pi-infobox{ border:1.5px solid #0c447c; border-radius:10px; padding:7px 12px; margin-bottom:8px; }
.pi-inforow{ display:flex; align-items:center; gap:8px; font-size:13px; padding:3px 0; }
.pi-inforow label{ color:#0c447c; font-weight:700; min-width:62px; }
.pi-inforow span{ font-weight:700; }
.pi-inforow2{ display:flex; flex-wrap:wrap; gap:3px 22px; font-size:13px; padding:3px 0; }
.pi-inforow2 label{ color:#0c447c; font-weight:700; margin-right:4px; }
.pi-inforow2 span:not(label){ font-weight:700; }

.pi-priceband{ display:flex; gap:8px; margin-bottom:8px; }
.pi-pricecell{ flex:1; border:1.5px solid #0c447c; border-radius:10px; padding:7px 10px; text-align:center; }
.pi-pricecell label{ display:block; font-size:10px; font-weight:800; letter-spacing:.04em; color:#0c447c; margin-bottom:2px; }
.pi-pricecell b{ font-size:14px; }
.pi-pricecell.pi-giam b{ color:#c0392b; }

.pi-section-title{ background:#0c447c; color:#fff; font-weight:700; font-size:12.5px; padding:5px 10px; margin-top:8px; border-radius:5px 5px 0 0; }
.pi-table{ width:100%; border-collapse:collapse; border:1.5px solid #0c447c; border-top:none; font-size:11.5px; margin-bottom:8px; }
.pi-table th{ background:#eaf1fb; color:#0c447c; padding:4px 8px; border-bottom:1px solid #0c447c; text-align:left; font-size:11px; }
.pi-table td{ padding:4px 8px; border-top:1px solid #dbe6f6; vertical-align:middle; }
.pi-table .pi-stt{ width:26px; text-align:center; color:#6b7280; }
.pi-table .pi-tien{ width:105px; text-align:right; white-space:nowrap; }
.pi-table tr.pi-subtotal td{ font-weight:700; border-top:1.5px solid #0c447c; }
.pi-table tr.pi-total td{ background:#0c447c; color:#fff; font-weight:700; font-size:12.5px; }

.pi-bottom-row{ border:1.5px solid #0c447c; border-radius:0 0 10px 10px; padding:7px 10px; margin-bottom:8px; }
.pi-gift-row{ display:flex; align-items:center; gap:8px; font-size:12px; padding:3px 0; }
.pi-gift-num{ width:16px; height:16px; border-radius:50%; background:#0c447c; color:#fff; font-size:9.5px; font-weight:700; display:flex; align-items:center; justify-content:center; flex-shrink:0; }

.pi-sign{ display:grid; grid-template-columns:1fr 1fr 1fr; gap:8px; margin-top:14px; text-align:center; }
.pi-sign .box{ font-size:11px; color:#0c447c; font-weight:700; text-transform:uppercase; }
.pi-sign .box span{ display:block; font-size:10px; color:#8a8f98; font-weight:400; text-transform:none; margin-top:30px; }

@page{ size:A4; margin:12mm; }
@media print{
  html, body{ background:#fff !important; }
  body > *{ visibility:hidden; }
  body:not(.in-tra-gop) #in-khung, body:not(.in-tra-gop) #in-khung *,
  body.in-tra-gop #in-vay-khung, body.in-tra-gop #in-vay-khung *{
    visibility:visible;
    -webkit-print-color-adjust:exact; print-color-adjust:exact; color-adjust:exact;
  }
  body:not(.in-tra-gop) #in-khung, body.in-tra-gop #in-vay-khung{ display:block; position:absolute; left:0; top:0; width:100%; }
  .pi-infobox, .pi-priceband, .pi-bottom-row, .pi-sign, table.pi-table{
    page-break-inside:avoid; break-inside:avoid;
  }
  .pi-table tr{ page-break-inside:avoid; break-inside:avoid; }
  body.in-tra-gop table.pi-vay-table{ page-break-inside:auto; break-inside:auto; }
  .pi-vay-table thead{ display:table-header-group; }
}
