/* ===========================================================
   A4-Dokumente – identisches Rendering auf Bildschirm & Druck
   =========================================================== */

.sheet{
  width:210mm;
  min-height:297mm;
  padding:10mm 13mm 8mm;
  background:#fff;
  color:#000;
  font-family:Arial, Helvetica, sans-serif;
  font-size:10.4pt;
  line-height:1.32;
  position:relative;
  box-shadow:0 4px 18px rgba(0,0,0,.28);
  margin:0 auto 14px;
  page-break-after:always;
}

/* Der eigentliche Inhalt. Spalten-Flex, damit die Fußzeile per margin-top:auto
   am Seitenende klebt. Wird der Inhalt zu hoch, verkleinert Docs.einpassen()
   diesen Container per zoom so weit, dass alles auf eine Seite passt –
   sonst rutschen bei viel Ausstattung oder Export-Text drei Zeilen auf Blatt 2. */
.sheet-inner{
  display:flex;
  flex-direction:column;
  min-height:279mm;          /* 297mm − 10mm oben − 8mm unten */
}
.sheet:last-child{page-break-after:auto}

.sheet h1{font-size:17.5pt;margin:0;text-align:center;letter-spacing:.2px}
.sheet h2{font-size:11.5pt;margin:0 0 3mm}

/* --- Kopf --- */
.d-head{display:flex;align-items:flex-start;gap:6mm;min-height:15mm}
.d-head .h-left{width:52mm}
.d-head .h-mid{flex:1;padding-top:6mm}
.d-head .h-right{width:62mm;text-align:right}
.d-logo{max-width:62mm;max-height:19mm;object-fit:contain}

.box-title{
  border:1.2pt solid #000;padding:1.5mm 3mm;display:inline-block;text-align:center;line-height:1.2;
}
.box-title b{font-size:13.5pt;display:block}
.box-title small{font-size:8.8pt}

