/* Relatório mensal em A4 (claro, para imprimir e mandar ao cliente). */
.envolve-a4 { width: 100%; overflow: hidden; }
.folha-a4 { --cor: #2563EB; width: 210mm; min-height: 297mm; margin: 14px auto 30px; background: #fff; color: #0F172A; padding: 14mm 14mm 12mm; box-shadow: 0 10px 40px -15px rgba(0, 0, 0, .35);
  font-family: 'Plus Jakarta Sans', -apple-system, 'Segoe UI', Roboto, sans-serif; font-size: 11.5px; line-height: 1.45; transform-origin: top left; box-sizing: border-box; }
.r-cab { display: flex; align-items: center; gap: 12px; padding-bottom: 10px; border-bottom: 3px solid var(--cor); }
.r-cab img { width: 48px; height: 48px; object-fit: contain; border-radius: 10px; }
.r-cab b { display: block; font-size: 15px; }
.r-cab span { color: #475569; font-size: 11px; }
.r-data { margin-left: auto; text-align: right; color: #475569; font-size: 10.5px; }
.r-data b { color: #0F172A; font-size: 13px; }
.folha-a4 h1 { font-size: 22px; margin: 14px 0 2px; color: #0F172A; line-height: 1.2; }
.r-sub { color: #475569; margin: 0 0 12px; }
.r-kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 0 0 12px; }
.r-kpis div { border: 1px solid #E2E8F0; border-radius: 10px; padding: 9px 10px; border-top: 3px solid var(--cor); }
.r-kpis b { display: block; font-size: 19px; font-weight: 800; color: var(--cor); white-space: nowrap; }
.r-kpis span { color: #475569; font-size: 10.5px; }
.r-kpis .r-k-er { border-top-color: #DC2626; } .r-kpis .r-k-er b { color: #DC2626; }
.r-txt { margin: 0 0 10px; font-size: 12px; }
.r-proj { border: 1px solid #FECACA; background: #FEF2F2; border-radius: 10px; padding: 9px 11px; margin: 0 0 6px; }
.r-proj b { display: block; color: #991B1B; font-size: 12px; } .r-proj span { color: #7F1D1D; font-size: 10.5px; }
.folha-a4 h2 { font-size: 12.5px; margin: 14px 0 6px; color: var(--cor); text-transform: uppercase; letter-spacing: .04em; }
.r-tab { width: 100%; border-collapse: collapse; font-size: 10.5px; }
.r-tab th { text-align: left; background: #F1F5F9; color: #334155; padding: 5px 6px; font-weight: 700; }
.r-tab td { padding: 5px 6px; border-bottom: 1px solid #E2E8F0; vertical-align: top; }
.r-tab .n { text-align: right; white-space: nowrap; }
.r-tab td small { color: #64748B; }
.r-prob tr.erro td:first-child { border-left: 3px solid #DC2626; } .r-prob tr.atencao td:first-child { border-left: 3px solid #D97706; }
.r-em { color: #B91C1C; font-weight: 700; } .r-ce { color: #047857; font-weight: 700; }
.r-mais { color: #0E7490 !important; font-weight: 700; } .r-menos { color: #B91C1C !important; font-weight: 700; }
p.r-mais { color: #64748B !important; font-weight: 400; font-size: 10px; margin: 3px 0 0; }
.r-st { font-weight: 700; } .r-st.ok { color: #047857; } .r-st.atencao { color: #B45309; } .r-st.erro { color: #B91C1C; }
.r-evo { display: flex; align-items: flex-end; gap: 14px; flex-wrap: wrap; }
.r-evo div { display: flex; flex-direction: column; align-items: center; gap: 2px; width: 44px; }
.r-evo i { display: flex; flex-direction: column; justify-content: flex-start; width: 26px; background: #D1FAE5; border-radius: 5px 5px 2px 2px; overflow: hidden; }
.r-evo u { display: block; background: #F87171; width: 100%; }
.r-evo b { font-size: 11px; color: #B91C1C; } .r-evo span { font-size: 10px; color: #475569; }
.r-evo .atual span { color: var(--cor); font-weight: 800; }
.r-evo p { width: 100%; margin: 2px 0 0; color: #64748B; font-size: 10px; }
.r-rod { margin-top: 16px; padding-top: 8px; border-top: 1px solid #E2E8F0; color: #475569; font-size: 10px; }
.r-rod p { margin: 2px 0; }
.r-cel { display: none; }
/* no celular o relatório vira página normal (legível); o A4 fica para a impressão/PDF */
@media screen and (max-width: 800px) {
  .folha-a4 { width: auto; min-height: 0; margin: 0; box-shadow: none; padding: 18px 16px 28px; font-size: 13.5px; }
  .r-cab { flex-wrap: wrap; } .r-cab img { width: 42px; height: 42px; }
  .r-data { margin-left: 0; width: 100%; text-align: left; display: flex; gap: 6px; align-items: baseline; font-size: 12px; } .r-data br { display: none; }
  .folha-a4 h1 { font-size: 22px; }
  .r-kpis { grid-template-columns: 1fr 1fr; } .r-kpis b { font-size: 21px; } .r-kpis span { font-size: 12px; }
  .r-txt { font-size: 14px; } .r-proj b { font-size: 13.5px; } .r-proj span { font-size: 12px; }
  .folha-a4 h2 { font-size: 13px; margin-top: 20px; }
  .r-tab { font-size: 12.5px; }
  .r-prob, .r-prob tbody, .r-prob tr, .r-prob td { display: block; width: auto; }
  .r-prob tr:first-child { display: none; }
  .r-prob tr { border: 1px solid #E2E8F0; border-radius: 10px; margin-bottom: 8px; padding: 6px 4px; }
  .r-prob td { border: 0; padding: 3px 8px; text-align: left !important; white-space: normal !important; }
  .r-prob tr.erro td:first-child, .r-prob tr.atencao td:first-child { border-left: 0; }
  .r-prob tr.erro { border-left: 4px solid #DC2626; } .r-prob tr.atencao { border-left: 4px solid #D97706; }
  .r-prob td.n { display: inline-block; font-size: 12px; } .r-prob td.n br { display: none; }
  .r-tab:not(.r-prob) th:nth-child(2), .r-tab:not(.r-prob) td:nth-child(2), .r-tab:not(.r-prob) th:nth-child(3), .r-tab:not(.r-prob) td:nth-child(3) { display: none; }
  .r-cel { display: inline; }
  .r-rod { font-size: 11.5px; }
}
@media print {
  @page { size: A4; margin: 10mm 0; }
  .folha-a4 { margin: 0; box-shadow: none; zoom: 1 !important; width: auto; min-height: 0; padding: 0 14mm; }
  .r-tab tr { break-inside: avoid; }
}
