@media print {
  @page {
    size: A4;
    margin: 0;
  }

  body {
    background: #fff !important;
    color: #000 !important;
    margin: 0;
    padding: 0;
  }

  .no-print,
  .site-header,
  .cross-link-banner,
  .mobile-tabs,
  .form-panel,
  .faq-section,
  .site-footer,
  .ad-slot,
  .modal-overlay,
  .toast {
    display: none !important;
  }

  .main-layout {
    display: block !important;
    min-height: auto !important;
  }

  .preview-panel {
    width: 100% !important;
    padding: 0 !important;
    margin: 0 !important;
    overflow: visible !important;
    display: block !important;
  }

  .preview-wrapper {
    max-width: none !important;
    width: 100% !important;
  }

  .resume-a4 {
    width: 210mm !important;
    /* auto (not 297mm): an exact-fit page otherwise spills a blank
       trailing page; template B keeps its own 297mm via .tpl-b */
    min-height: auto !important;
    box-shadow: none !important;
    margin: 0 !important;
    padding: 15mm 18mm !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  /* Keep rows/entries from being cut in half across page breaks */
  .tpl-a .section-table tr,
  .tpl-a .cover-text,
  .tpl-b .mb-entry,
  .tpl-c .c-item,
  .tpl-c .cover-block {
    break-inside: avoid;
    page-break-inside: avoid;
  }

  /* Don't strand a section heading at the bottom of a page */
  .tpl-a .section-heading,
  .tpl-b .mb-section h3,
  .tpl-c .c-section h3 {
    break-after: avoid;
    page-break-after: avoid;
  }

  .tpl-b .sidebar {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .tpl-c .c-section h3 {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
}