/* AFV CRM print contrast layer.
   The A4 geometry remains untouched; this layer only raises ink contrast for
   invoice and delivery-receipt output so gray metadata and table text remain
   legible on ordinary office printers. */

@media screen, print {
  html body #modal-root .invoice-preview > .invoice-paper:not(.document-attachment-page),
  html body #modal-root .receipt-preview-wrap > .receipt-paper:not(.document-attachment-page) {
    color: #1e2a33 !important;
    forced-color-adjust: none !important;
    print-color-adjust: exact !important;
    -webkit-print-color-adjust: exact !important;
  }

  /* Invoice / proforma: preserve orange accents, but replace low-contrast
     gray text and hairlines with printer-safe values. */
  html body #modal-root .invoice-preview .invoice-paper-content,
  html body #modal-root .invoice-preview .invoice-paper-head,
  html body #modal-root .invoice-preview .invoice-document-title,
  html body #modal-root .invoice-preview .invoice-parties-row,
  html body #modal-root .invoice-preview .invoice-summary-grid {
    color: #1e2a33 !important;
  }

  html body #modal-root .invoice-preview .invoice-document-title span,
  html body #modal-root .invoice-preview .invoice-paper-meta span,
  html body #modal-root .invoice-preview .invoice-party-field > span,
  html body #modal-root .invoice-preview .invoice-paper-table th,
  html body #modal-root .invoice-preview .invoice-total-line > span,
  html body #modal-root .invoice-preview .invoice-paper-notes,
  html body #modal-root .invoice-preview .invoice-summary-notes,
  html body #modal-root .invoice-preview .invoice-payment-summary,
  html body #modal-root .invoice-preview .invoice-payment-summary small {
    color: #4b5a64 !important;
  }

  html body #modal-root .invoice-preview .invoice-party-field > strong,
  html body #modal-root .invoice-preview .invoice-paper-table td,
  html body #modal-root .invoice-preview .invoice-total-line strong,
  html body #modal-root .invoice-preview .invoice-paper-notes strong,
  html body #modal-root .invoice-preview .invoice-payment-summary strong {
    color: #1e2a33 !important;
  }

  html body #modal-root .invoice-preview .invoice-paper-table th,
  html body #modal-root .invoice-preview .invoice-paper-table td,
  html body #modal-root .invoice-preview .invoice-total-line,
  html body #modal-root .invoice-preview .invoice-paper-notes,
  html body #modal-root .invoice-preview .invoice-summary-notes {
    border-color: #aebac1 !important;
  }

  html body #modal-root .invoice-preview .invoice-paper-table th {
    background: #f3f6f7 !important;
  }

  /* Delivery receipt: the same contrast scale applies to both the redesigned
     receipt and the legacy receipt markup used by older records. */
  html body #modal-root .receipt-preview-wrap .receipt-redesigned-content,
  html body #modal-root .receipt-preview-wrap .receipt-paper-head,
  html body #modal-root .receipt-preview-wrap .receipt-meta-grid,
  html body #modal-root .receipt-preview-wrap .receipt-party-grid,
  html body #modal-root .receipt-preview-wrap .receipt-redesign-related,
  html body #modal-root .receipt-preview-wrap .receipt-redesign-parties,
  html body #modal-root .receipt-preview-wrap .receipt-total-strip,
  html body #modal-root .receipt-preview-wrap .receipt-note,
  html body #modal-root .receipt-preview-wrap .receipt-confirmation,
  html body #modal-root .receipt-preview-wrap .receipt-signature-box {
    color: #1e2a33 !important;
  }

  html body #modal-root .receipt-preview-wrap .receipt-meta-grid small,
  html body #modal-root .receipt-preview-wrap .receipt-party-grid small,
  html body #modal-root .receipt-preview-wrap .receipt-redesign-related small,
  html body #modal-root .receipt-preview-wrap .receipt-redesign-parties small,
  html body #modal-root .receipt-preview-wrap .receipt-items-table th,
  html body #modal-root .receipt-preview-wrap .receipt-note,
  html body #modal-root .receipt-preview-wrap .receipt-confirmation,
  html body #modal-root .receipt-preview-wrap .receipt-signature-box > small,
  html body #modal-root .receipt-preview-wrap .receipt-paper-footer {
    color: #4b5a64 !important;
  }

  html body #modal-root .receipt-preview-wrap .receipt-meta-grid strong,
  html body #modal-root .receipt-preview-wrap .receipt-party-grid strong,
  html body #modal-root .receipt-preview-wrap .receipt-redesign-related strong,
  html body #modal-root .receipt-preview-wrap .receipt-redesign-parties strong,
  html body #modal-root .receipt-preview-wrap .receipt-items-table td,
  html body #modal-root .receipt-preview-wrap .receipt-items-table td strong,
  html body #modal-root .receipt-preview-wrap .receipt-note strong,
  html body #modal-root .receipt-preview-wrap .receipt-confirmation strong,
  html body #modal-root .receipt-preview-wrap .receipt-signature-box > strong,
  html body #modal-root .receipt-preview-wrap .receipt-total-strip strong {
    color: #1e2a33 !important;
  }

  html body #modal-root .receipt-preview-wrap .receipt-items-table th,
  html body #modal-root .receipt-preview-wrap .receipt-items-table td,
  html body #modal-root .receipt-preview-wrap .receipt-meta-grid,
  html body #modal-root .receipt-preview-wrap .receipt-confirmation,
  html body #modal-root .receipt-preview-wrap .receipt-signature-box {
    border-color: #aebac1 !important;
  }

  html body #modal-root .receipt-preview-wrap .receipt-items-table th {
    background: #f3f6f7 !important;
  }
}

