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

  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }

  html, body {
    background: oklch(98% 0.01 80) !important;
    font-size: 10pt;
    color: #1a1a1a;
  }

  #sidebar,
  #toolbar,
  #editor-form,
  #toast,
  .totals-section,
  .editor-section { display: none !important; }

  #app {
    display: block !important;
  }

  #main {
    padding: 0 !important;
    display: block !important;
    overflow: visible !important;
    background: oklch(98% 0.01 80) !important;
  }

  .invoice-doc {
    max-width: 100% !important;
    width: 100% !important;
    border: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
  }

  .inv-header {
    padding: 0 0 16pt !important;
    border-bottom: 1.5pt solid #1a1a1a !important;
  }

  .inv-wordmark { font-size: 28pt !important; }

  .inv-bill-section {
    padding: 12pt 0 !important;
  }

  .inv-lines {
    padding: 0 !important;
  }

  .inv-totals-section {
    padding: 0 0 12pt !important;
  }

  .inv-footer {
    padding: 12pt 0 !important;
    background: #f8f7f5 !important;
  }

  .inv-lines-table tbody td,
  .inv-lines-table thead th {
    padding: 6pt 4pt !important;
    font-size: 9pt !important;
  }

  .inv-totals-row.grand .inv-totals-value {
    font-size: 16pt !important;
  }

  a { text-decoration: none; color: inherit; }

  /* Prevent page breaks inside key blocks */
  .inv-header,
  .inv-bill-section,
  .inv-totals-section,
  .inv-footer { page-break-inside: avoid; }

  /* Break before totals if needed */
  .inv-totals-section { page-break-before: auto; }
}
