/* ═══════════════════════════════════════════════════════
   MBI — PRINT / PDF STYLES
   Loaded with media="print" — never affects screen layout
   ═══════════════════════════════════════════════════════ */

@media print {

  /* ── Force exact colors ── */
  * {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  /* ── Page setup ── */
  @page {
    size: letter portrait;
    margin: 0.55in 0.6in 0.65in 0.6in;
  }

  /* ── Reset body ── */
  body {
    background: #fff !important;
    padding: 0 !important;
    margin: 0 !important;
    display: block !important;
    font-family: 'Inter', Arial, sans-serif !important;
  }

  /* ── Hide ALL UI — nothing but the report ── */
  .dashboard,
  .footer-controls,
  #auth-overlay,
  #user-bar,
  #calc-banner,
  #settings-overlay,
  .btn-export,
  .metrics-toggle,
  #metrics-panel,
  #qc-banner,
  .truncation-warning {
    display: none !important;
  }

  /* ── Expand report to full page width ── */
  #report-output-container {
    display: block !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  #final-report-wrapper {
    max-width: 100% !important;
    padding: 0 !important;
    margin: 0 !important;
    box-shadow: none !important;
    border: none !important;
    background: #fff !important;
  }

  /* ── Cover page — always page 1, force break after ── */
  #cover-page {
    display: block !important;
    page-break-after: always;
    break-after: always;
  }

  /* ── Running header — hidden on screen, shown in PDF ── */
  #print-running-header {
    display: flex !important;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 10px;
    margin-bottom: 18px;
    border-bottom: 2px solid #0f172a;
    page-break-inside: avoid;
    break-inside: avoid;
  }

  /* ── Luxury header (screen report header) ── */
  .luxury-header {
    page-break-inside: avoid;
    break-inside: avoid;
  }

  .luxury-header h1 {
    font-size: 13px !important;
  }

  /* ── Status blocks ── */
  .status-blocks {
    page-break-inside: avoid;
    break-inside: avoid;
  }

  /* ── Cost/SF banner ── */
  .costsf-banner {
    page-break-inside: avoid;
    break-inside: avoid;
  }

  /* ── Analysis content ── */
  #pdf-analysis-content {
    font-size: 9px !important;
    line-height: 1.5;
    color: #1a1a1a !important;
  }

  #pdf-analysis-content h1,
  #pdf-analysis-content h2,
  #pdf-analysis-content h3 {
    page-break-after: avoid;
    break-after: avoid;
    margin-top: 20px;
    color: #0f172a !important;
  }

  #pdf-analysis-content table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 16px;
    table-layout: fixed;
    page-break-inside: auto;
  }

  #pdf-analysis-content tr {
    page-break-inside: avoid !important;
    break-inside: avoid !important;
  }

  #pdf-analysis-content th {
    background: #0f172a !important;
    color: #fff !important;
    padding: 7px 6px;
    font-size: 8px;
    text-transform: uppercase;
    text-align: left;
  }

  #pdf-analysis-content td {
    padding: 5px 6px;
    border: 1px solid #e2e8f0;
    font-size: 8px;
    word-wrap: break-word;
    color: #1a1a1a !important;
    background: #fff !important;
  }

  #pdf-analysis-content tr:nth-child(even) td {
    background: #f8fafc !important;
  }

  /* ── Exclusions ── */
  #exclusions-section {
    display: block !important;
    page-break-inside: avoid;
    break-inside: avoid;
    margin-top: 24px;
  }

  /* ── Report footer ── */
  .report-footer {
    page-break-inside: avoid;
    break-inside: avoid;
    border-top: 2px solid #e2e8f0 !important;
    margin-top: 32px;
    padding-top: 16px;
    font-size: 8px !important;
    color: #475569 !important;
  }

  .signature-block {
    width: 35%;
    text-align: right;
  }

  .sig-line {
    border-bottom: 1.5px solid #0f172a;
    width: 100%;
    margin: 22px 0 5px;
  }
}