/* FINAL INVOICE FOOTER PRINT LOCK (2026-09-28).
   This stylesheet is loaded after print-qa-final.css. Keep the same
   centered letterhead raster in the actual print media cascade and disable
   the legacy pseudo-element that painted the old left-shifted footer. */
@media print {
  html body.printing-invoice #modal-root .invoice-preview > .invoice-paper.print-page.has-letterhead:not(.document-attachment-page) {
    background: #fff url("/assets/afv-letterhead-main-centered-20260928.png?v=20260928-invoice-footer-centered-01") center center / 100% 100% no-repeat !important;
    print-color-adjust: exact !important;
    -webkit-print-color-adjust: exact !important;
  }

  html body.printing-invoice #modal-root .invoice-preview > .invoice-paper.print-page.has-letterhead:not(.document-attachment-page)::after {
    display: none !important;
    visibility: hidden !important;
    content: none !important;
    background: none !important;
  }
}

/* FINAL RECEIPT PREVIEW OVERRIDE (2026-09-29). */
@media screen {
  html body #modal-root
    .receipt-preview-wrap > .receipt-paper.receipt-redesigned.has-letterhead:not(.document-attachment-page) {
    padding-left: 19mm !important;
    padding-right: 19mm !important;
    box-sizing: border-box !important;
  }

  html body #modal-root
    .receipt-preview-wrap > .receipt-paper.receipt-redesigned.has-letterhead:not(.document-attachment-page)
    .receipt-redesign-items-section {
    transform: none !important;
  }
}

/* FINAL RECEIPT PREVIEW OVERRIDE (2026-09-29). */
@media screen {
  html body #modal-root
    .receipt-preview-wrap > .receipt-paper.receipt-redesigned.has-letterhead:not(.document-attachment-page) {
    padding-left: 19mm !important;
    padding-right: 19mm !important;
    box-sizing: border-box !important;
  }

  html body #modal-root
    .receipt-preview-wrap > .receipt-paper.receipt-redesigned.has-letterhead:not(.document-attachment-page)
    .receipt-redesign-items-section {
    transform: none !important;
  }
}

/* DELIVERY RECEIPT PREVIEW/PRINT PARITY (2026-09-29).
   Keep the on-screen A4 preview on the same centered safe area as the PDF.
   The old preview used 24mm/14mm asymmetric padding plus a 5mm table
   transform, which made preview and final output disagree. */
@media screen {
  html body #modal-root
    .receipt-preview-wrap > .receipt-paper.receipt-redesigned.has-letterhead:not(.document-attachment-page) {
    padding-left: 19mm !important;
    padding-right: 19mm !important;
    box-sizing: border-box !important;
  }

  html body #modal-root
    .receipt-preview-wrap > .receipt-paper.receipt-redesigned.has-letterhead:not(.document-attachment-page)
    .receipt-redesign-items-section {
    transform: none !important;
  }
}

/* DELIVERY RECEIPT FINAL PRINT GEOMETRY (2026-09-29).
   The receipt print-page cascade historically forced right:24mm / left:14mm.
   That made the table look correct in preview but visibly left-shifted in the
   generated PDF. Equal insets belong on the actual print content box. */
