/* รูปแบบรายงานสำหรับหน้าจอและการพิมพ์ (A4) */
@page { size: A4 portrait; margin: 15mm 15mm 15mm 20mm; }

html, body { font-family: 'Sarabun', 'TH Sarabun New', 'TH SarabunPSK', Tahoma, sans-serif; }
body { background: #e9ecef; margin: 0; color: #111; font-size: 15px; line-height: 1.55; }

.toolbar { position: sticky; top: 0; z-index: 10; background: #1f4e79; color: #fff; padding: .6rem 1rem; display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; box-shadow: 0 2px 6px rgba(0,0,0,.2); }
.toolbar .btn { font-family: inherit; }
.toolbar .spacer { flex: 1; }

.sheet { background: #fff; width: 210mm; min-height: 297mm; margin: 14px auto; padding: 15mm 15mm 15mm 20mm; box-shadow: 0 2px 10px rgba(0,0,0,.15); box-sizing: border-box; page-break-after: always; }
.sheet:last-child { page-break-after: auto; }

.rp-head { text-align: center; margin-bottom: 10px; }
.rp-head .logo { height: 70px; margin-bottom: 4px; }
.rp-head h1 { font-size: 19px; font-weight: 700; margin: 0; }
.rp-head h2 { font-size: 17px; font-weight: 600; margin: 2px 0 0; }
.rp-head .sub { font-size: 15px; color: #333; }

table.rp { width: 100%; border-collapse: collapse; margin: 8px 0; }
table.rp th, table.rp td { border: 1px solid #333; padding: 5px 8px; vertical-align: top; }
table.rp th { background: #f1f3f5; text-align: left; width: 26%; font-weight: 600; }
table.rp td.pre { white-space: pre-wrap; min-height: 2.2em; }

.chk { display: inline-block; width: 15px; height: 15px; border: 1.5px solid #333; vertical-align: -2px; margin-right: 4px; text-align: center; line-height: 12px; font-size: 13px; font-weight: 700; }
.chk.on::after { content: '✓'; }

.rp-section-title { font-weight: 700; font-size: 16px; margin: 14px 0 4px; padding-bottom: 2px; border-bottom: 2px solid #1f4e79; color: #1f4e79; }

.img-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 6px; }
.img-grid .im { page-break-inside: avoid; break-inside: avoid; border: 1px solid #ccc; padding: 4px; text-align: center; }
.img-grid .im img { width: 100%; height: 62mm; object-fit: cover; display: block; }
.img-grid .im .cap { font-size: 13.5px; margin-top: 3px; min-height: 1.2em; }
.img-grid.single { grid-template-columns: 1fr; }
.img-grid.single .im img { height: auto; max-height: 250mm; object-fit: contain; }

.doc-img { page-break-inside: avoid; break-inside: avoid; border: 1px solid #ccc; padding: 4px; margin-top: 8px; text-align: center; }
.doc-img img { max-width: 100%; max-height: 240mm; object-fit: contain; }
.doc-img .cap { font-size: 13.5px; margin-top: 3px; }

ul.doc-ul { margin: 4px 0 0; padding-left: 22px; }
ul.doc-ul li { margin-bottom: 2px; }

.sig-row { display: flex; justify-content: space-between; gap: 10px; margin-top: 34px; page-break-inside: avoid; break-inside: avoid; }
.sig-row .sig { flex: 1; text-align: center; font-size: 14.5px; }
.sig-row .sig .line { margin: 26px 0 2px; white-space: nowrap; }
.sig-row .sig .role { font-weight: 600; }
.empty { color: #777; }

/* ตารางสรุปแบบฟอร์ม */
table.sum { width: 100%; border-collapse: collapse; font-size: 14.5px; }
table.sum th, table.sum td { border: 1px solid #333; padding: 4px 6px; vertical-align: top; }
table.sum th { background: #f1f3f5; text-align: center; font-weight: 600; }
table.sum td.c { text-align: center; width: 60px; font-size: 16px; }
table.sum td.note { width: 30%; }
table.sum tr.cat td { font-weight: 700; background: #fafafa; }
table.sum tr { page-break-inside: avoid; break-inside: avoid; }
.sum-title { font-weight: 700; font-size: 16px; margin: 12px 0 4px; }
.sum-sub { font-weight: 700; font-size: 15px; margin: 10px 0 4px 18px; page-break-after: avoid; break-after: avoid; }

@media print {
  body { background: #fff; font-size: 15px; }
  .toolbar { display: none !important; }
  .sheet { width: auto; min-height: 0; margin: 0; padding: 0; box-shadow: none; }
  a { color: inherit; text-decoration: none; }
}
