@media print {
  @page {
    size: A4 portrait;
    margin: 1.5cm 1.5cm 1.8cm;
  }

  html, body {
    background: white !important;
    color: black !important;
    font-size: 10pt;
    line-height: 1.45;
    direction: rtl;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  /* הסתרת כל מה שלא הדוח */
  .no-print,
  .app-header,
  .app-footer,
  .screen:not(#screen-report) {
    display: none !important;
  }

  main#app {
    max-width: 100%;
    padding: 0 !important;
    margin: 0 !important;
  }

  #screen-report {
    display: block !important;
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
    margin: 0 !important;
    background: white !important;
    direction: rtl;
  }

  #report-content {
    direction: rtl;
    text-align: right;
  }

  /* כותרות */
  #report-content h2 {
    color: #111 !important;
    border-bottom: 2px solid #111;
    padding-bottom: 6pt;
    margin: 0 0 10pt 0;
    font-size: 16pt;
    text-align: right;
    direction: rtl;
    page-break-after: avoid;
    break-after: avoid;
  }

  #report-content h3 {
    color: #111 !important;
    margin: 14pt 0 4pt 0;
    font-size: 12pt;
    font-weight: 700;
    border-bottom: 1px solid #666;
    padding-bottom: 2pt;
    text-align: right;
    direction: rtl;
    page-break-after: avoid;
    break-after: avoid;
  }

  .report-date {
    margin: 0 0 8pt 0;
    font-size: 9.5pt;
    color: #444 !important;
    text-align: right;
    direction: rtl;
  }

  #report-content p {
    margin: 4pt 0 6pt 0;
    text-align: right;
    direction: rtl;
    page-break-inside: avoid;
    break-inside: avoid;
    page-break-after: avoid;
    break-after: avoid;
    orphans: 3;
    widows: 3;
  }

  #report-content .muted {
    color: #555 !important;
    font-size: 9pt;
  }

  /* === טבלאות === */
  #report-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 4pt 0 10pt 0;
    font-size: 9.5pt;
    direction: rtl;
    table-layout: auto;
    page-break-inside: avoid;
    break-inside: avoid;
  }

  /* בסיס — כל תא: גבול, padding, יישור אנכי */
  #report-content th,
  #report-content td {
    border: 1px solid #333 !important;
    padding: 4pt 7pt !important;
    vertical-align: middle !important;
    word-wrap: break-word;
    overflow-wrap: break-word;
  }

  /* כותרות (th) — מיושרות לימין כברירת מחדל */
  #report-content th {
    text-align: right !important;
    direction: rtl !important;
    font-weight: 700 !important;
  }

  /* נתונים (td) — מיושרים למרכז */
  #report-content td {
    text-align: center !important;
    direction: rtl !important;
  }

  /* כותרות עמודה ב-thead — במרכז */
  #report-content thead {
    background: #e5e7eb !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  #report-content thead th {
    text-align: center !important;
  }

  /* תאי .num — מספרים: LTR + ספרות אחידות (היישור כבר מרכז) */
  #report-content td.num,
  #report-content th.num {
    text-align: center !important;
    direction: ltr !important;
    unicode-bidi: plaintext !important;
    font-variant-numeric: tabular-nums !important;
    white-space: nowrap !important;
  }

  /* אל תפצל שורות בודדות */
  #report-content tr {
    page-break-inside: avoid;
    break-inside: avoid;
  }

  /* בלוק תוצאה סופית */
  #report-content .final-amount {
    border: 2.5pt solid #111;
    padding: 12pt 14pt;
    font-size: 12.5pt;
    font-weight: 700;
    margin: 12pt 0 0 0;
    background: #f3f4f6 !important;
    text-align: right;
    direction: rtl;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
    page-break-inside: avoid;
    break-inside: avoid;
  }
  #report-content .final-amount div {
    text-align: right;
    direction: rtl;
  }
  #report-content .final-amount div + div {
    margin-top: 5pt;
  }
  #report-content .final-amount .num {
    font-size: 14pt;
    text-align: center;
    direction: ltr;
    unicode-bidi: plaintext;
    font-variant-numeric: tabular-nums;
  }

  /* Disclaimer */
  #report-content .disclaimer {
    margin-top: 12pt;
    padding-top: 6pt;
    border-top: 1px solid #888;
    font-size: 8.5pt;
    color: #444 !important;
    text-align: right;
    direction: rtl;
    page-break-inside: avoid;
    break-inside: avoid;
  }

  /* קופסת אזהרה (במקרה אי-זכאות) */
  #report-content .error-box {
    border: 1.5pt solid #92400e;
    background: #fef3c7 !important;
    color: #78350f !important;
    padding: 8pt 10pt;
    text-align: right;
    direction: rtl;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  /* קופסת אזהרה — הפסקת עבודה ארוכה */
  #report-content .warning-box {
    border: 1.5pt solid #92400e;
    background: #fffbeb !important;
    color: #78350f !important;
    padding: 8pt 10pt;
    text-align: right;
    direction: rtl;
    display: block;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
    page-break-inside: avoid;
    break-inside: avoid;
  }
  #report-content .warning-box ul {
    margin: 4pt 0 0;
    padding-inline-start: 16pt;
  }
  #report-content .warning-box .warning-icon { font-weight: 700; }

  h2, h3 { page-break-after: avoid; }
}