@media print {
  html body.printing-receipt #modal-root
    .receipt-preview-wrap > .receipt-paper.receipt-redesigned.has-letterhead:not(.document-attachment-page)
    > .receipt-redesigned-content,
  html body.printing-receipt #modal-root
    .receipt-preview-wrap > .receipt-paper.print-page.receipt-redesigned.has-letterhead:not(.document-attachment-page)
    > .receipt-redesigned-content {
    position: absolute !important;
    top: 34mm !important;
    right: 19mm !important;
    bottom: 19mm !important;
    left: 19mm !important;
    width: auto !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
    box-sizing: border-box !important;
    transform: none !important;
  }

  html body.printing-receipt #modal-root
    .receipt-preview-wrap > .receipt-paper.receipt-redesigned.has-letterhead:not(.document-attachment-page)
    .receipt-redesign-items-section,
  html body.printing-receipt #modal-root
    .receipt-preview-wrap > .receipt-paper.print-page.receipt-redesigned.has-letterhead:not(.document-attachment-page)
    .receipt-redesign-items-section {
    width: 100% !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    transform: none !important;
    opacity: 1 !important;
    color: #111 !important;
    background: #fff !important;
    border-color: #333 !important;
    print-color-adjust: exact !important;
    -webkit-print-color-adjust: exact !important;
  }

  html body.printing-receipt #modal-root
    .receipt-preview-wrap > .receipt-paper.receipt-redesigned.has-letterhead:not(.document-attachment-page)
    .receipt-redesign-items-section .receipt-redesign-section-title,
  html body.printing-receipt #modal-root
    .receipt-preview-wrap > .receipt-paper.print-page.receipt-redesigned.has-letterhead:not(.document-attachment-page)
    .receipt-redesign-items-section .receipt-redesign-section-title,
  html body.printing-receipt #modal-root
    .receipt-preview-wrap > .receipt-paper.receipt-redesigned.has-letterhead:not(.document-attachment-page)
    .receipt-redesign-items-section .receipt-redesign-items th,
  html body.printing-receipt #modal-root
    .receipt-preview-wrap > .receipt-paper.print-page.receipt-redesigned.has-letterhead:not(.document-attachment-page)
    .receipt-redesign-items-section .receipt-redesign-items th,
  html body.printing-receipt #modal-root
    .receipt-preview-wrap > .receipt-paper.receipt-redesigned.has-letterhead:not(.document-attachment-page)
    .receipt-redesign-items-section .receipt-redesign-items td,
  html body.printing-receipt #modal-root
    .receipt-preview-wrap > .receipt-paper.print-page.receipt-redesigned.has-letterhead:not(.document-attachment-page)
    .receipt-redesign-items-section .receipt-redesign-items td {
    color: #111 !important;
    opacity: 1 !important;
    border-color: #333 !important;
    text-shadow: none !important;
  }
}

/* DELIVERY RECEIPT VISUAL POLISH (2026-09-29).
   A restrained grayscale hierarchy keeps the receipt pleasant on screen and
   remains crisp on a black-and-white printer.  Geometry, content flow and
   the approved A4 footer are intentionally untouched. */
@media screen, print {
  html body #modal-root .receipt-preview-wrap > .receipt-paper.receipt-redesigned.has-letterhead:not(.document-attachment-page) {
    color: #18232c !important;
    border: .35mm solid #cbd5dc !important;
    border-radius: 2mm !important;
  }

  html body #modal-root .receipt-preview-wrap > .receipt-paper.receipt-redesigned.has-letterhead:not(.document-attachment-page) .receipt-redesign-head {
    padding-bottom: 3mm !important;
    border-bottom: .45mm solid #18232c !important;
  }

  html body #modal-root .receipt-preview-wrap > .receipt-paper.receipt-redesigned.has-letterhead:not(.document-attachment-page) .receipt-redesign-title h1 {
    color: #111a20 !important;
    font-size: 24px !important;
    letter-spacing: -.15px !important;
  }

  html body #modal-root .receipt-preview-wrap > .receipt-paper.receipt-redesigned.has-letterhead:not(.document-attachment-page) .receipt-redesign-title span {
    color: #5d6a72 !important;
    font-weight: 700 !important;
  }

  html body #modal-root .receipt-preview-wrap > .receipt-paper.receipt-redesigned.has-letterhead:not(.document-attachment-page) .receipt-redesign-related {
    width: 100% !important;
    justify-content: space-between !important;
    border: 1px solid #cbd5dc !important;
    border-right: 1.1mm solid #18232c !important;
    border-radius: 1.2mm !important;
    background: #f5f7f8 !important;
  }

  html body #modal-root .receipt-preview-wrap > .receipt-paper.receipt-redesigned.has-letterhead:not(.document-attachment-page) .receipt-redesign-related small {
    color: #52616a !important;
    font-weight: 700 !important;
  }

  html body #modal-root .receipt-preview-wrap > .receipt-paper.receipt-redesigned.has-letterhead:not(.document-attachment-page) .receipt-redesign-parties {
    border: 1px solid #cbd5dc !important;
    border-radius: 1.2mm !important;
    background: #f8fafb !important;
  }

  html body #modal-root .receipt-preview-wrap > .receipt-paper.receipt-redesigned.has-letterhead:not(.document-attachment-page) .receipt-redesign-parties > div {
    border-left-color: #cbd5dc !important;
  }

  html body #modal-root .receipt-preview-wrap > .receipt-paper.receipt-redesigned.has-letterhead:not(.document-attachment-page) .receipt-redesign-items-section {
    border: 1px solid #cbd5dc !important;
    border-radius: 1.2mm !important;
    background: #fff !important;
  }

  html body #modal-root .receipt-preview-wrap > .receipt-paper.receipt-redesigned.has-letterhead:not(.document-attachment-page) .receipt-redesign-items-section .receipt-redesign-section-title {
    display: flex !important;
    align-items: center !important;
    gap: 2.5mm !important;
    color: #18232c !important;
    font-size: 13.5px !important;
  }

  html body #modal-root .receipt-preview-wrap > .receipt-paper.receipt-redesigned.has-letterhead:not(.document-attachment-page) .receipt-redesign-items-section .receipt-redesign-section-title::before {
    content: "" !important;
    display: inline-block !important;
    width: 1.2mm !important;
    height: 5mm !important;
    flex: 0 0 1.2mm !important;
    border-radius: 1mm !important;
    background: #18232c !important;
  }

  html body #modal-root .receipt-preview-wrap > .receipt-paper.receipt-redesigned.has-letterhead:not(.document-attachment-page) .receipt-redesign-items th {
    color: #18232c !important;
    background: #eef2f4 !important;
    border-top: 1px solid #aebbc3 !important;
    border-bottom: 1px solid #aebbc3 !important;
  }

  html body #modal-root .receipt-preview-wrap > .receipt-paper.receipt-redesigned.has-letterhead:not(.document-attachment-page) .receipt-redesign-items td {
    color: #27353d !important;
    border-bottom-color: #cbd5dc !important;
  }

  html body #modal-root .receipt-preview-wrap > .receipt-paper.receipt-redesigned.has-letterhead:not(.document-attachment-page) .receipt-redesign-total {
    border: 1px solid #aebbc3 !important;
    border-right: 1.1mm solid #18232c !important;
    border-radius: 1.2mm !important;
    background: #f5f7f8 !important;
  }

  html body #modal-root .receipt-preview-wrap > .receipt-paper.receipt-redesigned.has-letterhead:not(.document-attachment-page) .receipt-redesign-total strong,
  html body #modal-root .receipt-preview-wrap > .receipt-paper.receipt-redesigned.has-letterhead:not(.document-attachment-page) .receipt-redesign-note strong {
    color: #18232c !important;
  }

  html body #modal-root .receipt-preview-wrap > .receipt-paper.receipt-redesigned.has-letterhead:not(.document-attachment-page) .receipt-redesign-note,
  html body #modal-root .receipt-preview-wrap > .receipt-paper.receipt-redesigned.has-letterhead:not(.document-attachment-page) .receipt-redesign-confirmation {
    border-color: #cbd5dc !important;
    border-radius: 1.2mm !important;
    background: #f8fafb !important;
  }

  html body #modal-root .receipt-preview-wrap > .receipt-paper.receipt-redesigned.has-letterhead:not(.document-attachment-page) .receipt-redesign-signature-card {
    padding-top: 2mm !important;
    border-top: .35mm solid #18232c !important;
  }
}

