/* Printed documents: letterhead, sign-off lines and A4 page rules (macros in templates/_print.html).
   Screen pages carry the letterhead in .print-only blocks; standalone documents show it on screen too. */
.print-only { display: none; }

.ph-letterhead { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px;
  border-bottom: 2px solid #1e3a8a; padding-bottom: 8px; margin-bottom: 12px; color: #0f172a; }
.ph-brand { display: flex; gap: 12px; align-items: center; min-width: 0; }
.ph-logo { max-height: 56px; max-width: 120px; object-fit: contain; }
.ph-company { font-size: 18px; font-weight: 800; color: #1e3a8a; text-transform: uppercase; letter-spacing: .3px; }
.ph-line { font-size: 10.5px; color: #475569; line-height: 1.35; }
.ph-doc { text-align: right; flex-shrink: 0; }
.ph-title { display: inline-block; font-size: 13px; font-weight: 800; text-transform: uppercase; color: #1e40af;
  border: 1px solid #93c5fd; background: #eff6ff; border-radius: 5px; padding: 4px 10px; margin-bottom: 4px; }
.ph-meta { font-size: 10.5px; color: #334155; }

.ph-signoffs { margin-top: 22px; break-inside: avoid; page-break-inside: avoid; color: #0f172a; }
.ph-sign-grid { display: grid; gap: 14px; align-items: end; }
.ph-sign { text-align: center; font-size: 10.5px; }
.ph-stamp { min-height: 40px; line-height: 1.3; font-size: 9.5px; color: #166534; border: 1px dashed #16a34a; border-radius: 4px;
  padding: 4px; margin-bottom: 4px; box-sizing: border-box; }
.ph-stamp-empty { border-color: transparent; }
.ph-sign-line { border-top: 1px solid #64748b; margin: 0 4px; }
.ph-sign-label { font-weight: 700; margin-top: 3px; }
.ph-sign-sub { color: #64748b; font-size: 9.5px; }
.ph-foot { margin-top: 12px; font-size: 9px; color: #64748b; text-align: center; border-top: 1px solid #e2e8f0; padding-top: 4px; }

@media print {
  @page { size: A4; margin: 12mm 10mm 14mm; }
  @page { @bottom-right { content: "Page " counter(page) " of " counter(pages); font-size: 9px; color: #64748b; } }
  @page wide { size: A4 landscape; margin: 10mm 8mm 12mm; }
  .print-only { display: block !important; }
  .no-print, .sidebar, .sidebar-backdrop, .topbar, .flash, .flashes, .alert, .toast, .idle-warning,
  .page-head .actions, .page-head .btn, .actions, .filter-bar, .btn, button, .bi-select-pill,
  #appUpdateBanner, .app-update-banner, .mobile-menu { display: none !important; }
  .app-shell, .main-area, .content { display: block !important; margin: 0 !important; padding: 0 !important;
    max-width: none !important; width: auto !important; }
  body { background: #fff !important; color: #000 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .card { box-shadow: none !important; overflow: visible !important; }
  .card-body:has(> .table-wrap, > .table-responsive) { padding-left: 0 !important; padding-right: 0 !important; }
  .table-wrap, .table-responsive { overflow: visible !important; max-height: none !important; }
  table { width: 100% !important; min-width: 0 !important; }
  th, td { white-space: normal !important; overflow-wrap: break-word; }
  td.text-end, td.num, td.font-monospace { white-space: nowrap !important; }
  thead { display: table-header-group; }
  tfoot { display: table-footer-group; }
  tr, .ph-sign { break-inside: avoid; page-break-inside: avoid; }
  th, td { font-size: 10px !important; }
  .ph-letterhead { break-after: avoid; }
  /* Wide registers (payroll, muster) print landscape. */
  .content:has(.ph-landscape) { page: wide; }
  /* The letterhead carries the title: the screen heading is not printed again. */
  .content:has(.ph-letterhead) .page-head { display: none !important; }
}
