@page {
  size: A4 portrait;
  margin: 12mm;
  @bottom-center {
    content: counter(page) "/" counter(pages);
    color: #596579;
    font: 7.5pt Arial, sans-serif;
  }
}
@page report-standard {
  size: A4 portrait;
  margin: 12mm;
  @bottom-center { content: counter(page) "/" counter(pages); color: #596579; font: 7.5pt Arial, sans-serif; }
}
@page report-full {
  size: A4 portrait;
  margin: 12mm;
  @bottom-center { content: counter(page) "/" counter(pages); color: #596579; font: 7.5pt Arial, sans-serif; }
}
@page ibc-standard {
  size: A4 landscape;
  margin: 9mm;
  @bottom-center { content: counter(page) "/" counter(pages); color: #596579; font: 7.5pt Arial, sans-serif; }
}
@page ibc-full {
  size: A4 landscape;
  margin: 9mm;
  @bottom-center { content: counter(page) "/" counter(pages); color: #596579; font: 7.5pt Arial, sans-serif; }
}
* { box-sizing: border-box; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
body { margin: 0; color: #111827; background: #fff; font: 10pt Arial, sans-serif; }
.report-sheet { width: 100%; }
.report-page-layout { width: 100%; border-collapse: collapse; table-layout: fixed; }
.report-page-layout > thead { display: table-header-group; }
.report-page-layout > tbody { display: table-row-group; }
.report-page-layout > thead > tr > td, .report-page-layout > tbody > tr > td { padding: 0; border: 0; vertical-align: top; }
.report-repeat-header { width: 100%; padding-bottom: 14px; background: #fff; }
.report-repeat-content { width: 100%; }
.report-repeat-header .report-header, .report-repeat-header .report-full-header { margin-bottom: 0; }
.report-header { display: flex; min-height: 120px; margin-bottom: 14px; border: 1.5px solid #111; break-inside: avoid; }

.report-full-header { width: 100%; margin: 0 0 8px; break-inside: avoid; }
.report-full-header img { display: block; width: 100%; max-height: 42mm; object-fit: contain; object-position: left center; }
.report-full-title { margin: 5px 0 14px; font-size: 12pt; font-weight: 700; text-align: center; text-transform: uppercase; break-inside: avoid; }
.report-logo { width: 118px; flex: 0 0 118px; display: grid; place-items: center; padding: 8px; border-right: 1px solid #111; }
.report-logo img { max-height: 104px; object-fit: contain; }
.report-header-copy { flex: 1; display: grid; grid-template-rows: 1.1fr .9fr 1fr; }
.report-line-1, .report-line-2 { display: grid; place-items: center; padding: 6px 10px; border-bottom: 1px solid #111; font-weight: 700; text-align: center; }
.report-line-1 { font-size: 13pt; }.report-line-2 { font-size: 11pt; }
.report-line-3 { display: grid; grid-template-columns: 1.4fr 1fr 1fr; }
.report-line-3 > div { display: grid; place-items: center; min-height: 36px; padding: 4px 8px; border-right: 1px solid #111; text-align: center; font-size: 8.5pt; font-weight: 700; }
.report-line-3 > div:last-child { border-right: 0; }
.report-table { width: 100%; border-collapse: collapse; }
.report-table thead { display: table-header-group; }
.report-table tr { break-inside: avoid; }
.report-table th, .report-table td { padding: 6px 7px; border: 0; border-bottom: 1px solid #e0e6ed; text-align: left; }
.report-table th { background: #1d3a5d; color: #fff; font-size: 8pt; text-transform: uppercase; }
.report-summary { display: flex; justify-content: flex-end; margin-top: 10px; break-inside: avoid; font-weight: 700; }
.report-signatures { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 26px; margin-top: 52px; break-inside: avoid; }
.signature { text-align: center; }.signature span { display: block; border-top: 1px solid #111; }.signature strong, .signature small { display: block; margin-top: 4px; }.signature small { font-size: 8pt; }
.print-frame { position: fixed; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
@media screen { body { padding: 18px; background: #e9eef5; }.report-sheet { max-width: 210mm; min-height: 297mm; margin: auto; padding: 12mm; background: #fff; box-shadow: 0 10px 35px rgba(0,0,0,.14); } }

/* IBC dynamic control report */
@page ibc-landscape {
  size: A4 landscape;
  margin: 9mm;
  @bottom-center {
    content: counter(page) "/" counter(pages);
    color: #596579;
    font: 7.5pt Arial, sans-serif;
  }
}
.ibc-control-report { page: ibc-landscape; }
.report-page-standard { page: report-standard; }
.report-page-full { page: report-full; }
.ibc-control-report.ibc-page-standard { page: ibc-standard; }
.ibc-control-report.ibc-page-full { page: ibc-full; }
.ibc-report-table { width: 100%; border-collapse: collapse; table-layout: fixed; }
.ibc-report-table thead { display: table-header-group; }
.ibc-report-table th { padding: 6px 4px; border: 0; background: #1d3a5d; color: #fff; font-size: 7.2pt; line-height: 1.12; text-align: center; text-transform: uppercase; white-space: normal; }
.ibc-report-table .ibc-report-groups th { padding-bottom: 5px; border-bottom: 1px solid #fff; background: #1d3a5d; color: #fff; font-size: 7.5pt; text-align: center; }
.ibc-report-groups th + th { border-left: 2px solid #fff; }
.ibc-report-table td { padding: 6px 5px; border: 0; vertical-align: middle; font-size: 8pt; text-align: center; }
.ibc-col-entry-date, .ibc-col-return-date { width: 10%; }
.ibc-col-entry-invoice, .ibc-col-return-invoice { width: 8%; }
.ibc-col-supplier { width: 34%; }
.ibc-col-entry-qty, .ibc-col-return-qty, .ibc-col-balance { width: 7%; }
.ibc-col-status { width: 9%; }
.ibc-report-table .ibc-supplier { text-align: left; white-space: nowrap; }
.ibc-report-group { break-inside: avoid; }
.ibc-report-group + .ibc-report-group .ibc-report-entry-start > td { border-top: 1px solid rgba(77, 96, 123, .18); }
.ibc-return-row > td { border-top: 0; }
.ibc-report-totals { break-inside: avoid; page-break-inside: avoid; }
.ibc-report-totals tr { break-inside: avoid; page-break-inside: avoid; }
.ibc-report-totals td { padding-top: 7px; border-top: 1px solid rgba(77, 96, 123, .28); background: #f8fafc; }
.ibc-print-status { font-weight: 700; }.ibc-status-done { color: #16803a; }.ibc-status-partial { color: #c56a00; }.ibc-status-pending { color: #164985; }
.ibc-balance { font-weight: 700; }
@media screen { .ibc-control-report { max-width: 297mm; min-height: 210mm; } }

/* Automatic standard header: no line-by-line configuration */
.report-header-standard .report-header-copy { display: flex; flex-direction: column; min-width: 0; }
.report-company-name { flex: 1; display: grid; place-items: center; padding: 8px 12px; border-bottom: 1px solid #111; font-size: 13pt; font-weight: 800; text-align: center; }
.report-auto-title { display: grid; place-items: center; min-height: 34px; padding: 6px 12px; border-bottom: 1px solid #111; font-size: 10.5pt; font-weight: 800; text-align: center; text-transform: uppercase; }
.report-auto-meta { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 5px 18px; min-height: 30px; padding: 5px 10px; font-size: 7.8pt; font-weight: 700; text-align: center; }
.report-logo img { max-width: 100%; }

/* Saída de material */
.materials-output-report { font-size: 9.5pt; }
.materials-output-title { margin: 12px 0 18px; font-size: 13pt; font-weight: 800; text-align: center; text-decoration: underline; text-underline-offset: 3px; text-transform: uppercase; break-inside: avoid; }
.materials-output-table { width: 100%; border-collapse: collapse; table-layout: fixed; }
.materials-output-table thead { display: table-header-group; }
.materials-output-table tr { break-inside: avoid; }
.materials-output-table th, .materials-output-table td { padding: 7px 8px; border: 1px solid #aeb8c5; }
.materials-output-table th { background: #1d3a5d; color: #fff; font-size: 8pt; text-align: center; text-transform: uppercase; }
.materials-output-table th:first-child, .materials-output-table td:first-child { width: 58%; text-align: left; }
.materials-output-table th:nth-child(2), .materials-output-table td:nth-child(2) { width: 10%; text-align: center; }
.materials-output-table th:nth-child(3), .materials-output-table td:nth-child(3), .materials-output-table th:nth-child(4), .materials-output-table td:nth-child(4) { width: 16%; text-align: center; }
.materials-output-grand-total { display: flex; justify-content: flex-end; gap: 18px; margin-top: 10px; padding: 4px 0; border: 0; background: transparent; font-size: 9pt; break-inside: avoid; }
.materials-output-grand-total span { font-weight: 700; text-transform: uppercase; }
.materials-output-grand-total strong { min-width: 95px; text-align: right; }
.materials-output-observation { display: flex; align-items: stretch; width: fit-content; max-width: 92%; margin: 34px auto 0; border: 1px solid #111; text-align: center; text-transform: uppercase; white-space: nowrap; break-inside: avoid; font-size: var(--observation-font-size, 11pt); }
.materials-output-observation span { display: grid; place-items: center; padding: 3px 7px; background: #111; color: #fff; font-size: .72em; font-weight: 800; }
.materials-output-observation strong { display: block; min-width: 120px; padding: 3px 12px; }
.materials-output-signatures { display: grid; grid-template-columns: 1fr; gap: 60px; width: min(80%, 160mm); margin: 60px auto 0; text-align: center; break-inside: avoid; }
.materials-output-signatures .signature { width: 100%; text-align: center; }
.materials-output-signatures .signature span { display: block; width: 100%; border-top: 1px solid #111; }
.materials-output-signatures .signature strong, .materials-output-signatures .signature small { display: block; margin-top: 6px; }
.materials-output-signatures .signature strong { font-size: 12.5pt; font-weight: 800; letter-spacing: .2px; }
.materials-output-signatures .signature small { font-size: 10pt; font-weight: 700; }
.materials-output-date { margin-top: 34px; font-size: 12pt; font-weight: 800; text-align: center; break-inside: avoid; }