@media screen {
  html body #modal-root .receipt-preview-wrap > .receipt-paper.receipt-redesigned.has-letterhead:not(.document-attachment-page) {
    box-shadow: 0 2mm 8mm rgba(24, 35, 44, .12) !important;
  }
}

/* Keep the visual polish printer-safe: no colored ink or gray fills are
   required for the final receipt PDF. */
@media print {
  html body.printing-receipt #modal-root .receipt-preview-wrap > .receipt-paper.receipt-redesigned.has-letterhead:not(.document-attachment-page) {
    color: #111 !important;
    border-color: #555 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
  }

  html body.printing-receipt #modal-root .receipt-preview-wrap > .receipt-paper.receipt-redesigned.has-letterhead:not(.document-attachment-page) .receipt-redesign-head {
    border-bottom-color: #222 !important;
  }

  html body.printing-receipt #modal-root .receipt-preview-wrap > .receipt-paper.receipt-redesigned.has-letterhead:not(.document-attachment-page) .receipt-redesign-related,
  html body.printing-receipt #modal-root .receipt-preview-wrap > .receipt-paper.receipt-redesigned.has-letterhead:not(.document-attachment-page) .receipt-redesign-parties,
  html body.printing-receipt #modal-root .receipt-preview-wrap > .receipt-paper.receipt-redesigned.has-letterhead:not(.document-attachment-page) .receipt-redesign-items-section,
  html body.printing-receipt #modal-root .receipt-preview-wrap > .receipt-paper.receipt-redesigned.has-letterhead:not(.document-attachment-page) .receipt-redesign-note,
  html body.printing-receipt #modal-root .receipt-preview-wrap > .receipt-paper.receipt-redesigned.has-letterhead:not(.document-attachment-page) .receipt-redesign-confirmation {
    background: #fff !important;
    border-color: #555 !important;
    border-radius: 0 !important;
  }

  html body.printing-receipt #modal-root .receipt-preview-wrap > .receipt-paper.receipt-redesigned.has-letterhead:not(.document-attachment-page) .receipt-redesign-related,
  html body.printing-receipt #modal-root .receipt-preview-wrap > .receipt-paper.receipt-redesigned.has-letterhead:not(.document-attachment-page) .receipt-redesign-total {
    border-right-color: #222 !important;
  }

  html body.printing-receipt #modal-root .receipt-preview-wrap > .receipt-paper.receipt-redesigned.has-letterhead:not(.document-attachment-page) .receipt-redesign-items-section .receipt-redesign-section-title::before {
    background: #222 !important;
  }

  html body.printing-receipt #modal-root .receipt-preview-wrap > .receipt-paper.receipt-redesigned.has-letterhead:not(.document-attachment-page) .receipt-redesign-items th {
    background: #fff !important;
    color: #111 !important;
    border-color: #555 !important;
  }

  html body.printing-receipt #modal-root .receipt-preview-wrap > .receipt-paper.receipt-redesigned.has-letterhead:not(.document-attachment-page) .receipt-redesign-signature-card {
    border-top-color: #222 !important;
  }
}

