/* ============================================================
   TechFix OS — Impressão de relatórios
   Layout profissional: margens, alinhamento, quebras de página,
   tipografia e espaçamento padronizados.
   ============================================================ */

#printRoot { display: none; }

/* ---------- Preview (tela) ---------- */
.report {
  font-family: Roboto, 'Segoe UI', Arial, sans-serif;
  color: #1a1a2e;
  font-size: 12px;
  line-height: 1.6;
  max-width: 210mm;
  margin: 0 auto;
  padding: 20px 24px;
}

/* ---------- Impressão ---------- */
@media print {
  body { background: #fff !important; }
  body.printing .app,
  body.printing .scrim,
  body.printing .snack-wrap,
  body.printing .dialog-overlay,
  body.printing #dialogRoot { display: none !important; }
  body.printing #printRoot { display: block !important; }

  @page {
    size: A4;
    margin: 18mm 16mm 20mm 16mm;
  }

  .report {
    padding: 0;
    max-width: none;
    font-size: 11px;
  }

  /* Evita quebras dentro de blocos importantes */
  .report__head,
  .report__grid,
  .report__block,
  .report__totals,
  .report__sign {
    break-inside: avoid;
  }

  /* Reserva espaço para assinaturas na última página */
  .report__sign {
    page-break-inside: avoid;
  }
}

/* ---------- Cabeçalho ---------- */
.report__head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  border-bottom: 3px solid #FF8C00;
  padding-bottom: 14px;
  margin-bottom: 20px;
}

.report__head h1 {
  font-size: 20px;
  font-weight: 700;
  margin: 0;
  color: #111;
  line-height: 1.3;
}

.report__head p {
  margin: 4px 0 0;
  color: #555;
  font-size: 10.5px;
  line-height: 1.5;
}

/* ---------- Logo ---------- */
.report__logo {
  width: 52px;
  height: 52px;
  border-radius: 10px;
  flex-shrink: 0;
  background: #FF8C00;
  color: #1a1200;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 19px;
}

.report__logo--img {
  background: #fff;
  padding: 3px;
  border: 1px solid #eee;
}

.report__logo--img img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 6px;
}

/* ---------- Meta (gerado em...) ---------- */
.report__meta {
  text-align: right;
  font-size: 9.5px;
  color: #666;
  line-height: 1.5;
}

/* ---------- Título do documento ---------- */
.report__title {
  font-size: 15px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin: 0 0 4px;
  color: #111;
  font-weight: 700;
}

.report__period {
  color: #555;
  margin: 0 0 16px;
  font-size: 11px;
}

/* ---------- Número da OS / Orçamento ---------- */
.report__osnum {
  font-size: 22px;
  font-weight: 800;
  color: #FF8C00;
  letter-spacing: 0.02em;
}

/* ---------- Status badge ---------- */
.report__status {
  display: inline-block;
  padding: 2px 12px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  color: #fff;
  background: #FF8C00;
  margin-top: 4px;
}

/* ---------- Grid 2 colunas ---------- */
.report__grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin: 0 0 16px;
}

/* ---------- Blocos de informação ---------- */
.report__block {
  border: 1px solid #dcdce3;
  border-radius: 8px;
  padding: 12px 14px;
  margin-bottom: 14px;
  background: #fafafa;
}

.report__block h4 {
  margin: 0 0 8px;
  font-size: 9.5px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #d97706;
  font-weight: 700;
  border-bottom: 1px solid #eee;
  padding-bottom: 6px;
}

.report__block p,
.report__block > div {
  margin: 0;
  line-height: 1.55;
}

.report__block ul {
  margin: 0;
  padding-left: 18px;
}

.report__block li {
  margin-bottom: 5px;
  line-height: 1.5;
}

/* Bloco largura total (fora do grid) */
.report__block--full {
  grid-column: 1 / -1;
}

/* ---------- Tabelas ---------- */
.report table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
}

.report th,
.report td {
  border: 1px solid #d2d2d8;
  padding: 7px 10px;
  text-align: left;
  vertical-align: top;
}

.report th {
  background: #f0f0f3;
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #555;
  font-weight: 700;
}

.report td.num,
.report th.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.report td.center,
.report th.center {
  text-align: center;
}

/* ---------- Totais ---------- */
.report__totals {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  margin: 18px 0;
  padding: 14px 18px;
  border: 1px dashed #c0c0c8;
  border-radius: 8px;
  background: #fcfcfc;
}

.report__totals > div {
  min-width: 100px;
}

.report__totals span {
  display: block;
  color: #666;
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 2px;
}

.report__totals b {
  font-size: 14px;
  color: #111;
  font-variant-numeric: tabular-nums;
}

/* ---------- Assinaturas ---------- */
.report__sign {
  display: flex;
  justify-content: space-between;
  margin-top: 50px;
  text-align: center;
  font-size: 11px;
  gap: 40px;
}

.report__sign > div {
  flex: 1;
}

.report__sign .line {
  border-top: 1.5px solid #2a2a30;
  margin-top: 48px;
  padding-top: 6px;
  color: #333;
  font-weight: 500;
}

.report__sign .sign-name {
  margin-top: 4px;
  font-size: 11px;
  font-weight: 600;
  color: #111;
}

/* ---------- Rodapé ---------- */
.report__foot {
  margin-top: 30px;
  font-size: 9px;
  color: #999;
  text-align: center;
  border-top: 1px solid #ddd;
  padding-top: 10px;
  line-height: 1.5;
}

/* ---------- Subtexto ---------- */
.report .sub {
  color: #666;
  font-size: 10.5px;
}

/* ---------- Seção separada ---------- */
.report__section {
  margin-top: 20px;
  padding-top: 14px;
  border-top: 1px solid #e0e0e5;
}

.report__section-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #333;
  margin: 0 0 10px;
}

/* ---------- Lista de serviços no relatório ---------- */
.report__svc-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
  margin-bottom: 10px;
}

.report__svc-table th {
  background: #f0f0f3;
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #555;
  font-weight: 700;
  padding: 6px 10px;
  text-align: left;
  border-bottom: 2px solid #d2d2d8;
}

.report__svc-table td {
  padding: 6px 10px;
  border-bottom: 1px solid #eee;
  vertical-align: top;
}

.report__svc-table tr:last-child td {
  border-bottom: none;
}

.report__svc-table .num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

/* ---------- Info row (dentro de blocos) ---------- */
.report__info-row {
  display: flex;
  gap: 6px;
  margin-bottom: 3px;
  font-size: 11px;
}

.report__info-row .label {
  color: #666;
  min-width: 80px;
  flex-shrink: 0;
}

/* ---------- Venda / Histórico ---------- */
.report__meta-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 20px;
  margin: 12px 0;
  font-size: 11px;
}

.report__meta-grid b {
  color: #333;
}

/* ---------- Reforço de impressão ---------- */
@media print {
  .report__block {
    background: #fff;
    border-color: #ccc;
  }

  .report__totals {
    background: #fff;
  }

  .report__svc-table th {
    background: #f0f0f3 !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .report__status {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .report__logo {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .report__head {
    border-bottom-color: #FF8C00 !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
}
