#warehouse-print-page { display: none; }

.warehouse-invoice-entry {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
}
.warehouse-invoice-entry .warehouse-invoice-link { min-width: 0; }
.warehouse-invoice-entry .warehouse-invoice-link strong { overflow-wrap: anywhere; }
.warehouse-invoice-print-button {
  display: inline-grid;
  place-items: center;
  width: 34px;
  min-height: 34px;
  padding: 0;
}
.warehouse-invoice-print-button :is(.warehouse-symbol, .nav-icon),
#warehouse-invoice-print :is(.warehouse-symbol, .nav-icon) { width: 16px; height: 16px; }
#warehouse-invoice-print { display: inline-flex; align-items: center; gap: 8px; }
.warehouse-invoice-entry button[aria-busy=true] :is(.warehouse-symbol, .nav-icon),
#warehouse-invoice-print[aria-busy=true] :is(.warehouse-symbol, .nav-icon) { animation: warehouse-print-progress 1.1s ease-in-out infinite alternate; }
@keyframes warehouse-print-progress { to { opacity: .35; } }
@media (prefers-reduced-motion: reduce) {
  .warehouse-invoice-entry button[aria-busy=true] :is(.warehouse-symbol, .nav-icon),
  #warehouse-invoice-print[aria-busy=true] :is(.warehouse-symbol, .nav-icon) { animation: none; }
}
.warehouse-invoice-print-feedback { grid-column: 1 / -1; margin: 0 0 5px; color: var(--danger); font-size: 12px; }

@page techops-document { size: A4; margin: 15mm; }
@page techops-scan { size: A4; margin: 7mm; }
@page techops-scan-landscape { size: A4 landscape; margin: 7mm; }