/* DELIVERY RECEIPT TABLE CENTERING (2026-09-29).
   The shared A4 safe area is intentionally asymmetric for the right-side
   letterhead rule.  Re-center only the delivery table block on the physical
   A4 page; do not move the footer, header or other document families. */
@media screen, print {
  html body #modal-root .receipt-preview-wrap > .receipt-paper.receipt-redesigned.has-letterhead:not(.document-attachment-page) .receipt-redesign-items-section {
    transform: translateX(5mm) !important;
    flex: 0 0 auto !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
  }

  html body #modal-root .receipt-preview-wrap > .receipt-paper.receipt-redesigned.has-letterhead:not(.document-attachment-page) .receipt-redesign-items-section .receipt-redesign-items {
    flex: 0 0 auto !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
  }
}

/* DELIVERY RECEIPT PDF LEGIBILITY LOCK (2026-09-29).
   The supplied PDF showed pale inner table rules and a washed-out table area.
   Strengthen only the receipt print ink; the screen palette stays unchanged. */
@media print {
  html body.printing-receipt #modal-root .receipt-preview-wrap > .receipt-paper.receipt-redesigned.has-letterhead:not(.document-attachment-page) .receipt-redesign-items-section,
  html body.printing-receipt #modal-root .receipt-preview-wrap > .receipt-paper.receipt-redesigned.has-letterhead:not(.document-attachment-page) .receipt-redesign-items,
  html body.printing-receipt #modal-root .receipt-preview-wrap > .receipt-paper.receipt-redesigned.has-letterhead:not(.document-attachment-page) .receipt-redesign-items th,
  html body.printing-receipt #modal-root .receipt-preview-wrap > .receipt-paper.receipt-redesigned.has-letterhead:not(.document-attachment-page) .receipt-redesign-items td {
    border-color: #555 !important;
  }

  html body.printing-receipt #modal-root .receipt-preview-wrap > .receipt-paper.receipt-redesigned.has-letterhead:not(.document-attachment-page) .receipt-redesign-items th,
  html body.printing-receipt #modal-root .receipt-preview-wrap > .receipt-paper.receipt-redesigned.has-letterhead:not(.document-attachment-page) .receipt-redesign-items td,
  html body.printing-receipt #modal-root .receipt-preview-wrap > .receipt-paper.receipt-redesigned.has-letterhead:not(.document-attachment-page) .receipt-redesign-items td small,
  html body.printing-receipt #modal-root .receipt-preview-wrap > .receipt-paper.receipt-redesigned.has-letterhead:not(.document-attachment-page) .receipt-redesign-section-title {
    color: #111 !important;
    opacity: 1 !important;
  }

  html body.printing-receipt #modal-root .receipt-preview-wrap > .receipt-paper.receipt-redesigned.has-letterhead:not(.document-attachment-page) .receipt-redesign-parties,
  html body.printing-receipt #modal-root .receipt-preview-wrap > .receipt-paper.receipt-redesigned.has-letterhead:not(.document-attachment-page) .receipt-redesign-parties > div {
    border-color: #555 !important;
  }
}

/* LAST INVOICE PRINT OVERRIDE (2026-09-28 / PF-0250).
   This stylesheet is loaded after print-qa-final.css, so the two invoice
   print defects are closed here at the final cascade layer. */
