/* Druckbelege (Lieferschein, Staging-Auftrag). A4 hoch, schwarz-weiss tauglich, ein Akzent in SSG-Blau. */

#print { display: none; }

/* Bildschirmvorschau zum Prüfen: <body class="doc-preview"> */
body.doc-preview > *:not(#print) { display: none !important; }
body.doc-preview #print { display: block; background: #e9edf2; padding: 24px 0; }
body.doc-preview .doc { width: 210mm; min-height: 297mm; margin: 0 auto; padding: 14mm 16mm; background: #fff; box-shadow: 0 6px 30px rgba(0, 0, 0, 0.15); }

@media print {
  @page {
    size: A4;
    margin: 12mm 14mm 16mm;
    @bottom-right { content: 'Seite ' counter(page) ' von ' counter(pages); font: 8pt -apple-system, 'Segoe UI', Arial, sans-serif; color: #6b7785; }
  }
  html, body { background: #fff !important; }
  body > *:not(#print), dialog { display: none !important; }
  #print { display: block; }
  .doc { padding: 0; }
}

.doc {
  --ink: #0f1b2a;
  --muted: #5b6878;
  --line: #cfd7e1;
  --soft: #f3f6f9;
  --accent: #0b5cad;
  color: var(--ink);
  font: 9.5pt/1.45 -apple-system, BlinkMacSystemFont, 'Segoe UI', Inter, Arial, sans-serif;
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
}
.doc p { margin: 0; }
.doc .muted { color: var(--muted); }
.doc .mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 8.5pt; }

/* Kopf */
.doc-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; padding-bottom: 12px; border-bottom: 2.5px solid var(--accent); }
.doc-brand { display: flex; gap: 10px; align-items: center; }
.doc-brand .doc-mark { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 8px; background: var(--accent); color: #fff; font-weight: 800; font-size: 13pt; letter-spacing: 0.02em; }
.doc-brand strong { display: block; font-size: 12pt; }
.doc-brand span { display: block; font-size: 8.5pt; color: var(--muted); }
.doc-id { text-align: right; }
.doc-type { font-size: 20pt; font-weight: 800; letter-spacing: -0.01em; line-height: 1.1; }
.doc-number { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 11pt; font-weight: 600; margin: 2px 0 6px !important; }
.doc .barcode { display: block; margin-left: auto; max-width: 70mm; }

/* Kennzeichen-Leiste */
.doc-meta { display: grid; grid-template-columns: repeat(3, 1fr); margin: 12px 0 14px; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.doc-meta div { padding: 7px 10px; border-right: 1px solid var(--line); background: var(--soft); }
.doc-meta div:last-child { border-right: 0; }
.doc-meta dt { font-size: 7.5pt; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.doc-meta dd { margin: 1px 0 0; font-size: 10pt; }

/* Adress- und Infoblöcke */
.doc-grid { display: grid; grid-template-columns: 1.3fr 1fr 1fr; gap: 10px; margin-bottom: 12px; }
.doc-box { border: 1px solid var(--line); border-radius: 6px; padding: 9px 11px; break-inside: avoid; }
.doc-box.full { margin-bottom: 12px; }
.doc-box h2 { margin: 0 0 5px; font-size: 7.5pt; text-transform: uppercase; letter-spacing: 0.07em; color: var(--accent); }
.doc .addr { font-size: 10.5pt; line-height: 1.4; }
.doc-note { margin-bottom: 12px !important; padding: 7px 10px; border-left: 3px solid var(--accent); background: var(--soft); }

/* Positionen */
.doc-table { width: 100%; border-collapse: collapse; margin-bottom: 14px; }
.doc-table thead { display: table-header-group; }
.doc-table th { position: static; border: 0; white-space: nowrap; text-align: left; font-size: 7.5pt; text-transform: uppercase; letter-spacing: 0.05em; color: #fff; background: var(--ink); padding: 6px 7px; }
.doc-table td { position: static; padding: 5px 7px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.doc-table tbody tr:nth-child(even) td { background: var(--soft); }
.doc-table tr { break-inside: avoid; }
.doc-table td { white-space: nowrap; }
.doc-table tr.sub td, .doc-table tfoot td { white-space: normal; }
.doc-table tr.sub td { font-style: italic; color: var(--muted); }
.doc-table tfoot td { font-weight: 700; border-top: 2px solid var(--ink); border-bottom: 0; padding-top: 7px; }
.doc-table .r { text-align: right; }
.doc-table .c { text-align: center; width: 36px; }

/* Ankreuzfelder */
.doc .tick { display: inline-block; width: 11px; height: 11px; border: 1.3px solid var(--ink); border-radius: 2px; vertical-align: -1px; }
.doc-checks { list-style: none; margin: 0; padding: 0; display: grid; gap: 5px; }
.doc-checks li { display: flex; gap: 9px; align-items: center; font-size: 10pt; }
.doc-check { display: flex; gap: 9px; align-items: center; margin-bottom: 10px !important; font-weight: 600; }

/* Unterschriften */
.doc-sign { break-inside: avoid; margin-top: 18px; }
.sign-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.sign-grid div { height: 52px; border-bottom: 1.2px solid var(--ink); display: flex; align-items: flex-end; }
.sign-grid span { transform: translateY(16px); font-size: 7.5pt; color: var(--muted); }

.doc-foot { display: flex; justify-content: space-between; gap: 16px; margin-top: 30px; padding-top: 8px; border-top: 1px solid var(--line); font-size: 7.5pt; color: var(--muted); }

/* Staging-Auftrag: Palettenkopf gut lesbar auf Distanz */
.pallet { display: grid; grid-template-columns: 1fr auto; gap: 12px; align-items: stretch; margin-bottom: 12px; }
.pallet-main { border: 2px solid var(--ink); border-radius: 8px; padding: 12px 14px; }
.pallet-qty { font-size: 24pt; font-weight: 800; line-height: 1.1; letter-spacing: -0.01em; }
.pallet-dest { font-size: 16pt; font-weight: 700; margin-top: 6px !important; }
.pallet-site { font-size: 11pt; color: var(--muted); }
.pallet-config { min-width: 46mm; display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 4px; border-radius: 8px; background: var(--ink); color: #fff; padding: 10px 14px; text-align: center; }
.pallet-config span { font-size: 8pt; text-transform: uppercase; letter-spacing: 0.08em; opacity: 0.8; }
.pallet-config strong { font-size: 18pt; }