/* --- Parteien --- */
.parties{display:flex;gap:8mm;margin-top:2mm}
.party{flex:1}
.party.right{text-align:right}
.party h3{font-size:10.6pt;margin:0 0 1mm;font-weight:bold}
.kv{display:flex;gap:3mm;margin-bottom:.2mm}
.kv .k{width:23mm;color:#000;text-align:left;flex:none}
.kv .v{font-weight:bold;border-bottom:.3pt solid #cfcfcf;flex:1;min-height:4.1mm}
/* Im Kaufvertrag stehen die Käuferdaten fest – dort keine Schreiblinien.
   Bei Probefahrt und Ankauf bleiben sie, da wird von Hand ausgefüllt. */
.party.ohne-linien .kv .v{border-bottom:0}
.party.right .line{line-height:1.24}

.doc-meta{margin-top:1mm;text-align:right;font-size:11.5pt}
.doc-meta .nr{font-weight:bold;font-size:12pt}

/* --- Datentabelle Fahrzeug --- */
.sec-label{font-weight:bold;font-size:11.5pt;margin:2mm 0 .5mm}
table.grid4{width:100%;border-collapse:collapse;table-layout:fixed}
/* Vollständiges Raster mit senkrechten Trennern wie auf dem Originalvordruck */
table.grid4 td{
  border:.4pt solid #000;padding:.5mm 1.5mm 1mm;vertical-align:top;
}
table.grid4 .lbl{display:block;font-size:8.6pt;line-height:1.15;color:#333}
table.grid4 .val{display:block;font-size:11.5pt;font-weight:bold;min-height:4.4mm;padding-top:.4mm}
table.grid4 tr.thick td{border-top-width:1pt}
table.grid4 tr:last-child td{border-bottom:.4pt solid #000}

/* --- Bemerkungszeilen zwischen Kaufobjekt und Preis ---
   Ohne sichtbare Linien; leere Zeilen sind einfach Freiraum. */
.freizeilen{margin-top:2mm}
.freizeilen > div{height:5.6mm;font-size:10.4pt;padding-left:.5mm}

/* --- Preisblock Kaufvertrag ---
   Linksbündig am Textrand, Beschriftungen und Beträge gemeinsam umrahmt. */
.pricebox{width:118mm;margin:4mm 0 0;border-collapse:collapse}
.pricebox td{border:.5pt solid #000;padding:1mm 2.5mm;font-size:11.5pt}
.pricebox td.lab{
  text-align:left;width:56mm;padding-right:3mm;white-space:nowrap;
}
.pricebox td.num{text-align:right;font-variant-numeric:tabular-nums;white-space:nowrap}
.pricebox tr.total td{font-weight:bold}
.pricebox tr.total td.lab{font-weight:bold}
.pricebox td.small{font-size:10pt;white-space:normal}

.note-25a{margin-top:2mm;font-size:10pt}

/* --- Fließtext --- */
.terms{margin-top:2.5mm;text-align:justify;font-size:7.9pt;line-height:1.26}
.terms h2{font-size:10.5pt;margin-bottom:1mm}
.sale-line{display:flex;margin-top:2.5mm;font-size:10.8pt;gap:4mm}
.sale-line .sl{flex:1;white-space:nowrap}
.zusatz{margin-top:2.5mm;color:#c0202a;font-size:10.8pt;min-height:5mm;white-space:pre-wrap}
.zusatz .zlabel{font-weight:normal}

/* Export-Klausel – kompakter als der Standardtext, sonst platzt die Seite */
.export-note{margin-top:3mm;font-size:8.6pt;line-height:1.35;text-align:justify}
.export-note b.h{display:block;font-size:10pt;margin-bottom:.8mm}

/* --- Unterschriften --- */
.signs{display:flex;gap:14mm;margin-top:11mm}
.signs .sg{flex:1;display:flex;gap:4mm}
.signs .sg .dt{width:34mm}
.signs .sg .ln{flex:1}
.signs .line{border-bottom:.7pt solid #000;height:7mm}
.signs .cap{font-size:8.8pt;padding-top:.8mm}

/* --- Rechnung --- */
.r-sender{font-size:7.6pt;text-decoration:underline;margin-bottom:1.5mm;color:#333}
.addr-window{height:28mm;padding-top:5mm}
.addr-window .name{font-weight:bold;font-size:12pt}
.addr-window .ln{font-size:12pt}

.r-firm{font-size:9.8pt;text-align:right;line-height:1.34}
.r-firm b{font-size:10.4pt}
.r-firm .tax{margin-top:1.5mm;font-size:8.8pt;color:#222}

.r-meta{text-align:right;margin:1.5mm 0 2mm}
.r-meta .dt{font-size:11.5pt}
.r-meta small{font-size:8pt;color:#333;display:block}
.r-title{font-size:16pt;font-weight:bold;margin:.5mm 0 2mm}

table.pos{width:100%;border-collapse:collapse;margin-top:2mm}
table.pos th{
  background:#d9d9d9;text-align:left;padding:1.8mm 2.5mm;font-size:10.6pt;border:0;
}
table.pos th.num{text-align:right}
table.pos td{padding:1.4mm 2.5mm;border-bottom:.3pt solid #bfbfbf;font-size:11pt}
table.pos td.num{text-align:right;font-variant-numeric:tabular-nums}
table.pos tr.sum td{border-top:.6pt solid #000;border-bottom:0;font-weight:normal}
table.pos tr.grand td{background:#d9d9d9;font-weight:bold;font-size:12pt;border:0}

.sumbox{width:92mm;margin-left:auto;border-collapse:collapse;margin-top:3mm}
.sumbox td{padding:1.1mm 2.5mm;font-size:10.4pt}
.sumbox td.num{text-align:right;font-variant-numeric:tabular-nums;white-space:nowrap;width:34mm}
.sumbox tr.grand td{border:1pt solid #000;font-size:13pt;font-weight:bold}

/* Fußzeilen: margin-top:auto schiebt sie ans Seitenende, wächst der Inhalt,
   rücken sie einfach nach – Überlappung ist konstruktiv ausgeschlossen. */
.footer-reserve{display:none}

.footer3{
  margin-top:auto;padding-top:2mm;
  display:flex;gap:6mm;font-size:8.2pt;font-style:italic;color:#111;
  border-top:.4pt solid #999;line-height:1.3;
}
.footer3 div{flex:1}
.footer-bank{
  margin-top:auto;padding-top:2mm;
  font-size:8.6pt;font-style:italic;border-top:.4pt solid #999;
}

/* --- Punkteliste der vorvertraglichen Information --- */
table.punkte{width:100%;border-collapse:collapse;margin-top:2mm}
table.punkte td{border:.4pt solid #000;padding:1.2mm 2mm;vertical-align:top}
table.punkte td.nr{width:9mm;font-weight:bold;text-align:center}
table.punkte td.frage{width:88mm;font-size:9.6pt}
table.punkte td.antwort{font-size:11pt;font-weight:bold}
table.punkte .klein{font-size:7.8pt;color:#333;line-height:1.25;display:block;margin-top:.4mm}

/* --- Erfassungsfelder im GwG-Formblatt --- */
.gwg-reihe{display:flex;gap:4mm;margin-top:3mm}
.gwg-reihe .gf{flex:1;min-width:0}
.gwg-reihe .gf .wert{
  min-height:6mm;font-size:11pt;font-weight:bold;
  border-bottom:.5pt solid #000;padding:0 1mm .6mm;
}
.gwg-reihe .gf .lbl{font-size:8pt;color:#333;padding-top:.6mm}
.box{font-size:12pt;line-height:1}
.linie{display:inline-block;width:60mm;border-bottom:.4pt solid #000;margin-left:2mm}

/* --- Checklisten (Übergabe) --- */
ul.check{list-style:none;padding:0;margin:2mm 0 0;column-count:2;column-gap:10mm}
ul.check li{padding:1.3mm 0;font-size:10.4pt;break-inside:avoid}
ul.check li::before{content:"";display:inline-block;width:3.6mm;height:3.6mm;border:.6pt solid #000;margin-right:2.5mm;vertical-align:-.6mm}

.fillline{border-bottom:.4pt solid #000;min-height:5mm;margin:1mm 0}
.small{font-size:9pt;color:#222}
.mt4{margin-top:4mm}.mt8{margin-top:8mm}

@media print{
  @page{size:A4;margin:0}
  .sheet{box-shadow:none;margin:0;width:210mm;min-height:297mm}
  #doc-host{display:none}
}