@media print {
  @page afv-final-document-a4 { size: A4 portrait; margin: 0; }

  html body.printing-invoice #modal-root,
  html body.printing-invoice #modal-root .modal-backdrop,
  html body.printing-invoice #modal-root .modal-card,
  html body.printing-invoice #modal-root .modal-body,
  html body.printing-invoice #modal-root .invoice-preview {
    margin: 0 !important;
    padding: 0 !important;
    min-height: 0 !important;
    height: auto !important;
    overflow: visible !important;
  }

  html body.printing-invoice #modal-root .invoice-preview > .print-non-page {
    display: none !important;
    visibility: hidden !important;
    width: 0 !important;
    height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
    break-before: auto !important;
    break-after: auto !important;
    page-break-before: auto !important;
    page-break-after: auto !important;
  }

  html body.printing-invoice #modal-root .invoice-preview > .invoice-paper.print-page {
    page: afv-final-document-a4 !important;
    display: block !important;
    position: relative !important;
    width: 210mm !important;
    min-width: 210mm !important;
    max-width: 210mm !important;
    height: 297mm !important;
    min-height: 297mm !important;
    max-height: 297mm !important;
    margin: 0 !important;
    padding: 0 !important;
    box-sizing: border-box !important;
    overflow: hidden !important;
    break-before: auto !important;
    page-break-before: auto !important;
    break-after: auto !important;
    page-break-after: auto !important;
  }

  html body.printing-invoice #modal-root .invoice-preview > .invoice-paper.print-page + .invoice-paper.print-page {
    break-before: page !important;
    page-break-before: always !important;
  }

  html body.printing-invoice #modal-root .invoice-preview > .invoice-paper.print-page.print-page-last {
    break-after: auto !important;
    page-break-after: auto !important;
  }

  html body.printing-invoice #modal-root .invoice-preview > .invoice-paper.print-page.has-letterhead {
    background: #fff url("/assets/afv-letterhead-main-clean-20260920.png?v=20260928-invoice-footer-print-02") center top / 100% 100% no-repeat !important;
    print-color-adjust: exact !important;
    -webkit-print-color-adjust: exact !important;
  }

  html body.printing-invoice #modal-root .invoice-preview > .invoice-paper.print-page.has-letterhead::after {
    content: "" !important;
    display: block !important;
    position: absolute !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100% !important;
    height: 16% !important;
    margin: 0 !important;
    border: 0 !important;
    background: #fff url("/assets/afv-letterhead-main-clean-20260920.png?v=20260928-invoice-footer-print-02") no-repeat !important;
    background-position: calc(50% + 14mm) bottom !important;
    background-size: 100% auto !important;
    print-color-adjust: exact !important;
    -webkit-print-color-adjust: exact !important;
    pointer-events: none !important;
    z-index: 20 !important;
  }

  html body.printing-invoice #modal-root .invoice-preview > .invoice-paper.print-page.has-letterhead > .invoice-footer-artwork,
  html body.printing-invoice #modal-root .invoice-preview > .invoice-paper.print-page.has-letterhead > .official-letterhead-image {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
  }

  html body.printing-invoice #modal-root .invoice-preview > .invoice-paper.print-page .invoice-signature-image {
    display: block !important;
    width: 50mm !important;
    max-width: 50mm !important;
    height: 25mm !important;
    max-height: 25mm !important;
    margin: 0 auto !important;
    object-fit: contain !important;
    object-position: center !important;
    opacity: 1 !important;
    filter: none !important;
    image-rendering: auto !important;
  }
}

@media print {
  /* Do not let the printer/browser suppress the ink colors selected above. */
  html body.printing-invoice #modal-root .invoice-preview > .invoice-paper,
  html body.printing-receipt #modal-root .receipt-preview-wrap > .receipt-paper {
    print-color-adjust: exact !important;
    -webkit-print-color-adjust: exact !important;
  }
}

/*
 * Monochrome printer profile (A4 documents and letters).
 *
 * This is intentionally a print-only ink profile: it does not change document
 * geometry, spacing, page breaks, signatures, or letterhead artwork.  It
 * replaces pale UI grays and colored rules with printer-safe black/gray ink so
 * office laser/thermal printers do not wash out metadata and table borders.
 */
