/* ==========================================================================
   Branch Petty Cash Control - Reports & Printable Voucher Templates
   ========================================================================== */

/* Report Cards & Analytics Layout */
.report-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}

.report-summary-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.report-summary-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--primary-50);
  color: var(--primary-600);
  font-size: 1.25rem;
}

/* Branch Cash Health Progress Bar */
.branch-health-cell {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  min-width: 140px;
}

.branch-health-info {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  font-weight: 600;
}

/* ==========================================================================
   PRINTABLE VOUCHER & REIMBURSEMENT SLIP STYLES
   ========================================================================== */

.printable-document {
  background: #ffffff;
  color: #111827;
  padding: 2.5rem;
  max-width: 800px;
  margin: 0 auto;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  box-shadow: 0 4px 6px -1px rgba(0,0,0,0.05);
  font-family: 'Prompt', sans-serif;
}

.doc-header {
  border-bottom: 2px solid #1e3a8a;
  padding-bottom: 1.25rem;
  margin-bottom: 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.doc-company-name {
  font-size: 1.25rem;
  font-weight: 800;
  color: #1e3a8a;
  letter-spacing: -0.02em;
}

.doc-title-main {
  font-size: 1.15rem;
  font-weight: 700;
  color: #111827;
  margin-top: 0.25rem;
}

.doc-meta {
  text-align: right;
  font-size: 0.85rem;
}

.doc-meta-item {
  margin-bottom: 0.2rem;
}

.doc-meta-label {
  color: #6b7280;
}

.doc-meta-val {
  font-weight: 700;
  font-family: 'Plus Jakarta Sans', sans-serif;
  color: #111827;
}

.doc-info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  background-color: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  padding: 1rem 1.25rem;
  margin-bottom: 1.5rem;
  font-size: 0.875rem;
}

.doc-info-row {
  display: flex;
  margin-bottom: 0.35rem;
}

.doc-info-row:last-child {
  margin-bottom: 0;
}

.doc-info-label {
  width: 130px;
  color: #4b5563;
  font-weight: 500;
  flex-shrink: 0;
}

.doc-info-value {
  font-weight: 600;
  color: #111827;
}

/* Voucher items table */
.doc-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 1.75rem;
  font-size: 0.875rem;
}

.doc-table th {
  background-color: #f3f4f6;
  color: #374151;
  font-weight: 700;
  padding: 0.65rem 0.85rem;
  border: 1px solid #d1d5db;
  text-align: left;
}

.doc-table td {
  padding: 0.65rem 0.85rem;
  border: 1px solid #e5e7eb;
  color: #1f2937;
}

.doc-table tfoot td {
  font-weight: 700;
  background-color: #f9fafb;
  border-top: 2px solid #9ca3af;
}

.doc-amount-words {
  background-color: #f9fafb;
  border: 1px dashed #cbd5e1;
  padding: 0.75rem 1rem;
  border-radius: 6px;
  font-size: 0.85rem;
  margin-bottom: 2rem;
  display: flex;
  justify-content: space-between;
}

/* Signatures block */
.doc-signatures {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
  margin-top: 2rem;
  padding-top: 1rem;
}

.signature-box {
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  padding: 1rem 0.75rem;
  text-align: center;
  background-color: #fafafa;
}

.signature-space {
  height: 50px;
  border-bottom: 1px dotted #9ca3af;
  margin-bottom: 0.5rem;
}

.signature-name {
  font-size: 0.8rem;
  font-weight: 600;
  color: #1f2937;
}

.signature-title {
  font-size: 0.75rem;
  color: #6b7280;
  margin-top: 0.15rem;
}

.signature-date {
  font-size: 0.72rem;
  color: #9ca3af;
  margin-top: 0.25rem;
}

/* ==========================================================================
   PRINT MEDIA QUERY - OPTIMIZED FOR A4 PORTRAIT & PERFECT PDF EXPORT
   ========================================================================== */
@page {
  size: A4 portrait;
  margin: 12mm 15mm;
}

