/* Custom overrides for MSME Project Report Generator */

/* 1. Force Right Alignment for all financial tables and cells containing numbers */
.prose table td:not(:first-child),
.prose table th:not(:first-child),
table.w-full td:not(:first-child),
table.w-full th:not(:first-child) {
  text-align: right !important;
}

.prose table td:first-child,
.prose table th:first-child,
table.w-full td:first-child,
table.w-full th:first-child {
  text-align: left !important;
}

/* 2. Financial Projections section & CMA Data should ALWAYS start on a new page */
.page-break-before,
.break-before-page,
.prose h2:has(+ * + table),
.prose h2:has(+ table),
.prose h2[id*="financial"],
.prose h2[id*="11"] {
  break-before: page !important;
  page-break-before: always !important;
}

/* 3. Tables should never split midway across pages */
.prose table,
.break-before-page table,
.break-before-page > div {
  break-inside: avoid !important;
  page-break-inside: avoid !important;
}

/* 4. Completely replace the "Need Professional Assistance?" box with "End of Report" */
div.break-inside-avoid:has(h3),
div:has(> h3) {
  /* targeted in JS mutation / print below */
}

.report-end-card {
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 3rem 1rem 2rem 1rem !important;
  margin-top: 3.5rem !important;
  text-align: center !important;
  border-top: 2px dashed #94a3b8 !important;
  break-inside: avoid !important;
  page-break-inside: avoid !important;
}

.report-end-card .end-badge {
  display: inline-flex !important;
  align-items: center !important;
  gap: 0.75rem !important;
  font-size: 0.875rem !important;
  font-weight: 800 !important;
  letter-spacing: 0.2em !important;
  text-transform: uppercase !important;
  color: #475569 !important;
  padding: 0.5rem 1.25rem !important;
  background-color: #f1f5f9 !important;
  border: 1px solid #cbd5e1 !important;
  border-radius: 9999px !important;
}

.report-end-card .end-sub {
  font-size: 0.75rem !important;
  color: #94a3b8 !important;
  margin-top: 0.5rem !important;
  font-weight: 500 !important;
  letter-spacing: 0.05em !important;
}

/* Ensure clean print layout */
@media print {
  body {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  .print\:hidden,
  header,
  footer,
  button {
    display: none !important;
  }

  .break-before-page {
    break-before: page !important;
    page-break-before: always !important;
  }

  .page-break-before {
    break-before: page !important;
    page-break-before: always !important;
  }

  .prose table,
  table.w-full {
    break-inside: avoid !important;
    page-break-inside: avoid !important;
  }
}