@media print {
  html body #modal-root
    :is(
      .invoice-preview > .invoice-paper,
      .receipt-preview-wrap > .receipt-paper,
      .check-receipt-print-wrap > .check-receipt-paper,
      .quality-preview-wrap > .quality-paper,
      .technical-preview-wrap > .technical-paper,
      .letter-preview-wrap > .letter-paper
    ):not(.document-attachment-page) {
    color: #111 !important;
    color-scheme: light !important;
    forced-color-adjust: none !important;
    print-color-adjust: exact !important;
    -webkit-print-color-adjust: exact !important;
    --ink: #111 !important;
    --text: #111 !important;
    --muted: #333 !important;
    --line: #555 !important;
    --orange: #111 !important;
    --blue: #111 !important;
    --green: #111 !important;
  }

  /* Keep every printed text-bearing node at a readable ink value. */
  html body #modal-root
    :is(
      .invoice-preview > .invoice-paper,
      .receipt-preview-wrap > .receipt-paper,
      .check-receipt-print-wrap > .check-receipt-paper,
      .quality-preview-wrap > .quality-paper,
      .technical-preview-wrap > .technical-paper,
      .letter-preview-wrap > .letter-paper
    ):not(.document-attachment-page)
    :is(h1, h2, h3, h4, h5, h6, strong, b, small, span, p, a, label, li, dt, dd, th, td) {
    color: #111 !important;
    opacity: 1 !important;
  }

  /* Borders remain visible without making the page look like a gray wash. */
  html body #modal-root
    :is(
      .invoice-preview > .invoice-paper,
      .receipt-preview-wrap > .receipt-paper,
      .check-receipt-print-wrap > .check-receipt-paper,
      .quality-preview-wrap > .quality-paper,
      .technical-preview-wrap > .technical-paper,
      .letter-preview-wrap > .letter-paper
    ):not(.document-attachment-page)
    :is(
      .invoice-paper-table,
      .receipt-items-table,
      .check-receipt-table,
      .check-receipt-form-table,
      .quality-meta-grid,
      .quality-paper-section,
      .quality-signature-grid,
      .quality-signature-box,
      .technical-meta-grid,
      .technical-paper-section,
      .technical-signature-grid,
      .technical-signature-box,
      .check-receipt-meta,
      .check-receipt-party,
      .check-receipt-signatures,
      .check-receipt-signature-box,
      .letter-attachment-detail
    ) {
    border-color: #555 !important;
  }

  html body #modal-root
    :is(
      .invoice-preview > .invoice-paper,
      .receipt-preview-wrap > .receipt-paper,
      .check-receipt-print-wrap > .check-receipt-paper,
      .quality-preview-wrap > .quality-paper,
      .technical-preview-wrap > .technical-paper,
      .letter-preview-wrap > .letter-paper
    ):not(.document-attachment-page)
    :is(
      .invoice-paper-table th,
      .receipt-items-table th,
      .check-receipt-table th,
      .check-receipt-form-table th,
      .invoice-summary-grid,
      .receipt-total-strip,
      .check-receipt-total,
      .technical-result-strip
    ) {
    background-color: #fff !important;
    border-color: #555 !important;
  }

  /* Colored separator rules are rendered as solid black ink. */
  html body #modal-root
    :is(
      .invoice-preview > .invoice-paper,
      .receipt-preview-wrap > .receipt-paper,
      .check-receipt-print-wrap > .check-receipt-paper,
      .quality-preview-wrap > .quality-paper,
      .technical-preview-wrap > .technical-paper,
      .letter-preview-wrap > .letter-paper
    ):not(.document-attachment-page)
    :is(
      .invoice-paper-head,
      .receipt-paper-head,
      .check-receipt-paper-head,
      .quality-paper-head,
      .technical-paper-head,
      .invoice-paper-footer,
      .receipt-paper-footer,
      .check-receipt-footer,
      .quality-paper-footer,
      .technical-paper-footer,
      .official-footer,
      .quality-official-footer,
      .technical-official-footer
    ) {
    border-color: #222 !important;
  }

  /* Do not let preview-only shadows or transparent text reduce print contrast. */
  html body #modal-root
    :is(
      .invoice-preview > .invoice-paper,
      .receipt-preview-wrap > .receipt-paper,
      .check-receipt-print-wrap > .check-receipt-paper,
      .quality-preview-wrap > .quality-paper,
      .technical-preview-wrap > .technical-paper,
      .letter-preview-wrap > .letter-paper
    ):not(.document-attachment-page) {
    box-shadow: none !important;
    text-shadow: none !important;
}

/* Shipping labels are printed through a separate print root. */
@media print {
  html body.printing-shipping-label #shipping-label-print-root
    :is(.shipping-label, .shipping-label-standard) {
    color: #111 !important;
    color-scheme: light !important;
    forced-color-adjust: none !important;
    print-color-adjust: exact !important;
    -webkit-print-color-adjust: exact !important;
    --ink: #111 !important;
    --muted: #333 !important;
    --line: #222 !important;
    --orange: #111 !important;
  }

  html body.printing-shipping-label #shipping-label-print-root
    :is(.shipping-label, .shipping-label-standard)
    :is(h1, h2, h3, h4, strong, b, small, span, p, a, label, li) {
    color: #111 !important;
    opacity: 1 !important;
  }

  html body.printing-shipping-label #shipping-label-print-root
    :is(.shipping-label, .shipping-label-standard)
    :is(
      .shipping-label-standard-rule,
      .shipping-label-standard-data,
      .shipping-label-standard-content,
      .shipping-label-standard-foot,
      .shipping-label-standard-identity,
      .shipping-label-recipient,
      .shipping-label-meta,
      .shipping-label-carton,
      .shipping-label-items,
      .shipping-label-notes
    ) {
    border-color: #222 !important;
    background-color: #fff !important;
  }

  html body.printing-shipping-label #shipping-label-print-root
    :is(.shipping-label, .shipping-label-standard) {
    box-shadow: none !important;
    text-shadow: none !important;
  }
}

/* DELIVERY RECEIPT PRINT PARITY (2026-09-29).
   The receipt preview already uses the centered reference artwork, but the
   browser print cascade was falling back to the older asymmetric raster.
   Keep this print-only so the approved preview remains unchanged. */
@media print {
  html body.printing-receipt #modal-root .receipt-preview-wrap > .receipt-paper.has-letterhead:not(.document-attachment-page) {
    background: #fff url("/assets/afv-letterhead-main-centered-20260928.png?v=20260929-receipt-footer-centered-01") center center / 100% 100% no-repeat !important;
    background-color: #fff !important;
    background-position: center center !important;
    background-size: 100% 100% !important;
    print-color-adjust: exact !important;
    -webkit-print-color-adjust: exact !important;
  }

  html body.printing-receipt #modal-root .receipt-preview-wrap > .receipt-paper.has-letterhead:not(.document-attachment-page) > .official-letterhead-image,
  html body.printing-receipt #modal-root .receipt-preview-wrap > .receipt-paper.has-letterhead:not(.document-attachment-page) > .receipt-footer-artwork,
  html body.printing-receipt #modal-root .receipt-preview-wrap > .receipt-paper.has-letterhead:not(.document-attachment-page) > .invoice-footer-artwork {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
  }

  /* The print-only 8pt lock made the receipt hard to read on paper. */
  html body.printing-receipt #modal-root .receipt-preview-wrap > .receipt-paper:not(.document-attachment-page) .receipt-items-table th,
  html body.printing-receipt #modal-root .receipt-preview-wrap > .receipt-paper:not(.document-attachment-page) .receipt-items-table td {
    font-size: 9.5pt !important;
    line-height: 1.45 !important;
  }

  html body.printing-receipt #modal-root .receipt-preview-wrap > .receipt-paper:not(.document-attachment-page) .receipt-items-table td small,
  html body.printing-receipt #modal-root .receipt-preview-wrap > .receipt-paper:not(.document-attachment-page) .receipt-meta-grid small,
  html body.printing-receipt #modal-root .receipt-preview-wrap > .receipt-paper:not(.document-attachment-page) .receipt-party-grid small,
  html body.printing-receipt #modal-root .receipt-preview-wrap > .receipt-paper:not(.document-attachment-page) .receipt-redesign-related small,
  html body.printing-receipt #modal-root .receipt-preview-wrap > .receipt-paper:not(.document-attachment-page) .receipt-redesign-parties small {
    font-size: 8.5pt !important;
    line-height: 1.4 !important;
  }

  html body.printing-receipt #modal-root .receipt-preview-wrap > .receipt-paper:not(.document-attachment-page) .receipt-meta-grid strong,
  html body.printing-receipt #modal-root .receipt-preview-wrap > .receipt-paper:not(.document-attachment-page) .receipt-party-grid strong,
  html body.printing-receipt #modal-root .receipt-preview-wrap > .receipt-paper:not(.document-attachment-page) .receipt-redesign-related strong,
  html body.printing-receipt #modal-root .receipt-preview-wrap > .receipt-paper:not(.document-attachment-page) .receipt-redesign-parties strong,
  html body.printing-receipt #modal-root .receipt-preview-wrap > .receipt-paper:not(.document-attachment-page) .receipt-total-strip,
  html body.printing-receipt #modal-root .receipt-preview-wrap > .receipt-paper:not(.document-attachment-page) .receipt-note,
  html body.printing-receipt #modal-root .receipt-preview-wrap > .receipt-paper:not(.document-attachment-page) .receipt-confirmation,
  html body.printing-receipt #modal-root .receipt-preview-wrap > .receipt-paper:not(.document-attachment-page) .receipt-signature-box {
    font-size: 9.5pt !important;
    line-height: 1.55 !important;
  }

  html body.printing-receipt #modal-root .receipt-preview-wrap > .receipt-paper:not(.document-attachment-page) .receipt-total-strip strong,
  html body.printing-receipt #modal-root .receipt-preview-wrap > .receipt-paper:not(.document-attachment-page) .receipt-note strong,
  html body.printing-receipt #modal-root .receipt-preview-wrap > .receipt-paper:not(.document-attachment-page) .receipt-confirmation strong,
  html body.printing-receipt #modal-root .receipt-preview-wrap > .receipt-paper:not(.document-attachment-page) .receipt-signature-box > strong {
    font-size: 10.5pt !important;
  }
}
}

