/* ==========================================================================
   SIGAP Vijes - print.css
   Report sheet styles (screen preview) and print rules. Printing hides the
   sidebar, top bar, buttons and filters, and keeps headers, tables and
   charts. Page numbers are added where the browser supports margin boxes.
   ========================================================================== */

/* ---------------------------- Report sheet ------------------------------ */
.rep-sheet { background: #fff; color: #111; border: 1px solid var(--line); border-radius: 4px; box-shadow: var(--shadow-1); padding: 30px 34px 26px; max-width: 1060px; margin: 0 auto; }
.rep-head { display: flex; justify-content: space-between; gap: 20px; align-items: flex-start; padding-bottom: 12px; border-bottom: 3px solid var(--navy); margin-bottom: 12px; }
.rep-brand { display: flex; gap: 12px; align-items: center; }
.rep-logo { width: 54px; height: 54px; object-fit: contain; }
.rep-app { font-family: var(--font-head); font-size: 21px; font-weight: 700; color: var(--navy); line-height: 1.1; }
.rep-app-sub { font-size: 12px; color: #333; line-height: 1.35; }
.rep-meta { text-align: right; max-width: 52%; }
.rep-title { font-family: var(--font-head); font-size: 19px; font-weight: 700; line-height: 1.2; }
.rep-subtitle { font-size: 13.5px; font-weight: 600; margin-top: 2px; }
.rep-date { font-size: 11.5px; color: #444; margin-top: 4px; }
.rep-filters { display: flex; flex-wrap: wrap; gap: 4px 18px; font-size: 12.5px; padding: 7px 10px; background: #f3f5f8; border-radius: 4px; margin-bottom: 14px; }
.rep-section { margin-bottom: 18px; }
.rep-h2 { font-family: var(--font-head); font-size: 15.5px; font-weight: 700; color: var(--navy); border-bottom: 1px solid #c9d2dc; padding-bottom: 3px; margin-bottom: 9px; }
.rep-h3 { font-family: var(--font-head); font-size: 13.5px; font-weight: 700; margin: 10px 0 5px; }
.rep-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; margin-bottom: 12px; }
.rep-stat { border: 1px solid #cfd7e0; border-radius: 5px; padding: 7px 10px; background: #fff; }
.rep-stat-label { font-size: 11.5px; color: #444; font-weight: 600; }
.rep-stat-value { font-family: var(--font-head); font-size: 18px; font-weight: 700; line-height: 1.25; }
.rep-stat-sub { font-size: 11px; color: #555; }
.rep-sheet .table { font-size: 12px; }
.rep-sheet .table th { background: #eef1f5; color: #111; position: static; padding: 5px 8px; border-bottom: 1px solid #9aa6b4; }
.rep-sheet .table td { padding: 4px 8px; border-bottom: 1px solid #dfe4ea; }
.rep-sheet .table tfoot td { background: #eef1f5; border-top: 1px solid #9aa6b4; }
.rep-sheet .dl dt { font-size: 11px; }
.rep-sheet .dl dd { font-size: 12.5px; }
.rep-sheet .card { box-shadow: none; }
.rep-sheet p { margin-bottom: 8px; }
.rep-notes { font-size: 11.5px; color: #444; margin-top: 8px; }
.rep-signs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 36px; margin-top: 54px; break-inside: avoid; }
.rep-sign-line { border-top: 1px solid #222; margin-bottom: 4px; }
.rep-sign-role { font-size: 11.5px; color: #444; }
.rep-sign-name { font-weight: 700; font-size: 12.5px; min-height: 16px; }
.rep-sign-cargo { font-size: 11.5px; }
.rep-foot { margin-top: 20px; padding-top: 6px; border-top: 1px solid #c9d2dc; font-size: 10.5px; color: #555; text-align: center; }
.rep-cols { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.rep-text { font-size: 12.5px; }

.print-header { display: none; }
#print-overlay { position: fixed; inset: 0; z-index: 250; background: #5b6676; display: flex; flex-direction: column; }
.print-bar { display: flex; align-items: center; gap: 14px; padding: 10px 18px; background: #fff; border-bottom: 1px solid var(--line); flex: none; flex-wrap: wrap; }
.print-bar .muted { flex: 1; font-size: 12.5px; }
.print-bar-actions { display: flex; gap: 8px; }
.print-scroll { flex: 1; overflow: auto; padding: 22px 16px 40px; }

/* ------------------------------- Print ---------------------------------- */
@page {
  size: letter;
  margin: 14mm 13mm 16mm;
  @bottom-right { content: "Página " counter(page) " de " counter(pages); font-size: 9pt; color: #444; font-family: "Segoe UI", Arial, sans-serif; }
  @bottom-left { content: "SIGAP Vijes"; font-size: 9pt; color: #444; font-family: "Segoe UI", Arial, sans-serif; }
}

/* On-screen lists are wide: print them in landscape (named page). */
@page lista {
  size: letter landscape;
  margin: 12mm 12mm 15mm;
}

@media print {
  .page:has(.table-main) { page: lista; }
  html, body { height: auto !important; background: #fff !important; overflow: visible !important; }
  body { font-size: 11pt; }
  .no-print, .sidebar, .topbar, .sidebar-scrim, #toast-root, .modal-overlay, .popmenu, .chart-tip,
  .page-actions, .page-toolbar, .list-toolbar, .filter-panel, .pager, .card-actions, .tabs, .col-actions, .record-meta { display: none !important; }
  #app, .shell, .main, .view { display: block !important; height: auto !important; overflow: visible !important; padding: 0 !important; }
  .shell { position: static !important; }
  .page { max-width: none; }
  .print-header { display: block; }
  .page-head { display: none !important; }
  .card, .list-card, .kpi { box-shadow: none !important; }
  .card, .kpi { break-inside: avoid; }
  /* Indicator bands were laid out for the screen width: on paper each cell
     gets its own hairline and the band flows in as many rows as needed. */
  .grid-kpi { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)) !important; gap: 0 !important; background: #fff !important; border-color: #cfd7e0 !important; }
  .grid-kpi > .kpi { border: 0.5pt solid #dfe4ea; margin: -0.25pt; padding: 9px 12px; }
  .kpi-fill, .kpi-go { display: none !important; }
  .kpi-value { font-size: 20pt; }
  .kpi-value.is-zero, .kpi-value.is-none, .kpi-unit { color: #333 !important; }
  .panel-row > .card { flex-basis: 100% !important; }
  .hero-value { font-size: 30pt; }
  .rep-sheet .card-body > .table-wrap { margin: 0 !important; }
  .list-card, .card:has(.table-wrap) { break-inside: auto; border: 0 !important; }
  .rep-sheet { border: 0; box-shadow: none; padding: 0; max-width: none; margin: 0; }
  .rep-section.rep-keep, .rep-stats, .rep-stat, .chart-block, .donut, figure { break-inside: avoid; }
  .rep-h2, .rep-h3 { break-after: avoid; }
  .table-wrap { overflow: visible !important; }
  /* Wide on-screen lists must fit the sheet: let cells wrap and shrink type. */
  .table-main { width: 100% !important; font-size: 8pt; }
  .table-main th, .table-main td { white-space: normal !important; max-width: none !important; overflow: visible !important; text-overflow: clip !important; padding: 3px 4px !important; position: static !important; overflow-wrap: break-word; }
  .table-main .badge, .table-main .demo-tag { font-size: 7pt; padding: 0 4px; white-space: nowrap; }
  .table thead { display: table-header-group; }
  .table tr { break-inside: avoid; }
  a { color: inherit !important; text-decoration: none !important; }
  .badge { border: 1px solid #777 !important; background: #fff !important; color: #111 !important; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }

  body.has-print-overlay #app { display: none !important; }
  #print-overlay { position: static !important; display: block !important; background: #fff !important; }
  .print-scroll { overflow: visible !important; padding: 0 !important; }
}

/* IAP liquidation inside a printed support sheet */
.rep-sheet .iap-ledger { font-size: 12px; }
.rep-sheet .iap-ledger td { padding: 4px 0; border-bottom-color: #dfe4ea; }
.rep-sheet .iap-step-detail { font-size: 11px; color: #444; }
.rep-sheet .iap-ledger tfoot td { font-size: 13.5px; border-top-color: #111; }
.rep-sheet .iap-compare { background: #fff !important; border-color: #777 !important; padding: 8px 10px 2px; margin-top: 0; }
.rep-sheet .iap-compare-grid strong { font-size: 14px; }
.rep-sheet ul.rep-text { margin: 4px 0 8px; padding-left: 18px; }
