/* Keep native fragment navigation clear of the actual fixed header. */
:root { --olr-anchor-offset: 100px; }
@media screen {
  .page-content-shell [id] { scroll-margin-top: var(--olr-anchor-offset); }
}

@page { size: A4; margin: 14mm 12mm; }
@media print {
  html, body { background: white !important; height: auto !important; overflow: visible !important; }
  .topbar, nav, .admin-sidebar, .admin-sidebar-backdrop,
  .admin-mobile-toolbar, .site-footer, .pwa-install-panel,
  .flashwrap, .flash-container, .tour-report-actions,
  [data-print-page], .driver-next-stop-fab { display: none !important; }
  .admin-shell-active .page-content-shell, .page-content-shell,
  .dashboard-main, .full-dashboard, .section, .invoice-sheet {
    margin: 0 !important; padding: 0 !important; min-height: 0 !important;
    max-width: none !important; width: auto !important;
    background: white !important; box-shadow: none !important;
  }
  /* A whole long panel must be allowed to span multiple pages. */
  .panel, .invoice-sheet { break-inside: auto !important; page-break-inside: auto !important; }
  .panel { margin: 0 0 5mm !important; padding: 3mm !important; box-shadow: none !important; }
  h1, h2, h3, h4, .panel-head { break-after: avoid-page; page-break-after: avoid; }
  p, li { orphans: 3; widows: 3; }
  .table-wrap, .tour-report-table-wrap { overflow: visible !important; max-height: none !important; }
  table { width: 100% !important; min-width: 0 !important; border-collapse: collapse; }
  thead { display: table-header-group; }
  tfoot { display: table-footer-group; }
  tr, .tour-report-row, .tour-report-stats > div, .invoice-grid > div {
    break-inside: avoid-page; page-break-inside: avoid;
  }
  th, td { overflow-wrap: anywhere; }
  .tour-report-table { table-layout: fixed; }
  .tour-report-table th, .tour-report-table td { padding: 2mm 1mm; font-size: 8pt; }
  .tour-report-page .tour-report-stats, .tour-report-summary-grid, .cash-reconciliation-grid {
    display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 2mm;
  }
  .invoice-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 5mm; }
  img, svg { max-width: 100% !important; }
}
