/* ── Label print ── */
/* The 4x6 @page rule is injected at print time by printLabels() in tags.js
   so it doesn't hijack the paper size of other print flows (AD list, Ctrl+P). */
@media print {
  * { -webkit-print-color-adjust: exact !important; print-color-adjust: exact !important; }
  body, html { background: white !important; padding: 0 !important; margin: 0 !important; display: block !important; }
  .sidebar { display: none !important; }
  #mobile-nav { display: none !important; }
  #wo-workflow-bar { display: none !important; }
  .main-content { padding: 0 !important; }
  .page { display: none !important; }
  #page-workOrders { display: block !important; }
  #wo-listView { display: none !important; }
  #wo-detailView { display: block !important; }
  .wo-detail-header { display: none !important; }
  .subtab-nav { display: none !important; }
  .wo-tab { display: none !important; }
  #wo-tab-coreTags { display: block !important; }
  h1, .subtitle, .shared-panel, .part-form-card, .snapshot-panel { display: none !important; }
  .parts-container, .part-row, .part-preview-slot { display: block !important; padding: 0 !important; margin: 0 !important; gap: 0 !important; }
  .label { width: 4in !important; height: 6in !important; padding: 0.13in 0.17in 0.11in !important; border: 1.5pt solid #000 !important; box-shadow: none !important; margin: 0 !important; page-break-after: always; break-after: page; }
  .label:last-child { page-break-after: avoid; break-after: avoid; }
  .label-counter { display: none !important; }
  .lf { border-bottom: 1.5px solid #000 !important; }
  .label-header { border-bottom: 2px solid #000 !important; }
  .label-footer { border-top: 2px solid #000 !important; }
  .sig-line { border-bottom: 1.5px solid #000 !important; }
}

/* ── Logbook print ── */
/* Screen-mode hiding (collapses app UI before window.print() fires) */
body.printing-logbook .sidebar,
body.printing-logbook #mobile-nav,
body.printing-logbook .wo-detail-header,
body.printing-logbook #wo-workflow-bar,
body.printing-logbook .subtab-nav,
body.printing-logbook #logbook-form-col,
body.printing-logbook #logbook-preview-col,
body.printing-logbook .btn-primary,
body.printing-logbook .btn-sm,
body.printing-logbook h1,
body.printing-logbook .subtitle {
  display: none !important;
}
body.printing-logbook .main-content { padding: 0 !important; }
body.printing-logbook #logbook-print {
  display: block !important;
}

/* Print rules — override the 4x6 label rules above */
@media print {
  body.printing-logbook #wo-tab-coreTags { display: none !important; }
  body.printing-logbook #wo-tab-logBook  { display: block !important; }
  body.printing-logbook #logbook-form-col,
  body.printing-logbook #logbook-preview-col { display: none !important; }
  /* The `* { print-color-adjust: exact }` at the top of this file forces every
     background to ink, so anything left dark between the page box and the
     document would print as a grey band around it. body/html are whitened by
     the label block above; these are the rest of the chain, pinned explicitly
     rather than relying on them happening to be transparent. */
  body.printing-logbook,
  body.printing-logbook .main-content,
  body.printing-logbook .page,
  body.printing-logbook #wo-detailView,
  body.printing-logbook .wo-tab,
  body.printing-logbook #logbook-root,
  body.printing-logbook .lb-sheet {
    background: #fff !important;
  }
  /* No padding here — each .lb-sheet carries the page margin as its own
     padding, which is also what covers the canvas now that @page margin is 0. */
  body.printing-logbook #logbook-print {
    display: block !important;
    width: 100% !important;
    background: white !important;
    color: #111 !important;
  }
  /* Sheets are already paginated by lbPaginate() — one sheet, one sheet of
     paper. break-inside:avoid keeps the browser from second-guessing a box it
     thinks is a hair too tall and splitting it across two pages. */
  body.printing-logbook .lb-sheet {
    break-inside: avoid !important;
    page-break-inside: avoid !important;
    break-after: page;
    page-break-after: always;
    margin: 0 !important;
    box-shadow: none !important;
  }
  /* Without this the final sheet still asks for a page after it — a blank one. */
  body.printing-logbook .lb-sheet:last-child {
    break-after: avoid;
    page-break-after: avoid;
  }
}
