/* ==========================================================================
   Priostack Apps design system - print.css
   Load on every page after components.css:
     <link rel="stylesheet" href=".../print.css" media="print">
   Everything is wrapped in @media print, so it is also safe without the
   media attribute. Printing is always light (dark tokens are screen-only).

   - Any page: the app chrome (header, footer, breadcrumb, actions, related
     apps, toast) is left out; the tool card loses its shadow.
   - A page holding a .ps-doc (invoice, quote): only the document prints, on
     A4, with repeated table heads and no row split across pages. Browsers
     without :has() print the page with the chrome hidden.
   ========================================================================== */

@media print {
  @page {
    size: A4;
    margin: 14mm 14mm 16mm;
  }

  .ps-header,
  .ps-footer,
  .ps-breadcrumb,
  .ps-actions,
  .ps-related,
  .ps-app-layout__side,
  .ps-category-nav,
  .ps-featured,
  .ps-toast,
  .ps-skip,
  .ps-tabs,
  .ps-rows__foot,
  .ps-rows__cell--action,
  .ps-no-print {
    display: none !important;
  }

  .ps-print-only {
    display: block !important;
  }

  .ps-main {
    padding: 0;
  }

  .ps-app-layout,
  .ps-hub-layout {
    display: block;
  }

  .ps-container {
    max-width: none;
    padding-inline: 0;
  }

  .ps-tool {
    border-color: var(--ps-line);
    box-shadow: none;
    break-inside: avoid;
  }

  .ps-tool__output {
    position: static;
  }

  /* A page with a document prints the document alone. */
  body:has(.ps-doc) :not(.ps-doc, .ps-doc *, :has(.ps-doc)) {
    display: none !important;
  }

  body:has(.ps-doc) :has(.ps-doc) {
    display: block !important;
    position: static !important;
    width: auto !important;
    max-width: none !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    background: none !important;
    box-shadow: none !important;
    container-type: normal !important;
  }

  .ps-doc {
    max-width: none;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    font-size: 10pt;
    box-shadow: none;
  }

  .ps-doc__title {
    font-size: 18pt;
  }

  .ps-doc__name,
  .ps-doc__totals .ps-doc__total {
    font-size: 11pt;
  }

  .ps-doc__lines-wrap {
    overflow: visible;
  }

  .ps-doc__lines thead {
    display: table-header-group;
  }

  .ps-doc__lines tr,
  .ps-doc__head,
  .ps-doc__parties,
  .ps-doc__party,
  .ps-doc__totals,
  .ps-doc__mentions {
    break-inside: avoid;
  }

  .ps-doc a {
    color: inherit;
    text-decoration: none;
  }
}
