/* =========================================================
   PRINT STYLES  —  kritisch: A3 Querformat, beidseitig, 4 Sheets.
   Erzeugt exakt 4 Druckseiten in der Saddle-Stitched-Reihenfolge:
     Seite 1 des PDF → Bogen 1 Vorderseite  [ 8 | 1 ]
     Seite 2 des PDF → Bogen 1 Rückseite    [ 2 | 7 ]
     Seite 3 des PDF → Bogen 2 Vorderseite  [ 6 | 3 ]
     Seite 4 des PDF → Bogen 2 Rückseite    [ 4 | 5 ]  (Heftmitte)
   ========================================================= */

@media print {
  @page {
    size: A3 landscape;
    margin: 0;
  }

  html, body {
    background: #fff;
    margin: 0 !important;
    padding: 0 !important;
    width: 420mm;
  }

  /* Alles UI-Chrome raus */
  .no-print,
  .toolbar,
  .sidebar,
  .sidebar-backdrop,
  .print-info,
  .sheet-label,
  .toast,
  .photo-remove,
  .photo-pan,
  .remove-item,
  dialog,
  dialog[open] { display: none !important; }

  /* Workspace: kein padding, kein gap, kein flex */
  .workspace {
    padding: 0 !important;
    margin: 0 !important;
    gap: 0 !important;
    display: block !important;
    min-height: 0 !important;
  }

  /* Im Druck nur das Druck-Layout ausgeben */
  .workspace > .page { display: none !important; }

  .workspace .print-layout {
    display: block !important;
    padding: 0 !important;
    margin: 0 !important;
    gap: 0 !important;
    width: 420mm;
  }

  /* Jedes Sheet ist exakt ein A3-Bogen und erzwingt einen Seitenumbruch */
  .sheet {
    width: 420mm !important;
    height: 297mm !important;
    max-height: 297mm !important;
    margin: 0 !important;
    padding: 0 !important;
    box-shadow: none !important;
    border-radius: 0 !important;
    overflow: hidden !important;
    display: grid !important;
    grid-template-columns: 210mm 210mm !important;
    page-break-after: always;
    break-after: page;
    page-break-inside: avoid;
    break-inside: avoid;
  }
  .sheet:last-child {
    page-break-after: auto;
    break-after: auto;
  }

  /* Jeder Slot ist eine fixe A4-Hochkant-Seite */
  .sheet-slot {
    width: 210mm !important;
    height: 297mm !important;
    overflow: hidden !important;
    position: relative;
  }
  .sheet-slot .page {
    width: 210mm !important;
    height: 297mm !important;
    max-height: 297mm !important;
    box-shadow: none !important;
    border-radius: 0 !important;
    margin: 0 !important;
    overflow: hidden !important;
    page-break-after: auto;
    break-after: auto;
  }

  /* Falzlinie nicht drucken (wäre ja Hilfslinie) */
  .sheet-fold { display: none !important; }

  /* Editierhinweise aus */
  [contenteditable="true"] {
    outline: none !important;
    background: transparent !important;
  }

  /* Bearbeitungs-Chromes / Empty-States im Druck neutralisieren */
  .empty-state { display: none !important; }
  [contenteditable][data-placeholder]:empty::before,
  [data-placeholder]:empty::before { content: none !important; }

  /* Saubere Farben */
  * {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
    color-adjust: exact !important;
  }
}
