/* Final print geometry repair — 2026-10-07
   This file is intentionally loaded last and uses higher specificity than
   the desktop/mobile runtime shell rules. */

@media print{
  @page{
    margin:10mm;
  }

  html,
  html body,
  html body #app{
    width:100%!important;
    max-width:none!important;
    min-width:0!important;
    margin:0!important;
    padding:0!important;
    overflow:visible!important;
    background:#fff!important;
  }

  /* Remove the complete application chrome, including rules injected at runtime. */
  html body #app .app-shell > #sidebar.sidebar,
  html body #app .clean-shell > #sidebar.sidebar,
  html body #app #sidebar.sidebar,
  html body #sidebar.sidebar,
  html body #sidebarScrim.sidebar-scrim,
  html body .sidebar-scrim,
  html body #nwEmergencyDrawer,
  html body #nwEmergencyScrim,
  html body #app .app-shell > main > header.company-header.reference-header,
  html body #app .app-shell > main > header.mobile-reference-header.reference-header,
  html body #app .clean-shell > main > header.company-header.reference-header,
  html body #app header.company-header,
  html body #app header.reference-header,
  html body #app .mobile-reference-header,
  html body #app .reference-actions,
  html body #app #topPrimaryMenu.top-primary-menu.grouped-top-menu,
  html body #app #topPrimaryMenu,
  html body #app .top-primary-menu,
  html body #app .grouped-top-menu,
  html body #app .top-group-nav,
  html body #app #bottomQuick.bottom-quick,
  html body #app #bottomQuick,
  html body #app .bottom-quick,
  html body #app .reference-bottom-nav,
  html body #app .mobile-bottom-nav,
  html body #app .bottom-nav,
  html body #app .quick-bottom-nav,
  html body #app .mobile-quick-nav,
  html body #app .bottom-menu,
  html body #app .app-bottom-nav,
  html body #app .nav-bottom,
  html body #app .mobile-nav,
  html body #app .floating-nav,
  html body #app .side-brand,
  html body #app .centered-brand,
  html body #app .pc-version-badge,
  html body #app .line-eng-mobile-mark{
    display:none!important;
    visibility:hidden!important;
    opacity:0!important;
    width:0!important;
    height:0!important;
    min-width:0!important;
    min-height:0!important;
    max-width:0!important;
    max-height:0!important;
    margin:0!important;
    padding:0!important;
    border:0!important;
    box-shadow:none!important;
    overflow:hidden!important;
    position:static!important;
    transform:none!important;
  }

  /* Screen interaction controls never print. */
  html body #app button,
  html body #app input[type="button"],
  html body #app input[type="submit"],
  html body #app input[type="reset"],
  html body #app .btn,
  html body #app .actions,
  html body #app .quick-actions,
  html body #app .toolbar,
  html body #app .page-title .row-wrap,
  html body #app .no-print,
  html body #app .screen-only,
  html body #app .external-compact-actions,
  html body #app .manage-cell,
  html body #app .manage-head,
  html body #app .sidebar-toggle,
  html body #app #hamb,
  html body #app #headerRoleCard{
    display:none!important;
    visibility:hidden!important;
  }

  /* Only one common company letterhead appears at the top. */
  html body #app .global-print-brand{
    display:flex!important;
    visibility:visible!important;
    opacity:1!important;
    position:static!important;
    float:none!important;
    clear:both!important;
    box-sizing:border-box!important;
    width:100%!important;
    max-width:100%!important;
    min-width:0!important;
    height:auto!important;
    min-height:19mm!important;
    max-height:none!important;
    margin:0 0 6mm!important;
    padding:0 0 4mm!important;
    border:0!important;
    border-bottom:1px solid #cfd8e3!important;
    border-radius:0!important;
    box-shadow:none!important;
    transform:none!important;
    align-items:center!important;
    justify-content:center!important;
    gap:4mm!important;
    background:#fff!important;
    break-inside:avoid!important;
    page-break-inside:avoid!important;
    -webkit-print-color-adjust:exact!important;
    print-color-adjust:exact!important;
  }

  html body #app .global-print-brand img{
    display:block!important;
    visibility:visible!important;
    opacity:1!important;
    position:static!important;
    width:15mm!important;
    height:15mm!important;
    min-width:15mm!important;
    min-height:15mm!important;
    max-width:15mm!important;
    max-height:15mm!important;
    margin:0!important;
    padding:0!important;
    border:0!important;
    border-radius:4mm!important;
    object-fit:cover!important;
    transform:none!important;
  }

  html body #app .global-print-brand b{
    display:block!important;
    visibility:visible!important;
    opacity:1!important;
    width:auto!important;
    height:auto!important;
    min-width:0!important;
    max-width:none!important;
    margin:0!important;
    padding:0!important;
    color:#10233f!important;
    font-size:18pt!important;
    font-weight:900!important;
    line-height:1.1!important;
    letter-spacing:-.04em!important;
    white-space:nowrap!important;
  }

  /* Old/special duplicate app letterheads are suppressed.
     The document's own title/summary remains intact. */
  html body #app .external-print-document-header,
  html body #app .external-print-current-brand,
  html body #app .external-print-logo,
  html body #app .external-print-brand-copy,
  html body #app .external-print-date{
    display:none!important;
    visibility:hidden!important;
  }

  /* Collapse the screen shell to one full A4 content column. */
  html body #app > .app-shell,
  html body #app > .app-shell.clean-shell,
  html body #app .app-shell,
  html body #app .clean-shell,
  html body #app .reference-dashboard-shell{
    display:block!important;
    position:static!important;
    box-sizing:border-box!important;
    width:100%!important;
    max-width:100%!important;
    min-width:0!important;
    height:auto!important;
    min-height:0!important;
    margin:0!important;
    padding:0!important;
    inset:auto!important;
    left:auto!important;
    right:auto!important;
    top:auto!important;
    bottom:auto!important;
    transform:none!important;
    overflow:visible!important;
    grid-template-columns:none!important;
  }

  html body #app .app-shell > main,
  html body #app .clean-shell > main,
  html body #app .reference-dashboard-shell > main,
  html body #app main{
    display:block!important;
    position:static!important;
    box-sizing:border-box!important;
    float:none!important;
    width:100%!important;
    max-width:100%!important;
    min-width:0!important;
    height:auto!important;
    min-height:0!important;
    margin:0!important;
    margin-left:0!important;
    margin-right:0!important;
    padding:0!important;
    inset:auto!important;
    left:auto!important;
    right:auto!important;
    top:auto!important;
    bottom:auto!important;
    transform:none!important;
    overflow:visible!important;
    grid-column:auto!important;
  }

  html body #app #content,
  html body #app main #content{
    display:block!important;
    position:static!important;
    box-sizing:border-box!important;
    float:none!important;
    width:100%!important;
    max-width:100%!important;
    min-width:0!important;
    height:auto!important;
    margin:0!important;
    padding:0!important;
    inset:auto!important;
    transform:none!important;
    overflow:visible!important;
  }

  /* Remove screen-only card framing while keeping document grouping. */
  html body #app #content .card,
  html body #app #content .panel,
  html body #app #content .settings-section{
    max-width:100%!important;
    box-sizing:border-box!important;
    box-shadow:none!important;
    break-inside:auto!important;
    page-break-inside:auto!important;
  }

  /* Tables must fit the printable width, not retain their screen min-widths. */
  html body #app #content .table-wrap,
  html body #app #content .external-no-scroll,
  html body #app #content .settlement-sheet-table-wrap,
  html body #app #content .settlement-sheet-summary-wrap,
  html body #app #content [class*="scroll"],
  html body #app #content [class*="Scroll"]{
    display:block!important;
    box-sizing:border-box!important;
    width:100%!important;
    max-width:100%!important;
    min-width:0!important;
    height:auto!important;
    max-height:none!important;
    margin-left:0!important;
    margin-right:0!important;
    overflow:visible!important;
    scrollbar-width:none!important;
  }

  html body #app #content .table-wrap::-webkit-scrollbar,
  html body #app #content [class*="scroll"]::-webkit-scrollbar,
  html body #app #content [class*="Scroll"]::-webkit-scrollbar,
  html body::-webkit-scrollbar{
    display:none!important;
    width:0!important;
    height:0!important;
  }

  html body #app #content table,
  html body #app #content .table,
  html body #app #content table.nw-responsive-table,
  html body #app #content .cash-table,
  html body #app #content .stats-clean-year-table,
  html body #app #content .sales-purchase-table,
  html body #app #content .sales-reconcile-table,
  html body #app #content .trade-outstanding-table,
  html body #app #content .external-company-compact,
  html body #app #content .external-invoice-expense-table,
  html body #app #content .external-invoice-due-table,
  html body #app #content .external-direct-compact,
  html body #app #content .external-worker-compact{
    box-sizing:border-box!important;
    width:100%!important;
    max-width:100%!important;
    min-width:0!important;
    margin-left:0!important;
    margin-right:0!important;
    table-layout:fixed!important;
  }

  html body #app #content thead th{
    position:static!important;
  }

  html body #app #content tr{
    break-inside:avoid!important;
    page-break-inside:avoid!important;
  }

  html body #app #content th,
  html body #app #content td{
    overflow-wrap:anywhere!important;
    word-break:keep-all!important;
    white-space:normal!important;
  }

  /* Keep money compact without forcing the whole table wider than A4. */
  html body #app #content td.num,
  html body #app #content th.num{
    white-space:normal!important;
    font-variant-numeric:tabular-nums!important;
  }

  /* Print should start immediately below the one company header. */
  html body #app #content > :first-child{
    margin-top:0!important;
  }
}