@media print {
  html:has(body.warehouse-printing) { color-scheme: light; background: white; }
  body.warehouse-printing {
    margin: 0;
    color-scheme: light;
    background: white;
    color: #1d2938;
  }
  body.warehouse-printing > :not(#warehouse-print-page) { display: none !important; }
  body.warehouse-printing #warehouse-print-page {
    display: block;
    --line: #ccd5df;
    --muted: #4f5e70;
    --ink: #1d2938;
    --primary: #1d2938;
    --secondary-ink: #304155;
  }
  body.warehouse-printing dialog::backdrop { display: none; }
  .warehouse-printing .warehouse-protocol { padding: 0; border: 0; background: transparent; box-shadow: none; }
  .warehouse-printing .offboard-paper { page: techops-document; }
  .warehouse-printing .warehouse-protocol :is(header, tr, li) { break-inside: avoid; }
  .warehouse-printing .warehouse-protocol li { padding-block: 3px; }
  .warehouse-printing :is(.warehouse-protocol, .warehouse-print-tag) * {
    color: #1d2938 !important;
    background: transparent !important;
    box-shadow: none !important;
  }

  .warehouse-print-sheet {
    page: techops-document;
    color: #1d2938;
    font: 10pt/1.42 "Segoe UI", system-ui, sans-serif;
    overflow-wrap: anywhere;
  }
  .warehouse-print-heading {
    margin: 0 0 6mm;
    padding-bottom: 4mm;
    border-bottom: 1.4pt solid #253d58;
    break-inside: avoid;
  }
  .warehouse-print-brand {
    display: flex;
    align-items: center;
    gap: 2.5mm;
    margin-bottom: 4.5mm;
    color: #253d58;
    font-size: 10pt;
    font-weight: 650;
  }
  .warehouse-print-brand img { object-fit: contain; }
  .warehouse-print-title { display: flex; align-items: baseline; justify-content: space-between; gap: 4mm; }
  .warehouse-print-title h1 { margin: 0; color: #182e47; font-size: 23pt; font-weight: 680; line-height: 1.12; }
  .warehouse-print-reference { color: #364c64; font-size: 10pt; font-weight: 600; white-space: nowrap; }
  .warehouse-print-sheet :is(h2, h3, h4) {
    margin: 5mm 0 2.3mm;
    color: #253d58;
    font-size: 11pt;
    font-weight: 650;
    break-after: avoid;
  }
  .warehouse-print-sheet p { margin: 2mm 0; }
  .warehouse-print-facts {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin: 0 0 5mm;
    gap: 2.5mm 6mm;
  }
  .warehouse-print-facts > div { min-width: 0; break-inside: avoid; }
  .warehouse-print-facts dt,
  .warehouse-print-sheet .warehouse-paper-table th { color: #465b73; font-size: 8.5pt; font-weight: 600; }
  .warehouse-print-facts dd { margin: 0.6mm 0 0; color: #192a3c; white-space: pre-wrap; }
  .warehouse-print-sheet .warehouse-paper-table thead { display: table-header-group; }
  .warehouse-print-sheet .warehouse-paper-table :is(th, td) {
    padding: 2.6mm 2.8mm;
    border-bottom: 0.65pt solid #d2dbe5;
    vertical-align: top;
  }
  .warehouse-print-sheet .warehouse-paper-table thead th { border-block: 0.9pt solid #91a4b9; }
  .warehouse-print-sheet .warehouse-paper-table td span { font-size: 8.3pt; color: #4c5f73; }
  .warehouse-printing .warehouse-paper-table :is(tr, td, th) { break-inside: avoid; }
  .warehouse-print-sheet .warehouse-paper-table :is(th, td):nth-child(n + 2) { width: 29mm; text-align: right; }
  .warehouse-print-sheet .warehouse-paper-table.warehouse-offboard-table :is(th, td):nth-child(n + 2) { width: 26mm; }
  .warehouse-print-sheet .disposal-table { width: 100%; table-layout: fixed; }
  .warehouse-print-sheet .disposal-table :is(th, td):nth-child(2) { width: 16mm; }
  .warehouse-print-sheet .disposal-table :is(th, td):nth-child(3) { width: 41%; text-align: left; }
  .warehouse-print-sheet .warehouse-paper-table.warehouse-print-history :is(th, td) { width: auto; text-align: left; }
  .warehouse-print-sheet .warehouse-print-history :is(th, td):first-child { width: 28mm; }
  .warehouse-print-sheet .warehouse-print-history :is(th, td):last-child { width: 47mm; }
  .warehouse-print-sheet .warehouse-event-reason { border: 0; padding: 0; white-space: pre-wrap; }
  .warehouse-print-sheet .offboard-station { border: 0; border-bottom: 0.65pt solid #d2dbe5; padding: 2mm 0; }
  .warehouse-print-sheet .offboard-remarks { padding: 0; background: transparent; white-space: pre-wrap; }
  .warehouse-print-section { border-top: 0.65pt solid #d2dbe5; padding-top: 0.3mm; break-inside: avoid; }
  .warehouse-print-sheet .warehouse-print-section h3 { margin: 3.1mm 0 1.7mm; }
  .warehouse-print-section .warehouse-print-facts { margin-bottom: 3mm; gap: 1.8mm 6mm; }
  .warehouse-print-product {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 6mm;
    margin-bottom: 5mm;
    break-inside: avoid;
  }
  .warehouse-print-product > div { flex: 1; min-width: 0; }
  .warehouse-print-product .warehouse-print-facts { margin: 2.6mm 0 0; grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .warehouse-print-product h2 { margin-top: 0; font-size: 17pt; }
  .warehouse-print-product img { width: 43mm; max-height: 35mm; object-fit: contain; object-position: right top; }
  .warehouse-signatures { display: flex; gap: 13mm; margin-top: 15mm; break-inside: avoid; }
  .warehouse-signatures span { flex: 1; padding: 2mm; border-top: 0.75pt solid #66798f; text-align: center; }

  .warehouse-scan-print-page {
    page: techops-scan;
    --scan-height: 271mm;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    width: 100%;
    break-inside: avoid;
  }
  .warehouse-scan-print-page + .warehouse-scan-print-page { break-before: page; }
  .warehouse-scan-print-page[data-landscape] { page: techops-scan-landscape; --scan-height: 184mm; }
  .warehouse-scan-print-page :is(canvas, img) {
    display: block;
    width: auto;
    height: auto;
    min-width: 0;
    max-width: 100%;
    max-height: var(--scan-height);
    object-fit: contain;
  }

  .warehouse-print-tag { display: grid; gap: 2px; width: 62mm; min-height: 30mm; padding: 3mm; border: 1px solid; overflow-wrap: anywhere; }
  .warehouse-print-tag strong { font: 600 14pt monospace; }
  .warehouse-print-qr { grid-template-columns: 30mm minmax(0, 1fr); align-items: center; gap: 2mm; break-inside: avoid; }
  .warehouse-print-qr canvas { display: block; width: 30mm; height: 30mm; image-rendering: pixelated; }
  .warehouse-print-qr p { margin: 1mm 0; font-size: 7.5pt; }
  .warehouse-print-qr strong { font: 600 9pt system-ui; }
}
