/* ==========================================================================
   IlmOS · print.css
   Everything that is not paper disappears. Blank pages are never knowingly
   produced: a break only happens before a .paper element.
   ========================================================================== */

@page {
  margin: 12mm 10mm;
}

@media print {
  html,
  body {
    background: #fff !important;
    background-image: none !important;
    color: #000;
    font-size: 11.5pt;
  }

  .topbar,
  .rail,
  .tabs,
  .sheet,
  .toast,
  .print-bar,
  .page-head__actions,
  .no-print,
  .submit-bar,
  .filter-bar,
  .pager,
  .card__actions {
    display: none !important;
  }

  /* A page that carries a sheet prints the sheet and nothing else: no page
     heading, no stat cards, no filters, no notes around it. */
  .main:has(.paper) > :not(.paper):not(:has(.paper)),
  .main:has(.paper) .page-head {
    display: none !important;
  }

  .main {
    margin: 0 !important;
    padding: 0 !important;
    max-width: none !important;
  }

  .card {
    border: 0 !important;
    box-shadow: none !important;
    background: transparent !important;
  }

  .card__head {
    background: transparent !important;
    border-bottom: 0 !important;
    padding: 0 0 6px !important;
  }

  .card__body {
    padding: 0 !important;
  }

  .paper {
    max-width: none;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    break-inside: auto;
  }

  /* one sheet per page when the paper is a voucher / slip */

  /* long tables repeat their header row on every page */
  .sheet-table thead {
    display: table-header-group;
  }

  .sheet-table tr,
  .sheet-table td,
  .sheet-table th {
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .sheet-table {
    font-size: 9.5pt;
  }

  .sheet-table--att {
    font-size: 8.5pt;
  }

  .sign-row {
    break-inside: avoid;
  }

  a[href]::after {
    content: "";
  }

  /* Letter pad: the typing hints stay on screen, never on paper or in the PDF. */
  .lp-edit:empty::before {
    content: '';
  }

  .lp-cell:focus,
  .lp-edit:focus {
    background: none;
  }
}

/* Landscape sheets (wide attendance register, 31 columns; a printed list
   with many columns) ---------------------------------------------------- */
.paper--landscape,
.paper:has(.sheet-table--list) {
  page: wide-sheet;
}

@page wide-sheet {
  size: A4 landscape;
  margin: 8mm;
}
