/* ============================================================
   Primix Print Global — shared @media print rules
   Purpose: include this in any page that uses window.print()
            so the printed output hides UI chrome and prints cleanly.
   Usage:   <link rel="stylesheet" href="/ui/pmx-print-global.css?v=1777571865" media="print">
            (media="print" keeps it out of screen styles — safe to include
             in every page without affecting the in-app experience.)
   Opt-out: add class="print-keep" to any element you WANT to keep in print.
   Force-hide on screen/print: add class="print-hide".
   ============================================================ */

@media print {

  /* ---- @page: A4 portrait, 15mm margins ---- */
  @page {
    size: A4;
    margin: 15mm;
  }

  /* ---- Preserve colors (badges, headers, accents) ---- */
  * {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  /* ---- Reset body chrome ---- */
  html, body {
    margin: 0 !important;
    padding: 0 !important;
    background: #fff !important;
    color: #000 !important;
  }

  /* ---- Hide Primix chrome (sidebar, mobile toggles, overlays, notifications) ---- */
  #pmx-sb,
  #pmx-sb-toggle,
  .pmx-mobile-backdrop,
  .pmx-mobile-menu-toggle,
  .pmx-mobile-toggle,
  .pmx-mobile-bottom-nav,
  .os-ai-panel,
  .os-ai-fab,
  .pmx-notif-host,
  .pmx-notifications-host,
  .pmx-toast-host,
  .pmx-help-fab,
  .pmx-help-panel {
    display: none !important;
  }

  /* ---- Generic app chrome typically excluded from print ---- */
  nav,
  header.topbar,
  .topbar,
  .app-topbar,
  .action-bar,
  .toolbar,
  .breadcrumbs,
  .page-actions,
  .filter-bar,
  .st-tabs,
  .st-actions {
    display: none !important;
  }

  /* ---- All buttons hidden by default; opt-in with .print-keep ---- */
  button,
  .btn,
  a.btn,
  [class*="-btn"]:not(.print-keep),
  [class$="_btn"]:not(.print-keep) {
    display: none !important;
  }
  .print-keep { display: initial !important; }

  /* ---- Explicit opt-out class ---- */
  .print-hide { display: none !important; }

  /* ---- Table print hygiene ---- */
  table { page-break-inside: auto; width: 100%; border-collapse: collapse; }
  tr    { page-break-inside: avoid; break-inside: avoid; }
  thead { display: table-header-group; }
  tfoot { display: table-footer-group; }

  /* ---- Avoid orphan headings ---- */
  h1, h2, h3, h4 {
    page-break-after: avoid;
    break-after: avoid;
  }

  /* ---- Expand content area: undo app-shell offsets ---- */
  body { margin-right: 0 !important; }
  main, .main, .page, .wrap, .container, .content {
    margin: 0 !important;
    padding: 0 !important;
    max-width: 100% !important;
    width: 100% !important;
  }

  /* ---- Neutralize dark themes for print ---- */
  html[data-theme="dark"],
  html[data-theme="dark"] body {
    background: #fff !important;
    color: #000 !important;
  }

  /* ---- Cards: remove heavy shadows, keep borders ---- */
  .card, .pmx-card, .st-card, .inv-card, .qt-card {
    box-shadow: none !important;
    background: #fff !important;
    color: #000 !important;
    border: 1px solid #e5e7eb !important;
    break-inside: avoid;
  }

  /* ---- Links: show URL hint for printed copy (commented out by default) ---- */
  /* a[href]:not(.no-print-url)::after { content: " (" attr(href) ")"; font-size: .85em; color: #555; } */

  /* ---- Images scale cleanly ---- */
  img { max-width: 100% !important; height: auto !important; }
}