@media print {
  /* Reset browser root & background */
  html, body {
    background: #ffffff !important;
    color: #000000 !important;
    width: 100% !important;
    height: auto !important;
    min-height: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: visible !important;
    font-size: 11pt !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  /* Hide app navigation, sidebar, toolbars, background cards, tables, and buttons */
  .app-container > .sidebar,
  .top-navbar,
  .toast-container,
  .modal-header,
  .modal-footer,
  .modal-close-btn,
  .btn,
  button,
  .no-print,
  .multiselect-dropdown,
  .search-box,
  .toolbar-container,
  .kpi-grid,
  .alert-banner,
  .tab-content > .card,
  .table-responsive {
    display: none !important;
  }

  /* When printing in Reports tab where card itself is #printContainer */
  #reportsTab .card#printContainer,
  #reportsTab .card#printContainer .table-responsive {
    display: block !important;
  }

  .main-wrapper {
    margin: 0 !important;
    padding: 0 !important;
    width: 100% !important;
    background: #ffffff !important;
  }

  .content-area {
    padding: 0 !important;
    margin: 0 !important;
  }

  /* Unset fixed modal overlays and render modal content as flat page document */
  .modal-backdrop {
    position: static !important;
    display: none !important;
    background: transparent !important;
    backdrop-filter: none !important;
    padding: 0 !important;
    margin: 0 !important;
    width: 100% !important;
    height: auto !important;
    min-height: auto !important;
    overflow: visible !important;
    opacity: 1 !important;
    z-index: auto !important;
  }

  .modal-backdrop.show {
    display: block !important;
  }

  .modal-dialog {
    position: static !important;
    display: block !important;
    max-width: 100% !important;
    width: 100% !important;
    max-height: none !important;
    height: auto !important;
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    background: transparent !important;
    overflow: visible !important;
    transform: none !important;
  }

  .modal-body {
    position: static !important;
    display: block !important;
    padding: 0 !important;
    margin: 0 !important;
    max-height: none !important;
    height: auto !important;
    overflow: visible !important;
    background: transparent !important;
  }

  /* Document Container Layout */
  .printable-document,
  #printContainer {
    position: static !important;
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    background: #ffffff !important;
    color: #111827 !important;
    font-size: 10.5pt !important;
    page-break-after: auto !important;
    break-after: auto !important;
  }

  /* Document Header styling in print */
  .doc-header {
    border-bottom: 2.5pt solid #1e3a8a !important;
    padding-bottom: 8pt !important;
    margin-bottom: 12pt !important;
  }

  .doc-company-name {
    font-size: 13pt !important;
    color: #1e3a8a !important;
    font-weight: 800 !important;
  }

  .doc-title-main {
    font-size: 12pt !important;
    color: #0f172a !important;
    font-weight: 700 !important;
  }

  /* Document Info Grid */
  .doc-info-grid {
    background-color: #f8fafc !important;
    border: 1pt solid #cbd5e1 !important;
    border-radius: 4pt !important;
    padding: 8pt 10pt !important;
    margin-bottom: 12pt !important;
    font-size: 9.5pt !important;
    page-break-inside: avoid !important;
    break-inside: avoid !important;
  }

  /* Document Table */
  .doc-table {
    width: 100% !important;
    border-collapse: collapse !important;
    margin-bottom: 12pt !important;
    font-size: 9.5pt !important;
    page-break-inside: auto !important;
  }

  .doc-table th {
    background-color: #f1f5f9 !important;
    color: #1e293b !important;
    border: 1pt solid #cbd5e1 !important;
    padding: 5pt 7pt !important;
    font-weight: 700 !important;
  }

  .doc-table td {
    border: 1pt solid #e2e8f0 !important;
    padding: 5pt 7pt !important;
    color: #1e293b !important;
  }

  .doc-table tr {
    page-break-inside: avoid !important;
    break-inside: avoid !important;
  }

  .doc-table tfoot td {
    background-color: #f8fafc !important;
    border-top: 2pt solid #64748b !important;
    font-weight: 700 !important;
  }

  /* Amount in words */
  .doc-amount-words {
    background-color: #f8fafc !important;
    border: 1pt dashed #94a3b8 !important;
    padding: 6pt 10pt !important;
    margin-bottom: 14pt !important;
    font-size: 9.5pt !important;
    page-break-inside: avoid !important;
    break-inside: avoid !important;
  }

  /* Signature boxes */
  .doc-signatures {
    margin-top: 14pt !important;
    padding-top: 6pt !important;
    page-break-inside: avoid !important;
    break-inside: avoid !important;
    gap: 10pt !important;
  }

  .signature-box {
    background-color: #ffffff !important;
    border: 1pt solid #cbd5e1 !important;
    padding: 8pt 6pt !important;
  }

  .signature-space {
    height: 42pt !important;
    border-bottom: 1pt dotted #94a3b8 !important;
  }

  /* Attached receipts in print */
  .printable-document img {
    max-height: 200pt !important;
    max-width: 100% !important;
    object-fit: contain !important;
    page-break-inside: avoid !important;
    break-inside: avoid !important;
  }
}

