@media print {
  /* Page setup: A4 and Letter both fit with mm margins only in @page */
  @page {
    size: A4;
    margin: 15mm 12mm;
  }

  @page landscape {
    size: landscape;
  }

  /* Hide navigation, drawers, buttons */
  header, #nav-drawer, [role="complementary"], .toolbar-actions button, .toolbar-actions a.link-btn, #filter-btn, .primary-btn, .secondary-btn, .icon-btn, .scrim {
    display: none !important;
  }

  /* Hide the Dates chip and Filters button (already in toolbar-actions) */
  #dates-chip, #filter-btn, .Dates {
    display: none !important;
  }

  /* Body: black on white */
  body {
    background: var(--print-paper);
    color: var(--print-ink);
    margin: 0;
    padding: 0;
  }

  main {
    background: var(--print-paper);
    color: var(--print-ink);
    padding: 0;
  }

  .view {
    display: block;
  }

  /* Print header */
  .report-page::before, .view-book::before {
    content: attr(data-print-header);
    display: block;
    margin-bottom: 1rem;
    border-bottom: var(--print-border);
    padding-bottom: 1rem;
    font-size: var(--fs-body);
    color: var(--print-ink);
  }

  /* Report/book title and dates in header */
  .report-page > .toolbar > h2, .view-book > .toolbar > h2 {
    display: block;
    font-size: var(--fs-h4);
    margin: 0 0 0.5rem 0;
    color: var(--print-ink);
  }

  .ledger-picker {
    display: none !important;
  }

  .ledger-title h2 {
    font-size: var(--fs-h4);
    margin: 0 0 0.5rem 0;
    color: var(--print-ink);
  }

  .ledger-title .sub {
    margin: 0 0 1rem 0;
    color: var(--print-ink-2);
    font-size: var(--fs-body);
  }

  .ledger-table tfoot th, .ledger-table tfoot td {
    position: static;
    background: transparent;
  }

  .report-page > p.sub, .view-book > p.sub {
    display: block;
    margin: 0 0 1rem 0;
    color: var(--print-ink-2);
    font-size: var(--fs-body);
  }

  /* Tables */
  table {
    width: 100%;
    border-collapse: collapse;
    color: var(--print-ink);
  }

  table thead {
    display: table-header-group;
  }

  table tbody tr {
    break-inside: avoid;
  }

  th, td {
    border: var(--print-border);
    padding: var(--pad-cell-y) var(--pad-cell-x);
    text-align: left;
  }

  th {
    background: var(--print-paper);
    color: var(--print-ink);
    font-weight: var(--fw-semibold);
  }

  td.num {
    text-align: right;
    font-variant-numeric: tabular-nums;
  }

  .report-line.line-total td, .report-line.line-total th,
  .line-total td, .line-total th,
  .lg-totals td, .lg-totals th {
    border-top: var(--print-border-thick);
    border-bottom: var(--print-border-thick);
    font-weight: var(--fw-semibold);
  }

  /* Ledger grid adjustments */
  .ledger-scroll {
    overflow: visible;
  }

  .table-scroll {
    overflow: visible;
    max-width: 100%;
  }

  /* Landscape for wide tables */
  .ledger-table {
    display: table;
  }

  @media (min-width: 1200px) {
    @page landscape {
      size: landscape;
      margin: 12mm;
    }
    .view-book[data-book-view="ledger"] {
      page: landscape;
    }
  }

  /* Cards and sections */
  .card {
    break-inside: avoid;
    border: var(--print-border);
    page-break-inside: avoid;
  }

  .report-checks {
    display: none;
  }

  /* Links: no underlines, ink color */
  a {
    color: var(--print-ink);
    text-decoration: none;
  }

  /* Empty states hidden (they won't print anyway) */
  .empty-state {
    display: none;
  }
}
