/* Dokumente: A4-Layout nach Vorbild der Original-PDFs */
.doc {
  --blue: #1f5fa8; --line: #c9d4e3; --soft: #eef3fa; --ink: #222;
  box-sizing: border-box; width: 210mm; min-height: 297mm; padding: 16mm 17mm 20mm;
  background: #fff; color: var(--ink); font: 10pt/1.5 "DejaVu Sans", "Segoe UI", Arial, sans-serif;
  position: relative; margin: 0 auto;
}
.doc * { box-sizing: border-box; }
.doc h2 { color: var(--blue); font-size: 12.5pt; margin: 14pt 0 5pt; }
.doc p { margin: 0 0 6pt; }

/* Angebot */
.d-head { display: flex; align-items: center; gap: 12pt; border-bottom: 1px solid #555; padding-bottom: 8pt; margin-bottom: 10pt; }
.d-logo { max-height: 18mm; max-width: 45mm; }
.d-brand { color: var(--blue); font-size: 21pt; font-weight: 800; letter-spacing: .5px; line-height: 1.1; }
.d-sub { color: #666; font-size: 10pt; }
.d-meta-line { display: flex; justify-content: space-between; gap: 12pt; font-size: 9pt; color: #444; }
.d-meta { text-align: right; }
.d-title { color: var(--blue); font-size: 22pt; margin: 10pt 0 0; letter-spacing: .5px; }
.d-lead { color: #555; margin-bottom: 8pt; }
.d-kv { width: 92%; margin-left: 4%; border-collapse: collapse; }
.d-kv th, .d-kv td { border: 1px solid var(--line); padding: 5pt 8pt; text-align: left; font-size: 9.5pt; }
.d-kv th { background: var(--soft); width: 50%; }
.d-heizlast { background: var(--soft); border-left: 3pt solid var(--blue); padding: 5pt 9pt; }
.d-list { list-style: none; padding: 0; margin: 0; }
.d-list li { margin: 0 0 4pt; }
.d-list li::before { content: "• "; }
.d-price { width: 92%; margin-left: 4%; border-collapse: collapse; }
.d-price td { border: 1px solid var(--line); padding: 7pt 10pt; vertical-align: middle; }
.d-price small { display: block; font-size: 8pt; color: #444; }
.d-price .d-total td small { display: inline; margin-left: 4pt; color: #666; }
.d-price .amt { text-align: right; color: var(--blue); font-weight: 800; font-size: 15pt; white-space: nowrap; width: 35%; }
.d-total td { background: var(--soft); }
.d-sign-firm { margin: 14pt 0 10pt; }
.d-note { font-size: 8.5pt; color: #444; margin-top: 12pt; }
.d-foot { position: absolute; left: 17mm; right: 17mm; bottom: 9mm; border-top: 1px solid #ddd; padding-top: 3pt; font-size: 7.5pt; color: #777; }

/* Auftragsbestätigung / Rechnung */
.doc-ab { font-size: 8.6pt; line-height: 1.4; }
.ab-title { text-align: center; font-size: 15pt; margin: 0 0 12pt; letter-spacing: .5px; }
.ab-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 3pt 20pt; margin-bottom: 4pt; }
.ab-parties { margin: 10pt 0 14pt; }
.ab-caption { margin-bottom: 2pt; }
.ab-table, .ab-sum { width: 100%; border-collapse: collapse; }
.ab-table th, .ab-table td { border: 1px solid #888; padding: 4pt 5pt; text-align: left; vertical-align: middle; }
.ab-table th { background: #ddd; font-weight: 600; }
.ab-table td:nth-child(1) { width: 5%; } .ab-table td:nth-child(2) { width: 30%; }
.ab-sum { margin-top: 6pt; }
.ab-sum td { border: 1px solid #888; padding: 4pt 5pt; font-weight: 700; }
.ab-sum td:last-child { text-align: right; width: 25%; }
.ab-grand td { background: #ddd; }
.doc-ab h3 { font-size: 9pt; margin: 8pt 0 2pt; }
.ab-small { margin: 4pt 0; }
.ab-pay { width: 100%; border-collapse: collapse; }
.ab-pay td { padding: 1pt 4pt; }
.ab-pay td:last-child { text-align: right; font-weight: 700; }
.ab-signs { display: grid; grid-template-columns: 1fr 1fr; gap: 30pt; margin-top: 22pt; }
.ab-line { border-bottom: 1px solid #333; height: 40pt; display: flex; align-items: flex-end; padding-bottom: 2pt; font-size: 10pt; }
.ab-line img { max-height: 46pt; max-width: 100%; }
.ab-signinfo { margin-top: 8pt; font-size: 7pt; color: #777; }

@media print {
  @page { size: A4; margin: 14mm 15mm 14mm; }
  html, body { background: #fff !important; margin: 0; }
  .doc { width: auto; min-height: 0; padding: 0; margin: 0; box-shadow: none !important; break-after: page; }
  .doc:last-child { break-after: auto; }
  .d-foot { position: static; margin-top: 18pt; }
  .d-price tr, .d-kv tr, .ab-table tr, .ab-signs { break-inside: avoid; }
  .doc h2 { break-after: avoid; }
  .no-print { display: none !important; }
}

/* Heizlast */
.d-hl th { width: 58%; font-weight: 600; }
.d-hl .d-hl-res th, .d-hl .d-hl-res td { background: #e3ecf8; color: #12457f; }
.d-hl-table { margin-top: 4pt; font-size: 8.5pt; }
.d-hl-table td:not(:first-child), .d-hl-table th:not(:first-child) { text-align: right; }
.doc-anlage { break-before: page; }
.d-hl-table td:nth-child(1), .d-hl-table th:nth-child(1) { width: 34%; }
.d-hl-table td:nth-child(2) { width: auto; }
.doc-anlage h2 { margin-top: 10pt; }

/* Raumweise Heizlast */
.d-rw { font-size: 7.4pt; }
.d-rw th, .d-rw td { padding: 2.5pt 3.5pt !important; }
.d-rw small { color: #666; font-size: 6.6pt; }
.d-rw tr.d-warn td { background: #fff3e0; }
.doc-bericht h3 { font-size: 10pt; margin: 12pt 0 4pt; color: #12457f; }
.doc-bericht h3 small { display: block; font-weight: 400; color: #555; font-size: 7.8pt; margin-top: 1pt; }
.d-raum { break-inside: avoid; border-top: 1px solid #c9d4e3; margin-top: 8pt; }
.d-calc { font-size: 7.6pt; line-height: 1.5; color: #333; margin: 4pt 0; }
.d-method p { margin: 0 0 5pt; }
