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

  body * {
    visibility: hidden;
  }

  body {
    background: #fff !important;
    color: #000 !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .no-print {
    display: none !important;
  }

  .site-nav,
  footer {
    display: none !important;
  }

  #printable-application,
  #printable-application * {
    visibility: visible !important;
  }

  #printable-application {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    margin: 0 !important;
    width: 210mm !important;
    min-height: 297mm !important;
    max-height: 297mm !important;
    padding: 9mm !important;
    box-sizing: border-box !important;
    overflow: hidden !important;
  }

  .print-only-paper {
    visibility: visible !important;
    border: none !important;
    box-shadow: none !important;
    margin: 0 !important;
    width: 210mm !important;
    max-width: 210mm !important;
    min-height: 0 !important;
    max-height: none !important;
    overflow: visible !important;
  }

  .official-form {
    background: #fff !important;
    color: #000 !important;
    font-size: 11.2px;
    line-height: 1.38;
  }

  /* Center brand block and keep photo anchored top-right. */
  .official-header {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding-right: 118px;
    min-height: 102px;
  }

  .official-brand {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    text-align: center;
  }

  .official-brand-logo {
    width: 52px;
    height: 52px;
  }

  .official-title {
    margin: 0;
    font-size: 0.98rem;
    line-height: 1.15;
    text-align: center;
  }

  .official-subtitle {
    margin: 0.15rem 0 0;
    font-size: 0.78rem;
    text-align: center;
  }

  .official-photo-box {
    position: absolute;
    top: 0;
    right: 0;
    min-width: 90px;
    width: 90px;
    min-height: 100px;
    height: 100px;
    background: #fff !important;
    border: 1.5px solid #000;
  }

  /* Keep sections together on page breaks. */
  .official-section {
    break-inside: avoid;
    page-break-inside: avoid;
    margin-top: 2.4mm !important;
  }

  /* Print-friendly fixed grids for form fields. */
  .official-grid-2 {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    column-gap: 7.6mm !important;
    row-gap: 2.8mm !important;
  }

  .official-grid-3 {
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    column-gap: 6.2mm !important;
    row-gap: 2.8mm !important;
  }

  .official-banner {
    margin: 0.72rem auto !important;
    padding: 0.24rem 0.88rem !important;
    font-size: 9.6px !important;
  }

  .official-section-title {
    margin-top: 0.55rem !important;
    padding: 0.24rem !important;
    font-size: 9.8px !important;
  }

  .official-row-grid {
    margin-top: 0.26rem !important;
    padding: 0.3rem 0.4rem !important;
    gap: 0.58rem !important;
  }

  .official-row-grid > div {
    min-width: 0;
    overflow-wrap: anywhere;
    word-break: break-word;
  }

  /* Crucial checkbox alignment fix. */
  .official-checkbox-group {
    display: flex !important;
    flex-wrap: wrap !important;
    align-items: center !important;
    gap: 0.26rem 0.72rem !important;
  }

  .official-checkbox-item {
    display: inline-flex !important;
    align-items: center !important;
    gap: 0.22rem !important;
    vertical-align: middle;
  }

  .official-checkbox {
    flex: 0 0 auto;
    width: 10px !important;
    height: 10px !important;
    font-size: 8px !important;
  }

  /* Long uploaded file names should not break layout. */
  .official-upload-value {
    min-width: 0;
    overflow-wrap: anywhere;
    word-break: break-all;
  }

  .official-consent-line {
    margin-top: 0.22rem !important;
    padding: 0.28rem 0.4rem !important;
  }

  .official-contact-strip {
    margin-top: 0.5rem !important;
    padding: 0.28rem 0.48rem !important;
    font-size: 9.6px !important;
  }
}
