@page {
  size: A4;
  margin: 10mm;
}

:root {
  --ink: #111;
  --line: #222;
  --blue: #5a6fc4;
  --blue-deep: #3d4f9a;
  --soft: #eef1fb;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  font-family: Arial, Helvetica, sans-serif;
  color: var(--ink);
  background: #dde3f5;
}

.toolbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: end;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  background: var(--blue-deep);
  color: #f4f6ff;
}

.toolbar-search,
.toolbar-actions {
  display: flex;
  gap: 0.45rem;
  align-items: end;
}

.toolbar-search label {
  display: block;
  font-size: 0.72rem;
  margin-bottom: 0.2rem;
  color: #c8d0f5;
}

.toolbar-search input {
  width: 140px;
  padding: 0.4rem 0.5rem;
  border: 1px solid #8fa0e0;
  border-radius: 3px;
  background: #6a7ed0;
  color: #fff;
}

.tool-btn {
  border: 1px solid #8fa0e0;
  background: #6a7ed0;
  color: #f4f6ff;
  padding: 0.42rem 0.75rem;
  border-radius: 3px;
  text-decoration: none;
  cursor: pointer;
  font: inherit;
  font-size: 0.86rem;
}

.tool-btn.primary {
  background: var(--blue);
  border-color: #4d62b8;
}

.erro,
.vazio {
  max-width: 210mm;
  margin: 0.8rem auto;
  padding: 0.7rem 0.9rem;
}

.erro {
  background: #f8e8e4;
  border: 1px solid #d7b0a7;
  color: #7a2418;
}

.vazio {
  background: #fff;
  border: 1px solid #c5cce8;
  color: #3d4f9a;
}

.folha {
  width: 210mm;
  min-height: 297mm;
  margin: 1rem auto 2rem;
  padding: 10mm 11mm 12mm;
  background: #fff;
  box-shadow: 0 8px 28px rgba(40, 50, 110, 0.18);
  font-size: 11px;
  line-height: 1.35;
}

.cabecalho {
  display: grid;
  grid-template-columns: 1fr 168px;
  gap: 0.8rem;
  border-bottom: 2px solid var(--blue);
  padding-bottom: 0.55rem;
  margin-bottom: 0.7rem;
}

.empresa {
  display: grid;
  grid-template-columns: 150px 1fr;
  gap: 0.75rem;
  align-items: start;
}

.logo-img {
  width: 150px;
  height: auto;
  max-height: 78px;
  object-fit: contain;
  object-position: left center;
  display: block;
}

.empresa-dados p {
  margin: 0;
  font-size: 10.5px;
}

.empresa-nome {
  font-weight: 700;
  font-size: 12px !important;
  color: #2e2a4f;
}

.proposta-meta {
  border: 1.5px solid var(--line);
  padding: 0.4rem 0.5rem;
  background: var(--soft);
}

.doc-titulo {
  margin: 0 0 0.3rem;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--blue-deep);
}

.meta-linha {
  display: grid;
  grid-template-columns: 52px 1fr;
  gap: 0.25rem;
  align-items: baseline;
  margin-bottom: 0.15rem;
}

.meta-linha span {
  font-size: 10px;
  font-weight: 700;
  color: var(--blue-deep);
}

.meta-linha strong {
  font-size: 14px;
}

.bloco {
  border: 1px solid var(--line);
  padding: 0.4rem 0.55rem 0.5rem;
  margin-bottom: 0.55rem;
  background: #f7f8ff;
}

.titulo-secao {
  margin: 0 0 0.3rem;
  font-size: 11px;
  font-weight: 700;
  color: var(--blue-deep);
  text-transform: uppercase;
}

.dados-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.18rem 0.8rem;
}

.dado {
  display: grid;
  grid-template-columns: 108px 1fr;
  gap: 0.25rem;
}

.dado.largo {
  grid-column: 1 / -1;
}

.dado span {
  font-weight: 700;
  color: #333;
}

.dado strong {
  font-weight: 600;
  white-space: pre-wrap;
}

.tabela-itens {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 0.55rem;
}

.tabela-itens th,
.tabela-itens td {
  border: 1px solid #222;
  padding: 0.28rem 0.3rem;
  vertical-align: top;
  text-align: left;
}

.tabela-itens th {
  background: var(--blue);
  color: #fff;
  font-size: 10px;
}

.col-item { width: 28px; text-align: center; }
.col-mat { width: 92px; }
.col-un { width: 36px; }
.col-qtd { width: 42px; text-align: right; }
.col-val { width: 62px; text-align: right; }

.tabela-itens td.num {
  text-align: right;
  white-space: nowrap;
}

.totais {
  display: flex;
  justify-content: flex-end;
  gap: 0.4rem;
  margin-bottom: 0.7rem;
}

.tot-box {
  min-width: 92px;
  border: 1px solid var(--line);
  padding: 0.3rem 0.45rem;
  background: var(--soft);
  text-align: right;
}

.tot-box span {
  display: block;
  font-size: 10px;
  font-weight: 700;
  color: var(--blue-deep);
}

.tot-box strong {
  font-size: 13px;
}

.tot-box.destaque {
  background: #dfe6ff;
}

.obs p {
  margin: 0;
  white-space: pre-wrap;
}

.rodape {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.4rem;
  margin-top: 1.2rem;
}

.assinatura {
  text-align: center;
}

.assinatura span {
  display: block;
  margin-bottom: 1.5rem;
  font-weight: 700;
}

.assinatura strong {
  display: block;
  border-top: 1px solid var(--line);
  padding-top: 0.25rem;
  min-height: 1.2rem;
}

@media print {
  body {
    background: #fff;
  }

  .no-print {
    display: none !important;
  }

  .folha {
    width: auto;
    min-height: auto;
    margin: 0;
    padding: 0;
    box-shadow: none;
  }

  .bloco,
  .tabela-itens th,
  .tot-box {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
}
