/* Commerce-only print layout. The shared invoice stylesheet hides page content;
   the commerce report is restored here without leaving invisible page elements
   in the print flow (which previously produced an extra blank sheet). */
@media print {
  @page { size: A4; margin: 13mm; }
  html:has([data-pro-tool="commerce"]),
  body:has([data-pro-tool="commerce"]),
  body:has([data-pro-tool="commerce"]) #app,
  body:has([data-pro-tool="commerce"]) main {
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    overflow: visible !important;
  }
  body:has([data-pro-tool="commerce"]) main {
    display: block !important;
    margin: 0 !important;
    padding: 0 !important;
    max-width: none !important;
  }
  /* visibility:hidden alone preserves layout and can force a blank last page. */
  body:has([data-pro-tool="commerce"]) main > :not(.pro-workspace),
  body:has([data-pro-tool="commerce"]) .pro-workspace > :not([data-pro-tool="commerce"]),
  body:has([data-pro-tool="commerce"]) [data-pro-tool="commerce"] > :not(.lab-heading):not(.lab-report) {
    display: none !important;
  }
  body:has([data-pro-tool="commerce"]) main,
  body:has([data-pro-tool="commerce"]) .pro-workspace,
  body:has([data-pro-tool="commerce"]) [data-pro-tool="commerce"],
  body:has([data-pro-tool="commerce"]) .lab-heading,
  body:has([data-pro-tool="commerce"]) .lab-report,
  body:has([data-pro-tool="commerce"]) .lab-report * {
    visibility: visible !important;
  }
  body:has([data-pro-tool="commerce"]) .pro-workspace,
  body:has([data-pro-tool="commerce"]) [data-pro-tool="commerce"],
  body:has([data-pro-tool="commerce"]) .lab-report {
    display: block !important;
    position: static !important;
    width: auto !important;
    max-width: none !important;
    height: auto !important;
    min-height: 0 !important;
    overflow: visible !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    box-shadow: none !important;
  }
  body:has([data-pro-tool="commerce"]) .lab-heading { margin: 0 0 12px !important; }
  body:has([data-pro-tool="commerce"]) .lab-section {
    display: block !important;
    overflow: visible !important;
    break-inside: auto !important;
    page-break-inside: auto !important;
    margin: 12px 0 18px !important;
  }
  body:has([data-pro-tool="commerce"]) .lab-section h3,
  body:has([data-pro-tool="commerce"]) .lab-table thead,
  body:has([data-pro-tool="commerce"]) .lab-table tr {
    break-inside: avoid;
    page-break-inside: avoid;
  }
  body:has([data-pro-tool="commerce"]) .lab-table {
    display: table !important;
    width: 100% !important;
    min-width: 0 !important;
    table-layout: fixed;
    border-collapse: collapse;
  }
  body:has([data-pro-tool="commerce"]) .lab-table th,
  body:has([data-pro-tool="commerce"]) .lab-table td {
    font-size: 9px !important;
    padding: 5px !important;
    word-break: break-word;
  }
  body:has([data-pro-tool="commerce"]) .lab-table thead { display: table-header-group !important; }
  body:has([data-pro-tool="commerce"]) .lab-table tbody { display: table-row-group !important; }
  body:has([data-pro-tool="commerce"]) .lab-table tr { display: table-row !important; }
  body:has([data-pro-tool="commerce"]) .lab-table th,
  body:has([data-pro-tool="commerce"]) .lab-table td { display: table-cell !important; }
}
