/* หน้าใบเสนอราคา — ใช้ทั้งบนจอและตอนพิมพ์ */
@import url('https://fonts.googleapis.com/css2?family=Sarabun:wght@400;600;700&display=swap');

.qdoc {
  --red: #c8102e;
  font-family: 'Sarabun', 'Leelawadee UI', Tahoma, sans-serif;
  color: #1d1d1d; background: #fff;
  width: 210mm; min-height: 297mm; margin: 0 auto; padding: 14mm 14mm 12mm;
  box-sizing: border-box; font-size: 10.5pt; line-height: 1.45;
}
.qdoc * { box-sizing: border-box; }
.qh { display: flex; gap: 14px; align-items: center; border-bottom: 2px solid var(--red); padding-bottom: 8px; }
.qlogo { width: 66px; height: 66px; border-radius: 8px; flex: none; }
.qco { font-size: 9.5pt; color: #333; min-width: 0; overflow-wrap: anywhere; }
.qco-name { font-size: 14pt; font-weight: 700; color: #111; }
.qtitle { text-align: center; font-size: 16pt; margin: 10px 0 8px; color: var(--red); letter-spacing: .5px; }
.qinfo { display: grid; grid-template-columns: 1.25fr 1fr; gap: 12px; margin-bottom: 10px; }
.kv { border-collapse: collapse; width: 100%; border: 1px solid #d8d8d8; }
.kv th, .kv td { text-align: left; vertical-align: top; padding: 3px 8px; font-size: 9.8pt; }
.kv th { width: 38%; color: #555; font-weight: 600; white-space: nowrap; background: #fafafa; }
.qitems { width: 100%; border-collapse: collapse; }
.qitems th { background: var(--red); color: #fff; font-weight: 600; padding: 5px 6px; font-size: 9.8pt; }
.qitems td { padding: 6px; border-bottom: 1px solid #e3e3e3; vertical-align: top; }
.qitems .c { text-align: center; } .qitems .r { text-align: right; white-space: nowrap; }
.iname { font-weight: 600; }
.idetail { color: #444; font-size: 9.5pt; }
.inote { color: #333; font-size: 9.5pt; margin-top: 2px; padding-left: 8px; border-left: 2px solid #f0c0c8; }
.qitems tr { page-break-inside: avoid; }
.qbottom { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 10px; page-break-inside: avoid; }
.lbl { font-weight: 700; margin-bottom: 2px; }
.pre { font-size: 9.6pt; }
.qtot { border-collapse: collapse; width: 100%; }
.qtot th { text-align: right; font-weight: 400; padding: 3px 8px; font-size: 9.8pt; }
.qtot td { text-align: right; padding: 3px 8px; width: 34%; white-space: nowrap; }
.qtot .grand th, .qtot .grand td { font-weight: 700; font-size: 11.5pt; border-top: 2px solid #222; border-bottom: 3px double #222; }
.qbaht { text-align: right; font-weight: 600; margin-top: 4px; }
.qfoot { font-size: 9pt; color: #666; margin-top: 2px; }
.qevent { margin-top: 10px; page-break-inside: avoid; }
.qevent ol { margin: 2px 0 0; padding-left: 22px; }
.qthanks { margin: 14px 0 6px; text-align: center; color: #444; }
.qsign { display: grid; grid-template-columns: 1fr 1fr; gap: 30px; margin-top: 26px; text-align: center; line-height: 1.9; page-break-inside: avoid; }
.muted { color: #888; }

@page { size: A4; margin: 0; }
@media print {
  html, body { background: #fff !important; margin: 0; }
  .no-print { display: none !important; }
  .qdoc { box-shadow: none !important; margin: 0; width: auto; min-height: auto; }
  .qitems th { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
@media screen and (max-width: 820px) {
  .qdoc { width: 100%; min-height: 0; padding: 16px; font-size: 10pt; }
  .qinfo, .qbottom { grid-template-columns: minmax(0, 1fr); }
  .kv th { white-space: normal; width: 40%; }
  .qitems th, .qitems td { padding: 4px 3px; font-size: 9pt; }
  .qh { align-items: flex-start; }
  .qlogo { width: 48px; height: 48px; }
  .qsign { gap: 12px; font-size: 9pt; overflow-wrap: anywhere; }
  .qsign > div { min-width: 0; }
}
