@page {
  size: letter portrait;
  margin: 16mm 14mm 18mm;
}

@media print {
  :root {
    color-scheme: light only;
  }

  *, *::before, *::after {
    box-shadow: none !important;
    text-shadow: none !important;
  }

  html, body {
    width: auto;
    min-width: 0;
    margin: 0;
    padding: 0;
    background: #fff !important;
    color: #111 !important;
    font: 10pt/1.4 system-ui, -apple-system, "Segoe UI", sans-serif;
  }

  .no-print,
  .side-nav,
  .backup-reminder,
  .toast-region,
  dialog,
  button,
  .report-controls,
  body:not(.printing-report) .app-section[hidden] {
    display: none !important;
  }

  body.printing-report .app-shell,
  body.printing-report > :not(#print-root):not(script) {
    display: none !important;
  }

  #print-root {
    display: block !important;
  }

  .app-shell,
  .app-main,
  .app-section,
  .report-layout {
    display: block !important;
    width: 100% !important;
    max-width: none !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  .report-sheet,
  .print-report {
    width: 100%;
    margin: 0;
    padding: 0;
    border: 0;
    background: #fff;
    color: #111;
  }

  .report-header {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8mm;
    align-items: start;
    margin-bottom: 7mm;
    padding-bottom: 4mm;
    border-bottom: 2px solid #274f73;
  }

  .report-header h1 {
    margin: 0 0 1mm;
    color: #274f73 !important;
    font-size: 18pt;
    line-height: 1.15;
  }

  .report-header p,
  .report-meta {
    margin: 0;
    color: #333 !important;
    font-size: 9pt;
  }

  .report-summary {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 3mm;
    margin: 0 0 6mm;
  }

  .report-summary > div,
  .report-summary-card {
    padding: 3mm;
    border: 1px solid #9aa79f;
    break-inside: avoid;
  }

  .report-summary span {
    display: block;
    margin-bottom: 1mm;
    color: #444 !important;
    font-size: 8pt;
  }

  .report-summary strong {
    font-size: 12pt;
    font-variant-numeric: tabular-nums;
  }

  h2, h3 {
    color: #274f73 !important;
    break-after: avoid;
  }

  h2 {
    margin: 6mm 0 2mm;
    font-size: 12pt;
  }

  table {
    width: 100%;
    border-collapse: collapse;
    border-spacing: 0;
    table-layout: auto;
    font-size: 8.5pt;
    font-variant-numeric: tabular-nums;
  }

  thead {
    display: table-header-group;
  }

  tfoot {
    display: table-footer-group;
  }

  tr {
    break-inside: avoid;
  }

  th,
  td {
    padding: 1.7mm 2mm;
    border: 1px solid #bbc4be;
    text-align: left;
    vertical-align: top;
    overflow-wrap: anywhere;
  }

  th {
    background: #e9f0f2 !important;
    color: #274f73 !important;
    font-weight: 700;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  td.money,
  th.money,
  .number-cell {
    text-align: right;
    white-space: nowrap;
  }

  .report-total-row td {
    border-top: 2px solid #274f73;
    font-weight: 700;
  }

  .report-notes {
    margin-top: 5mm;
    padding: 3mm;
    border: 1px solid #bbc4be;
    break-inside: avoid;
  }

  .signature-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 14mm;
    margin-top: 20mm;
    break-inside: avoid;
  }

  .signature-line {
    padding-top: 2mm;
    border-top: 1px solid #222;
    text-align: center;
    font-size: 8.5pt;
  }

  .report-footer {
    margin-top: 8mm;
    color: #555 !important;
    font-size: 7.5pt;
    text-align: center;
  }

  a,
  a:visited {
    color: inherit !important;
    text-decoration: none;
  }

  .page-break {
    break-before: page;
  }

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

  .screen-only {
    display: none !important;
  }
}
