/* Print (PLAN 3.16). Linked with media="print", so none of this reaches the
   screen; the rules keep their own @media print as well, so the file is
   still right if it is ever linked without the attribute. The colours are
   the print tokens at the end of tokens.css (white paper, black text).

   A statement or a certificate is printed to be signed or filed. Print the
   page, not the application around it: no sidebar, header, buttons, toasts
   or drop zones; a header naming the company, the page and who printed it
   and when (components/print.js puts it in before printing); table heads
   that repeat on every sheet; rows that do not break across sheets. */

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

  html, body { background: var(--bg); }
  body { font-size: 10pt; line-height: 1.4; -webkit-print-color-adjust: exact; print-color-adjust: exact; }

  /* ── the application around the page ──────────────────────────────── */
  .sidebar, .header, .nav-scrim, .btn, .toasts, .dropzone, .scrim, .menu, .popover,
  .palette, .no-print, .ph-actions, .tbl-toolbar, .tbl-foot .btn, .form-footer,
  .tabs-list, .skip-link, .info-btn, .lg-del, .lg-foot { display: none !important; }
  .app { display: block; }
  .main { display: block; }
  .content { padding: 0; }
  .print-only { display: block !important; }

  /* ── the print header (components/print.js) ─────────────────────────── */
  .print-head {
    display: flex !important; justify-content: space-between; gap: 12mm;
    padding-bottom: 3mm; margin-bottom: 5mm; border-bottom: 1.5pt solid var(--text);
    font-size: 9pt; line-height: 1.35;
  }
  .print-head .ph-entity b { display: block; font-size: 12pt; }
  .print-head .ph-printed { text-align: end; color: var(--text-muted); }
  .print-head .ph-page { font-size: 11pt; font-weight: 600; color: var(--text); }

  /* ── blocks ─────────────────────────────────────────────────────────── */
  /* Only small blocks refuse to break. A card may hold a whole list or
     statement: kept in one piece, Chrome pushes it to page 2 whenever it is
     taller than a page and leaves page 1 blank under the title. */
  .card, .stat-tile, .tile { box-shadow: none; border-color: var(--border); }
  .stat-tile, .tile { break-inside: avoid; }
  .card-head { min-height: 0; padding: 2mm 3mm; break-after: avoid; }
  .card-body { padding: 3mm; }
  .page-head { margin-bottom: 4mm; }
  .crumbs { display: none; }
  h1 { font-size: 15pt; }
  h2 { font-size: 12pt; }
  a { color: var(--text); text-decoration: none; }
  .banner { border-width: 1pt; border-inline-start-width: 3pt; break-inside: avoid; }
  .stats-grid, .tiles { gap: 3mm; }
  .stat-value, .stat .value { font-size: 14pt; }
  .kv-item, .tl-item { break-inside: avoid; }

  /* ── tables ─────────────────────────────────────────────────────────── */
  .tbl-wrap, .post-lines { overflow: visible !important; }
  table.tbl, table.table { font-size: 9pt; }
  table.tbl thead, table.table thead { display: table-header-group; }
  table.tbl tfoot, table.table tfoot { display: table-footer-group; }
  table.tbl thead th, table.table thead th {
    position: static; background: none; color: var(--text);
    border-bottom: 1pt solid var(--text);
  }
  table.tbl tr, table.table tr { break-inside: avoid; page-break-inside: avoid; }
  table.tbl th, table.tbl td, table.table th, table.table td { padding: 1.2mm 2mm; }
  table.tbl td.num, table.tbl th.num, .num { text-align: right; }
  table.tbl tfoot td { background: none; border-top: 1.5pt solid var(--text); }
  table.tbl tbody tr:hover { background: none; }

  /* ── badges print as outlined text ──────────────────────────────────── */
  .badge, .badge-ok, .badge-warn, .badge-danger, .badge-bad, .badge-info, .badge-accent, .badge-neutral {
    background: none !important; color: var(--text) !important; border: 0.75pt solid var(--text) !important;
  }
  .neg { color: var(--text); }

  /* ── a customer-facing document (components/print.js printFrame): the
     screen layout in components.css, set in millimetres for paper. ───── */
  .print-doc { max-width: none; padding: 0; border: none; box-shadow: none; font-size: 10pt; }
  .pd-title { font-size: 16pt; }
  .pd-sign { margin-top: 18mm; }
}
