@page { size: A4 portrait; margin: 9mm 11mm; }
.blatt { font-family: Georgia, "Times New Roman", serif; font-size: 9.5pt;
         line-height: 1.35; color: #111; max-width: 180mm; margin: 0 auto; }
  h1 { font-size: 14pt; margin: 0 0 2px; }
  .kopf { border-bottom: 1.5px solid #000; padding-bottom: 4px; margin-bottom: 8px; }
  .meta { font-size: 8pt; color: #444; }
  h2 { font-size: 9.5pt; text-transform: uppercase; letter-spacing: .4px;
       border-bottom: 1px solid #000; margin: 9px 0 3px; padding-bottom: 1px; }
  table { width: 100%; border-collapse: collapse; }
  td { padding: 1.5px 0; border-bottom: 1px dotted #bbb; vertical-align: top; }
  td.k { color: #444; width: 42%; }
  .fuss { font-size: 7.5pt; color: #666; margin-top: 6px; }
  .achtung { font-size: 8.5pt; border: 1px solid #000; padding: 3px 5px; margin: 4px 0; }
  .achtung.stufe2 { border-width: 1.5px; margin: 1px 0 4px; break-inside: avoid;
                    page-break-inside: avoid; }
  .achtung.luftbildpruefung { break-inside: avoid; page-break-inside: avoid; }
  .achtung.luftbildpruefung .quelle { color: #444; }
  h1 .nr { float: right; font-size: 10.5pt; border: 1.5px solid #000; padding: 1px 6px;
           margin-left: 8px; white-space: nowrap; }
  /* Auftragsnummer (Roland 30.10.2026): gut sichtbar auf Seite 1, auch im
     Druck; dieselbe Nummer wie Dankesseite, Liefermail und Reklamation */
  h1 .auftragsnr { font-weight: normal; }
  h1 .auftragsnr b { font-weight: bold; letter-spacing: .02em; }
  h1 .auftragsnr small { font-size: 7.5pt; }
  .pruefstatus .grund { margin: 1px 0 2px; }
  .pruefstatus td.k { width: 18%; padding-right: 2mm; white-space: nowrap; }
  .pruefstatus td { width: 32%; }
  .reklamation { color: #111; font-weight: bold; }
  .garantie { color: #111; }
  .nowrap { white-space: nowrap; }
  .schritte { margin: 2px 0 4px 16px; padding: 0; }
  h2 { page-break-after: avoid; break-after: avoid; }
  /* Welle D: Kernzahlen-Leiste (Rahmen, kein dunkler Hintergrund) */
  .kernzahlen { display: flex; gap: 2mm; margin: 4px 0 6px; }
  .kern { flex: 1 1 0; min-width: 0; border: 1px solid #555; border-radius: 3px;
          padding: 2px 5px; }
  .kern b { display: block; font-size: 10.5pt; line-height: 1.2; }
  .kern span { display: block; font-size: 7.5pt; color: #444; line-height: 1.2; }
  .kern span.zusatz { color: #111; }
  .fussblock { margin-top: 6px; border-top: 1px solid #999; padding-top: 2px; }
  .fussblock .fuss { margin-top: 2px; }
  .fuss.rechtlich { color: #222; }
  .band { font-family: system-ui, sans-serif; font-size: 8.5pt; letter-spacing: .06em;
          text-align: center; color: #7a5b00; background: #fff6d6; border: 1px solid #e6c55a;
          border-radius: 3px; padding: 3px 6px; margin: 0 0 6px; }
  /* Musterdossier (Roland 17.10.2026): Wasserzeichen diagonal übers ganze
     Blatt, zusätzlich zum Band; liegt über dem Inhalt, lässt ihn lesbar */
  .wasserzeichen { position: fixed; left: 0; top: 0; right: 0; bottom: 0;
                   display: flex; align-items: center; justify-content: center;
                   pointer-events: none; z-index: 10; overflow: hidden; }
  .wasserzeichen span { font-family: system-ui, sans-serif; font-weight: 700;
                        font-size: 64pt; letter-spacing: .08em; white-space: nowrap;
                        color: rgba(160, 120, 0, .13); transform: rotate(-54deg);
                        -webkit-print-color-adjust: exact; print-color-adjust: exact; }  figure.bild { margin: 4px 0 8px; page-break-inside: avoid; break-inside: avoid; }
  figure.bild .rahmen { position: relative; border: 1px solid #555; line-height: 0;
                        background: #fff; }
  figure.bild img { display: block; width: 100%; height: auto; }
  figure.bild svg.grenze { position: absolute; left: 0; top: 0; width: 100%; height: 100%; }
  figure.bild figcaption { font-size: 7.5pt; color: #333; margin-top: 2px; line-height: 1.3; }
  figure.bild .quelle { color: #666; }
  figure.fehlt .ausfall, figure.verlinkt .ausfall { border: 1px dashed #888; padding: 14px 10px; font-size: 8.5pt;
                          color: #444; background: #f6f6f6; }
  .bilder2 { display: flex; gap: 4mm; }
  .bilder2 figure.bild { flex: 1 1 0; min-width: 0; }
  .akteure p { margin: 1px 0 2px; }
  .akteure h2 .zeitraum { text-transform: none; letter-spacing: 0; font-weight: normal; }
  .akteure .klein { font-size: 7.5pt; color: #444; }
  /* Am Bildschirm Kleingedrucktes mindestens 12 px (Lighthouse «legible font
     sizes», Musterdossier 10.10.2026; 7.5pt = 10 px war am Handy zu klein).
     Nur @media screen: Druck und PDF (Chrome druckt mit @media print)
     behalten die pt-Grössen oben bzw. im Druck-Block unten. */
  @media screen {
    .meta, .fuss, .achtung, .band, figure.bild figcaption,
    figure.fehlt .ausfall, figure.verlinkt .ausfall, .akteure .klein,
    .kern span { font-size: 12px; }
    h1 .nr { font-size: 14px; }
    h1 .auftragsnr small { font-size: 12px; }
  }
  /* Handy (A3): Prüfstatus-Tabelle untereinander statt vier Spalten */
  @media screen and (max-width: 600px) {
    .kernzahlen { flex-wrap: wrap; }
    .kern { flex: 1 1 40%; }
    .pruefstatus table.ps, .pruefstatus table.ps tbody, .pruefstatus table.ps tr,
    .pruefstatus table.ps td { display: block; width: auto; }
    .pruefstatus table.ps td.k { white-space: normal; padding-top: 4px; border-bottom: none; }
  }
  /* Druck/PDF: «1 Dossier = 1 A4-Seite» (Dauerregel Roland 09.08.2026,
     tests/test_dossier_eine_seite.py). Aufbau (Welle D): Kopf, Kernzahlen,
     Bilderreihe mit Lagezeile, Prüfstatus, darunter zwei Spalten (links
     Grundstück, ÖREB, Potenzial und Kosten; rechts «Wer in … baut», Nächste
     Schritte und Kontakte); der Fuss ohne Kästen über die ganze Breite. Drei
     Schriftstufen (Klasse am body-Element, gewählt beim Druck von
     lieferung.einseitig: erst «gross», passt es nicht, «mittel», dann
     «kompakt»). Ohne Stufen-Klasse gilt «kompakt» — passt immer. */
  @media print {
    /* --- Aufbau (alle Stufen) --- */
    body, .blatt { max-width: none; }
    h1 { margin: 0; }
    h2 { margin: 4px 0 1px; }
    td.k { padding-right: 2mm; }
    .zone-legende { display: none; }
    .kernzahlen { margin: 2px 0 3px; }
    .bilder { display: flex; gap: 3mm; align-items: flex-start; }
    .bilder > figure.bild { flex: 1 1 0; min-width: 0; margin: 1px 0 0; }
    .bilder .bilder2 { flex: 2 1 0; min-width: 0; gap: 3mm; }
    .bilder2 figure.bild { margin: 1px 0 0; }
    figure.fehlt .ausfall, figure.verlinkt .ausfall { padding: 8px 6px; }
    /* Welle M2: Abstand oben im Container (padding), nicht nur als margin
       der ersten Überschrift: am Spaltenumbruch kürzt Chrome den margin
       weg, die Überschrift oben in Spalte 2 klebte am Prüfstatus */
    /* Welle D: Reihenfolge Grundstück, ÖREB, Potenzial und Kosten, «Wer in …
       baut», Nächste Schritte; der Mehrspaltensatz gleicht die Spalten aus
       (feste Spalten liessen den Maximalfall mit acht ÖREB-Themen links auf
       eine zweite Seite laufen, rechts blieb Platz) */
    .spalten { column-count: 2; column-gap: 6mm; padding-top: 3px; }
    .spalten > section.ganz, .spalten tr, .spalten .akteure p, .spalten .schritte li {
      break-inside: avoid; page-break-inside: avoid; }
    .pruefstatus table.ps { table-layout: auto; }
    .pruefstatus td.k { width: 1%; }
    .pruefstatus td { width: auto; }
    .fussblock { break-inside: avoid; page-break-inside: avoid; }
    /* --- Stufe «kompakt» (Untergrenze; gilt auch ohne Stufen-Klasse) --- */
    body, .blatt { font-size: 8pt; line-height: 1.15; }
    h1 { font-size: 13pt; }
    .kopf { padding-bottom: 2px; margin-bottom: 3px; }
    .band { padding: 1px 6px; margin: 0 0 3px; }
    h2 { font-size: 8.5pt; letter-spacing: .2px; margin: 2px 0 1px; }
    .pruefstatus .grund { margin: 0; }
    td { padding-top: 0.2px; padding-bottom: 0.2px; }
    td.k { width: 36%; }
    .achtung { font-size: 8pt; padding: 1px 4px; margin: 1px 0; }
    .kern b { font-size: 8.5pt; line-height: 1.15; }
    .kern span { line-height: 1.1; }
    .kern { padding: 1px 4px; }
    figure.bild figcaption { line-height: 1.12; }
    .fuss { margin-top: 1px; line-height: 1.12; }
    .fussblock { margin-top: 2px; }
    .spalten > section > h2 { margin-top: 2px; }
    .schritte { margin: 1px 0 2px 14px; }
    /* «Wer baut»: je Rolle «gross» vier, «mittel» drei, «kompakt» zwei
       Einträge (sonst passt der Maximalfall nicht auf eine Seite) */
    .akteure .ak-3, .akteure .ak-4 { display: none; }
    .stufe-mittel .akteure .ak-3, .stufe-gross .akteure .ak-3,
    .stufe-gross .akteure .ak-4 { display: inline; }
    .akteure p { margin: 0 0 1px; }
    .akteure .klein { line-height: 1.1; }
    /* --- Stufe «mittel» --- */
    .stufe-mittel { font-size: 9pt; line-height: 1.2; }
    .stufe-mittel h1 { font-size: 15pt; }
    .stufe-mittel .meta { font-size: 8.5pt; }
    .stufe-mittel h2 { font-size: 9pt; }
    .stufe-mittel td { padding-top: 0.5px; padding-bottom: 0.5px; }
    .stufe-mittel .spalten td.k { width: 40%; }
    .stufe-mittel .achtung { font-size: 8.5pt; }
    .stufe-mittel .kern b { font-size: 10pt; }
    .stufe-mittel .fuss, .stufe-mittel figure.bild figcaption { font-size: 7.5pt; }
    /* --- Stufe «gross» --- */
    .stufe-gross { font-size: 10pt; line-height: 1.3; }
    .stufe-gross .band { font-size: 9pt; padding: 2px 6px; margin-bottom: 5px; }
    .stufe-gross h1 { font-size: 18pt; }
    .stufe-gross .meta { font-size: 9pt; }
    .stufe-gross h1 .auftragsnr small { font-size: 8pt; }
    .stufe-gross .kopf { padding-bottom: 3px; margin-bottom: 4px; }
    .stufe-gross h2 { font-size: 10pt; letter-spacing: .3px; margin: 6px 0 2px; }
    .stufe-gross .spalten > section > h2 { margin-top: 6px; }
    .stufe-gross td { padding-top: 1px; padding-bottom: 1px; }
    .stufe-gross table { font-size: 9.5pt; }
    .stufe-gross .spalten td.k { width: 44%; }
    .stufe-gross .achtung { font-size: 9pt; padding: 3px 6px; margin: 5px 0; }
    .stufe-gross .kern b { font-size: 11pt; }
    .stufe-gross .kern span { font-size: 8pt; }
    .stufe-gross .kernzahlen { margin: 3px 0 5px; }
    .stufe-gross .bilder, .stufe-gross .bilder .bilder2 { gap: 4mm; }
    .stufe-gross figure.bild figcaption { font-size: 8pt; line-height: 1.25; margin-top: 3px; }
    .stufe-gross .fuss { font-size: 8pt; line-height: 1.25; margin-top: 3px; }
    .stufe-gross .schritte { margin: 2px 0 4px 18px; }
    .stufe-gross .schritte li { margin-bottom: 2px; }
    .stufe-gross .akteure .klein { font-size: 8pt; }
  }

  .anfrage { break-before: page; page-break-before: always; font-size: 10pt;
             line-height: 1.35; }
  .anfrage h2 { font-size: 11pt; margin: 0 0 4px; }
  .anfrage h3 { font-size: 10pt; margin: 10px 0 2px; }
  .anfrage p { margin: 2px 0 4px; }
  .anfrage .brief { white-space: pre-wrap; font-family: Georgia, "Times New Roman", serif;
                    font-size: 10.5pt; line-height: 1.4; border: 1.5px solid #000;
                    padding: 8px 10px; margin: 6px 0 8px; break-inside: avoid;
                    page-break-inside: avoid; }
  .anfrage .tipp { border: 1px solid #555; padding: 4px 8px; margin: 8px 0; }
  .anfrage ul { margin: 6px 0 0 16px; padding: 0; font-size: 9pt; color: #222; }
  @media screen { .anfrage { font-size: 15px; } .anfrage ul { font-size: 13px; } }

  .anfrage .vermerk { border: 2px solid #000; font-weight: 700; text-transform: uppercase;
                      letter-spacing: .04em; padding: 4px 8px; margin: 4px 0 8px;
                      display: inline-block; }
