/* ========= Reset / base ========= */
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: "Segoe UI", Arial, sans-serif;
  background: #eceef1;
  color: #222;
}

/* ========= Toolbar (form em cima) ========= */
.toolbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: #fff;
  border-bottom: 1px solid #d6d9de;
  padding: 14px 22px;
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  align-items: center;
  box-shadow: 0 2px 6px rgba(0,0,0,.05);
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}
.brand img { width: 44px; height: 44px; object-fit: contain; }
.brand h1 {
  font-size: 16px;
  margin: 0;
  color: #1f4f2a;
}
.brand small { color: #666; font-size: 12px; }

.form {
  display: grid;
  grid-template-columns: 1.4fr 0.8fr 1fr 1fr 0.7fr;
  gap: 10px;
  flex: 1 1 600px;
  align-items: end;
}
.field { display: flex; flex-direction: column; gap: 4px; }
.field span {
  font-size: 11px;
  color: #555;
  text-transform: uppercase;
  letter-spacing: .03em;
}
.field input, .field select {
  padding: 8px 10px;
  border: 1px solid #c8cdd4;
  border-radius: 6px;
  font-size: 14px;
  background: #fff;
}
.field input:focus, .field select:focus {
  outline: none;
  border-color: #38761d;
  box-shadow: 0 0 0 2px rgba(56,118,29,.15);
}

.actions {
  grid-column: 1 / -1;
  display: flex;
  gap: 10px;
  margin-top: 6px;
}
.btn {
  border: 0;
  padding: 10px 16px;
  font-size: 14px;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
}
.btn.primary { background: #1f4f2a; color: #fff; }
.btn.primary:hover { background: #2c6c3b; }
.btn.whats { background: #25d366; color: #fff; }
.btn.whats:hover { background: #1ebe5a; }

/* ========= Preview / página A4 ========= */
.preview {
  padding: 24px;
  display: flex;
  justify-content: center;
}

#proposta {
  display: flex;
  flex-direction: column;
  gap: 18px;
  align-items: center;
}

.a4 {
  background: #fff;
  width: 210mm;
  height: 297mm;
  padding: 18mm 20mm;
  box-shadow: 0 4px 14px rgba(0,0,0,.12);
  font-family: Arial, sans-serif;
  font-size: 11pt;
  line-height: 1.4;
  color: #000;
  overflow: hidden;
  position: relative;
  box-sizing: border-box;
  page-break-after: always;
  break-after: page;
}
.a4:last-child {
  page-break-after: auto;
  break-after: auto;
}

/* Container temporário para renderização do PDF (fora da tela) */
.pdf-render-host {
  position: fixed;
  left: -10000px;
  top: 0;
  width: 210mm;
  background: #fff;
  z-index: -1;
}
.pdf-render-host .a4 {
  box-shadow: none;
  margin: 0;
}

.logo-wrap { text-align: left; margin-bottom: 4mm; }
.logo { width: 22mm; height: 22mm; object-fit: contain; }

.titulo {
  text-align: center;
  font-size: 13pt;
  margin: 0 0 4mm;
  font-weight: 700;
}

.local { margin: 0 0 4mm; }
.just  { text-align: justify; margin: 0 0 4mm; }

.a4 p { margin: 0 0 3mm; text-align: justify; }
.a4 h3 {
  font-size: 12pt;
  margin: 4mm 0 2mm;
  font-weight: 700;
}

.tab {
  width: 100%;
  border-collapse: collapse;
  margin: 0 0 4mm;
  table-layout: fixed;
}
.tab th, .tab td {
  border: 1px solid #fff;
  background: #f3f3f3;
  padding: 6px 8px;
  text-align: center;
  font-size: 11pt;
  vertical-align: middle;
}
.tab th {
  background: #e6efe2;
  font-weight: 700;
  font-size: 12pt;
}
.tab td.left { text-align: left; background: #eef5ea; }

.rodape {
  margin-top: 6mm;
  text-align: center;
}
.rodape p { text-align: center; margin: 1mm 0; }
.rodape .frase { color: #38761d; font-weight: 700; margin-top: 3mm; }
.rodape-img {
  width: 80%;
  max-width: 150mm;
  margin-top: 4mm;
  display: block;
  margin-left: auto;
  margin-right: auto;
}

/* ========= Impressão ========= */
@media print {
  body { background: #fff; }
  .no-print { display: none !important; }
  .preview { padding: 0; }
  .a4 {
    box-shadow: none;
    width: 210mm;
    min-height: 297mm;
    padding: 14mm 16mm;
  }
  @page { size: A4; margin: 0; }
}

/* ========= Responsivo ========= */
@media (max-width: 900px) {
  .form { grid-template-columns: 1fr 1fr; }
  .a4 {
    width: 100%;
    height: auto;
    padding: 14mm;
  }
}