/* FINAL RECEIPT PREVIEW OVERRIDE (2026-09-29). */
@media screen {
  html body #modal-root
    .receipt-preview-wrap > .receipt-paper.receipt-redesigned.has-letterhead:not(.document-attachment-page) {
    padding-left: 19mm !important;
    padding-right: 19mm !important;
    box-sizing: border-box !important;
  }

  html body #modal-root
    .receipt-preview-wrap > .receipt-paper.receipt-redesigned.has-letterhead:not(.document-attachment-page)
    .receipt-redesign-items-section {
    transform: none !important;
  }
}

/* ABSOLUTE LAST INVOICE PRINT FOOTER LOCK (2026-09-28).
   Keep this at EOF because this file is the last print stylesheet loaded. */
@media print {
  html body.printing-invoice #modal-root .invoice-preview > .invoice-paper.print-page.has-letterhead:not(.document-attachment-page) {
    background: #fff url("/assets/afv-letterhead-main-centered-20260928.png?v=20260928-invoice-footer-centered-01") center center / 100% 100% no-repeat !important;
    print-color-adjust: exact !important;
    -webkit-print-color-adjust: exact !important;
  }

  html body.printing-invoice #modal-root .invoice-preview > .invoice-paper.print-page.has-letterhead:not(.document-attachment-page)::after {
    display: none !important;
    visibility: hidden !important;
    content: none !important;
    background: none !important;
  }
}
/* Word-only controls must never become a physical PDF page before the document. */
@media print {
  html body #modal-root .word-export-controls {
    display: none !important;
    visibility: hidden !important;
    width: 0 !important;
    height: 0 !important;
    min-height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
  }
}
