/* BOQ Print Stylesheet — Government-standard format */

@import url('https://fonts.googleapis.com/css2?family=Sarabun:wght@400;500;600;700&display=swap');
@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500;600&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+Thai:wght@400;500;600;700&display=swap');

@page {
  size: A4 landscape;
  margin: 15mm 10mm;
}

body {
  font-family: 'Noto Sans Thai', 'Sarabun', 'Segoe UI', sans-serif;
  font-size: 11pt;
  line-height: 1.4;
  color: #000;
  margin: 0;
  padding: 0;
}

.boq-container {
  max-width: 100%;
  margin: 0;
  background: #fff;
}

/* HEADER */
.boq-header {
  margin-bottom: 20px;
  page-break-after: avoid;
}

.boq-header__title {
  text-align: center;
  margin-bottom: 15px;
}

.boq-title {
  margin: 0;
  font-size: 16pt;
  font-weight: bold;
}

.boq-subtitle {
  margin: 3px 0 0 0;
  font-size: 12pt;
  color: #666;
}

.boq-meta-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 10px;
}

.boq-meta-table td {
  padding: 4px 8px;
  border: 1px solid #ccc;
  font-size: 10pt;
}

.boq-meta-table td:first-child {
  width: 100px;
  font-weight: bold;
  background: #f5f5f5;
}

/* TABLE */
.boq-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 10pt;
  margin: 15px 0;
  page-break-inside: avoid;
}

.boq-table th {
  border: 1px solid #000;
  padding: 6px;
  background: #2c3e50;
  color: #fff;
  font-weight: bold;
  text-align: left;
  font-size: 9pt;
}

.boq-table td {
  border: 1px solid #999;
  padding: 5px;
}

.boq-table tbody tr:nth-child(odd) {
  background: #fff;
}

.boq-table tbody tr:nth-child(even) {
  background: #f9f9f9;
}

.boq-cat-header td {
  background: #d4d4d4;
  font-weight: bold;
  border-top: 2px solid #000;
  padding: 6px;
  font-size: 10pt;
}

.boq-item td {
  padding: 4px;
  font-size: 9pt;
}

.boq-subtotal td {
  background: #e8e8e8;
  font-weight: bold;
  border-top: 1px solid #000;
  border-bottom: 1px solid #000;
  padding: 5px;
  font-size: 10pt;
}

.boq-grand-total {
  background: #d4edfa;
  font-weight: bold;
}

.boq-grand-total td {
  border-top: 2px solid #000;
  border-bottom: 1px solid #000;
  padding: 6px;
  font-size: 10pt;
}

.boq-vat-row td {
  border-top: none;
  border-bottom: none;
  padding: 4px 6px;
  font-size: 10pt;
}

.boq-total-with-vat {
  background: #1a4080;
  color: #fff;
}

.boq-total-with-vat td {
  border-top: 2px solid #000;
  border-bottom: 2px solid #000;
  padding: 7px 6px;
  font-weight: bold;
  font-size: 11pt;
}

/* Column alignment */
.col-no {
  width: 40px;
  text-align: center;
}

.col-desc {
  text-align: left;
}

.col-unit {
  width: 60px;
  text-align: center;
  font-size: 9pt;
}

.col-qty {
  width: 70px;
  text-align: right;
  font-family: 'IBM Plex Mono', monospace;
}

.col-rate {
  width: 90px;
  text-align: right;
  font-family: 'IBM Plex Mono', monospace;
}

.col-amount {
  width: 90px;
  text-align: right;
  font-family: 'IBM Plex Mono', monospace;
  font-weight: bold;
}

/* FOOTER */
.boq-footer {
  margin-top: 30px;
  page-break-inside: avoid;
}

.boq-notes {
  margin-bottom: 20px;
  font-size: 9pt;
  line-height: 1.3;
}

.boq-notes p {
  margin: 0 0 5px 0;
  font-weight: bold;
}

.boq-notes ul {
  margin: 5px 0 0 0;
  padding-left: 18px;
}

.boq-notes li {
  margin: 3px 0;
  list-style: disc;
}

.boq-signature-block {
  display: flex;
  gap: 80px;
  margin-top: 40px;
}

.boq-sig-box {
  flex: 1;
  text-align: center;
}

.boq-sig-line {
  border-bottom: 1px solid #000;
  height: 60px;
}

.boq-sig-box p {
  margin: 5px 0;
  font-size: 10pt;
}

.boq-date-line {
  font-size: 9pt !important;
  font-weight: normal;
}

/* PRINT ADJUSTMENTS */
@media print {
  body {
    margin: 0;
    padding: 0;
    background: #fff;
  }

  .no-print {
    display: none !important;
  }

  .boq-container {
    page-break-after: avoid;
  }

  .boq-header {
    page-break-after: avoid;
  }

  .boq-table {
    page-break-inside: avoid;
  }

  .boq-footer {
    page-break-inside: avoid;
  }

  /* Remove hyperlinks color in print */
  a {
    color: #000;
    text-decoration: none;
  }
}

/* ── สามคอลัมน์เงิน: ค่าวัสดุ · ค่าแรง · รวม (2026-08-28) ────────────────────
   เดิมมีคอลัมน์เงินเดียวและตัวหนาทั้งคอลัมน์ พอมีสามคอลัมน์ ตัวหนาทั้งหมดทำให้
   อ่านยากและแยกไม่ออกว่าตัวไหนคือยอดที่ต้องดู — ให้เฉพาะช่อง "รวม" เท่านั้นที่หนา
   (แถวรวม/VAT ยังหนาอยู่เพราะเนื้อหาห่อด้วย <strong> อยู่แล้ว)

   ความกว้าง: A4 แนวนอน 297mm − ขอบ 20mm ≈ 277mm · คอลัมน์ตายตัวรวม
   40 + 60 + 70 + 90 + (88 × 3) = 524px เหลือให้ช่อง "รายการ" ราว 520px ที่ 96dpi */
.boq-table .col-amount {
  width: 88px;
  font-weight: normal;
}
.boq-table .col-total {
  font-weight: 700;
}
