/* ==========================================================================
   Relatórios Orçamentários e Boletins de Medição - Construtec Centro de Custos
   Executivo Interno e Saída Comercial para Cliente (Folha A4 / Impressão / PDF)
   ========================================================================== */

.budget-report-backdrop {
  position: fixed;
  inset: 0;
  background-color: rgba(15, 23, 42, 0.75);
  backdrop-filter: blur(4px);
  z-index: 9999;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 24px 16px;
  overflow-y: auto;
}

.budget-report-modal {
  background: #ffffff;
  border-radius: 12px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  overflow: hidden;
  color: #1e293b;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* Barra de Ações Superior */
.budget-report-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 24px;
  background: #0f172a;
  color: #f8fafc;
  border-bottom: 1px solid #334155;
}

.budget-report-toolbar .toolbar-title strong { display: block; font-size: 1.05rem; letter-spacing: -0.01em; }
.budget-report-toolbar .toolbar-title span { font-size: 0.82rem; color: #94a3b8; }
.budget-report-toolbar .toolbar-actions { display: flex; align-items: center; gap: 10px; }

.budget-report-toolbar .icon-btn {
  background: transparent;
  border: 1px solid #475569;
  color: #cbd5e1;
  font-size: 1.4rem;
  line-height: 1;
  width: 34px;
  height: 34px;
  border-radius: 6px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.budget-report-toolbar .icon-btn:hover { background: #334155; color: #ffffff; }

/* Folha A4 / Corpo do Relatório */
.budget-report-sheet {
  padding: 36px 44px;
  background: #ffffff;
  color: #1e293b;
  font-size: 0.84rem;
  line-height: 1.5;
}

/* Cabeçalho da Empresa */
.sheet-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding-bottom: 18px;
  border-bottom: 2px solid #0284c7;
  margin-bottom: 20px;
}

.company-brand h1 { font-size: 1.2rem; font-weight: 800; color: #0f172a; margin: 0 0 3px 0; letter-spacing: -0.02em; }
.company-brand p { margin: 2px 0; font-size: 0.76rem; color: #64748b; }
.report-meta { text-align: right; }
.report-meta h2 { font-size: 0.95rem; font-weight: 700; color: #0369a1; margin: 0 0 5px 0; text-transform: uppercase; letter-spacing: 0.04em; }
.report-meta .meta-row { font-size: 0.76rem; color: #475569; margin-bottom: 2px; }

/* Seções e Grids */
.sheet-section { margin-bottom: 24px; break-inside: avoid; }
.section-title {
  font-size: 0.92rem;
  font-weight: 700;
  color: #0f172a;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin: 0 0 10px 0;
  padding-bottom: 4px;
  border-bottom: 1px solid #e2e8f0;
}

.info-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px 20px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 12px 16px;
  font-size: 0.82rem;
}
.info-grid span { color: #64748b; margin-right: 6px; }
.info-grid strong { color: #0f172a; }

/* KPIs */
.report-kpi-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.report-kpi-box {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
}
.report-kpi-box span { font-size: 0.7rem; text-transform: uppercase; color: #64748b; font-weight: 600; margin-bottom: 3px; }
.report-kpi-box strong { font-size: 1.1rem; font-weight: 800; color: #0f172a; }
.report-kpi-box.highlight { border-color: #bae6fd; background: #f0f9ff; }
.report-kpi-box.highlight strong { color: #0284c7; }
.report-kpi-box.good { border-color: #a7f3d0; background: #ecfdf5; }
.report-kpi-box.good strong { color: #059669; }
.report-kpi-box.danger { border-color: #fecaca; background: #fef2f2; }
.report-kpi-box.danger strong { color: #dc2626; }

/* Tabelas de Relatório */
.report-table { width: 100%; border-collapse: collapse; font-size: 0.8rem; margin-top: 6px; }
.report-table th {
  background: #f1f5f9;
  color: #334155;
  font-weight: 700;
  text-align: left;
  padding: 7px 10px;
  border-top: 1px solid #cbd5e1;
  border-bottom: 2px solid #94a3b8;
  font-size: 0.72rem;
  text-transform: uppercase;
}
.report-table td { padding: 6px 10px; border-bottom: 1px solid #e2e8f0; color: #334155; }
.report-table tr:nth-child(even) td { background: #fafafa; }
.code-cell { font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; font-size: 0.74rem; color: #64748b; }

/* Badges Curva ABC */
.abc-badge { display: inline-block; padding: 2px 7px; border-radius: 4px; font-size: 0.72rem; font-weight: 700; text-align: center; }
.abc-badge.a { background: #fee2e2; color: #b91c1c; border: 1px solid #fca5a5; }
.abc-badge.b { background: #fef3c7; color: #b45309; border: 1px solid #fde68a; }
.abc-badge.c { background: #e0e7ff; color: #4338ca; border: 1px solid #c7d2fe; }

/* Status e Cores de Texto */
.danger-text { color: #dc2626 !important; font-weight: 600; }
.active-text { color: #0284c7 !important; font-weight: 600; }
.muted-text { color: #64748b !important; }

/* Quadro de Assinaturas Técnicas (Saída Comercial) */
.client-signature-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 40px;
  margin-top: 40px;
  padding-top: 10px;
}

.signature-box { text-align: center; }
.signature-line {
  border-bottom: 1px solid #475569;
  width: 80%;
  margin: 0 auto 8px auto;
}
.signature-box strong { display: block; font-size: 0.85rem; color: #0f172a; }
.signature-box p { margin: 2px 0; font-size: 0.78rem; color: #475569; }
.signature-box span { display: block; font-size: 0.72rem; text-transform: uppercase; color: #64748b; font-weight: 600; }

/* Rodapé */
.sheet-footer {
  margin-top: 30px;
  padding-top: 14px;
  border-top: 1px solid #cbd5e1;
  text-align: center;
  font-size: 0.72rem;
  color: #64748b;
}
.sheet-footer p { margin: 2px 0; }

/* Impressão / PDF */
@media print {
  body * { visibility: hidden !important; }
  .budget-report-backdrop,
  .budget-report-modal,
  .budget-report-sheet,
  .budget-report-sheet * { visibility: visible !important; }
  .budget-report-backdrop { position: static !important; background: transparent !important; padding: 0 !important; overflow: visible !important; }
  .budget-report-modal { box-shadow: none !important; border: none !important; max-width: 100% !important; }
  .budget-report-sheet { padding: 0 !important; }
  .no-print { display: none !important; }
  @page { size: A4 portrait; margin: 12mm 15mm; }
}
