/* ============================================================
   Amazonia Social · Gerador de documentos das instituições
   App = identidade Amazonia Social (--marca, --creme…);
   documento = identidade da instituição (--inst-*).
   ============================================================ */
:root {
  /* ===== App (telas, home): identidade da Amazonia Social — copiada do site matriz ===== */
  --creme: #F7F2EA;
  --bronze: #8A5A34;
  --bronze-escuro: #5E3B20;
  --bronze-claro: #C79A6B;
  --salvia: #8E9877;
  --salvia-clara: #C8CDB6;
  --texto: #4A3527;
  --serifa: "Cormorant Garamond", Georgia, "Times New Roman", serif;
  --sans: "Montserrat", "Segoe UI", "Helvetica Neue", Arial, sans-serif;

  --marca: var(--bronze);
  --marca-escura: var(--bronze-escuro);
  --marca-clara: var(--bronze-claro);
  --marca-suave: #f3ebdf;
  --marca-linha: #e4d5c2;
  --ink: var(--texto);
  --muted: #7d6b5d;
  --line: #e8ddd0;
  --bg: var(--creme);
  --card: #fffdf9;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(94, 59, 32, .06), 0 8px 24px rgba(94, 59, 32, .07);

  /* ===== Documentos (.doc / PDF): cores da INSTITUIÇÃO ativa =====
     Sobrescritas por js/instituicoes.js; os valores abaixo são os do IDESPA. */
  --inst-cor: #2db52a;
  --inst-cor-clara: #40cc40;
  --inst-cor-suave: #e8f7e6;
  --inst-cor-linha: #bfe6bb;
  --inst-cor-fundo: #e3f5e1;
  --inst-cor-texto: #0f3d0e;
  --inst-cor-2: #10295a;
  --inst-cor-2-clara: #1d3b78;
  --inst-cor-2-suave: #dfe7f5;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--sans);
  color: var(--ink);
  background: var(--bg);
  position: relative;
  overflow-x: hidden;
}

/* folhas decorativas (mesmo motivo do selo da Amazonia Social — site matriz) */
body::before,
body::after {
  content: "";
  position: fixed;
  z-index: -1;
  width: clamp(110px, 16vw, 210px);
  aspect-ratio: 200 / 320;
  pointer-events: none;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 320'%3E%3Cpath fill='%238E9877' fill-opacity='.85' d='M30 300 C 10 200, 60 90, 170 20 C 150 120, 110 220, 30 300 Z'/%3E%3Cpath fill='none' stroke='%23C79A6B' stroke-width='1.4' stroke-opacity='.7' d='M30 300 C 80 210, 120 120, 170 20'/%3E%3Cpath fill='%23C8CDB6' fill-opacity='.9' d='M10 250 C 0 180, 30 120, 95 80 C 85 150, 60 200, 10 250 Z'/%3E%3C/svg%3E") no-repeat center / contain;
  opacity: .55;
}

body::before {
  top: -2rem;
  left: -1.5rem;
  transform: rotate(8deg);
}

body::after {
  bottom: -2rem;
  right: -1.5rem;
  transform: rotate(180deg);
}

/* ---------------- Topbar ---------------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 24px;
  background: rgba(255, 253, 249, .92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand img {
  height: 40px;
}

.brand .brand-logo {
  height: 46px;
}

.brand strong {
  display: block;
  color: var(--marca-escura);
  font-family: var(--serifa);
  font-size: 21px;
  font-weight: 600;
  line-height: 1.1;
}

.brand span {
  font-size: 12px;
  color: var(--muted);
}

.actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font: inherit;
  font-size: 13.5px;
  font-weight: 500;
  padding: 9px 18px;
  border-radius: 999px;
  border: 1.5px solid transparent;
  cursor: pointer;
  transition: .15s;
}

.btn.primary {
  background: var(--marca);
  border-color: var(--marca);
  color: #FFF9F1;
}

.btn.primary:hover {
  background: var(--marca-escura);
  border-color: var(--marca-escura);
}

.btn.primary:disabled {
  opacity: .6;
  cursor: wait;
}

.btn.ghost {
  background: transparent;
  border-color: rgba(138, 90, 52, .45);
  color: var(--marca-escura);
}

.btn.ghost:hover {
  border-color: var(--marca);
  background: rgba(138, 90, 52, .08);
}

.btn:focus-visible {
  outline: 2px solid var(--marca-escura);
  outline-offset: 3px;
}

.btn.add {
  background: var(--marca-suave);
  color: var(--marca-escura);
  border: 1px dashed var(--marca);
  width: 100%;
  justify-content: center;
}

.btn.add:hover {
  background: #efe3d3;
}

.btn.icon {
  padding: 6px 10px;
  background: transparent;
  color: #b91c1c;
  border-color: #fecaca;
}

.btn.icon:hover {
  background: #fef2f2;
}

/* ---------------- Layout ---------------- */
.layout {
  display: grid;
  grid-template-columns: minmax(360px, 520px) 1fr;
  gap: 24px;
  padding: 24px;
  align-items: start;
}

@media (max-width: 1100px) {
  .layout {
    grid-template-columns: 1fr;
    padding: 16px;
  }

  .topbar {
    flex-direction: column;
    align-items: stretch;
    padding: 12px 16px;
  }
}

/* ---------------- Formulário ---------------- */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  margin-bottom: 16px;
}

.card h2 {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 16px;
  font-family: var(--serifa);
  font-weight: 600;
  font-size: 22px;
  color: var(--marca-escura);
}

.card h3 {
  margin: 20px 0 10px;
  font-size: 13px;
  color: var(--texto);
  text-transform: uppercase;
  letter-spacing: .04em;
}

.step {
  display: inline-grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--marca);
  color: #fff;
  font-size: 13px;
  font-family: var(--sans);
  font-weight: 600;
}

.grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.col-2 {
  grid-column: span 2;
}

@media (max-width: 520px) {
  .grid {
    grid-template-columns: 1fr;
  }

  .col-2 {
    grid-column: span 1;
  }
}

label,
legend {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}

input[type="text"],
input[type="date"],
textarea {
  font: inherit;
  font-size: 14px;
  color: var(--ink);
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffef2;
  /* amarelo suave = campo editável */
  transition: .15s;
  width: 100%;
}

textarea {
  resize: vertical;
}

input:focus,
textarea:focus {
  outline: none;
  border-color: var(--marca);
  box-shadow: 0 0 0 3px rgba(138, 90, 52, .15);
  background: #fff;
}

input.money {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

input[readonly] {
  background: #f3f4f6;
  color: var(--marca-escura);
  font-weight: 700;
}

fieldset.radios {
  border: 0;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: row;
  gap: 16px;
  align-items: center;
  flex-wrap: wrap;
}

fieldset.radios legend {
  margin-bottom: 6px;
  width: 100%;
}

label.radio {
  flex-direction: row;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  color: var(--ink);
  font-weight: 500;
  cursor: pointer;
}

label.radio input {
  accent-color: var(--marca);
  width: 16px;
  height: 16px;
}

label.file input {
  font-size: 12px;
  font-weight: 400;
}

.hint {
  font-size: 12px;
  color: var(--muted);
  margin: 10px 0 0;
}

.rows {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 12px;
}

.row-item {
  border: 1px solid var(--line);
  border-left: 4px solid var(--marca);
  border-radius: 10px;
  padding: 12px;
  background: #fffdf9;
}

.row-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.row-head b {
  color: var(--marca-escura);
  font-size: 13px;
}

/* ---------------- Pré-visualização ---------------- */
.preview {
  position: sticky;
  top: 88px;
  max-height: calc(100vh - 110px);
  overflow: auto;
  padding-bottom: 8px;
}

@media (max-width: 1100px) {
  .preview {
    position: static;
    max-height: none;
  }
}

.preview-label {
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: .06em;
}

.paper {
  position: relative;
  width: 210mm;
  min-height: 297mm;
  margin: 0 auto;
  padding: 12mm 10mm 22mm;
  background: #fff;
  box-shadow: 0 10px 40px rgba(16, 41, 90, .15);
  border-radius: 4px;
  overflow: hidden;
}

.watermark {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 120mm;
  transform: translate(-50%, -50%);
  opacity: .06;
  pointer-events: none;
  z-index: 0;
}

.paper-footer {
  position: absolute;
  left: 10mm;
  right: 10mm;
  bottom: 8mm;
  border-top: 2px solid var(--inst-cor);
  padding-top: 6px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 9px;
  color: #6b7280;
}

/* ============================================================
   DOCUMENTO (o que vai para o PDF) — largura útil de A4: 190mm
   ============================================================ */
.doc {
  position: relative;
  z-index: 1;
  width: 190mm;
  /* fonte própria do documento (o app usa Montserrat; o PDF continua como foi conferido) */
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 10.5px;
  color: #111827;
}

.doc-header {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 14px;
  align-items: center;
  padding: 10px 14px;
  border-radius: 10px 10px 0 0;
  background: linear-gradient(120deg, #f2fbf1 0%, var(--inst-cor-fundo) 60%, #d3efcf 100%);
  border: 1px solid var(--inst-cor-linha);
  border-bottom: 0;
  position: relative;
  overflow: hidden;
}

.doc-header::after {
  /* faixa de cor */
  content: "";
  position: absolute;
  right: -40px;
  top: -40px;
  width: 160px;
  height: 160px;
  border-radius: 0 100% 0 100%;
  background: linear-gradient(135deg, var(--inst-cor-clara), var(--inst-cor));
  opacity: .18;
}

.doc-header img {
  height: 58px;
  display: block;
}

.doc-header .inst {
  line-height: 1.45;
  color: var(--inst-cor-2);
}

.doc-header .inst strong {
  font-size: 11.5px;
  display: block;
  margin-bottom: 2px;
  letter-spacing: .01em;
}

.doc-header .inst span {
  font-size: 9px;
  display: block;
}

.doc-title {
  background: var(--inst-cor-2);
  color: #fff;
  text-align: center;
  font-weight: 800;
  font-size: 13px;
  letter-spacing: .06em;
  padding: 9px 10px;
}

.doc-title small {
  display: block;
  font-size: 8.5px;
  font-weight: 500;
  letter-spacing: .12em;
  opacity: .75;
  margin-top: 2px;
}

.doc table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.doc th,
.doc td {
  border: 1px solid #cbd5d1;
  padding: 6px 8px;
  vertical-align: middle;
}

.info td {
  height: 44px;
}

.info .lbl {
  font-weight: 700;
  color: var(--inst-cor-2);
  background: #f7faf7;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .03em;
}

.info .val {
  text-align: center;
  font-weight: 700;
  color: #111827;
}

.info .side {
  text-align: center;
  font-weight: 700;
  font-size: 10px;
  color: var(--inst-cor-2);
  background: #fbfdfb;
}

.info .side em {
  font-style: normal;
  color: #111827;
  display: block;
  margin-top: 2px;
}

.check {
  display: inline-grid;
  place-items: center;
  width: 15px;
  height: 15px;
  border: 1.5px solid var(--inst-cor-2);
  border-radius: 3px;
  font-size: 10px;
  line-height: 1;
  vertical-align: middle;
  margin: 0 2px;
}

.check.on {
  background: var(--inst-cor);
  border-color: var(--inst-cor);
  color: #fff;
}

.section-title {
  background: var(--inst-cor);
  color: #fff;
  text-align: center;
  font-weight: 800;
  letter-spacing: .08em;
  font-size: 11px;
  padding: 7px !important;
  border-color: var(--inst-cor) !important;
}

.doc thead th,
.cols th {
  background: #eef7ed;
  color: var(--inst-cor-2);
  font-weight: 700;
  font-size: 10px;
  text-align: center;
}

.fisica td {
  text-align: center;
}

.fisica td.meta {
  text-align: left;
}

.fisica td.num {
  font-weight: 800;
  color: var(--inst-cor-2);
}

.fisica tr:nth-child(even) td {
  background: rgba(238, 247, 237, .45);
}

.fisica tr.total td {
  background: var(--inst-cor-fundo);
  font-weight: 800;
  color: var(--inst-cor-texto);
}

.badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 9.5px;
  font-weight: 700;
  line-height: 1.3;
  background: #e5e7eb;
  color: #374151;
}

.badge.ok {
  background: #dcfce7;
  color: #166534;
}

.badge.up {
  background: #dbeafe;
  color: #1e3a8a;
}

.badge.warn {
  background: #fef3c7;
  color: #92400e;
}

.badge.bad {
  background: #fee2e2;
  color: #991b1b;
}

.fin td {
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.fin tr.total td {
  background: #eef2fb;
  font-weight: 800;
  color: var(--inst-cor-2);
}

.spacer td {
  height: 10px;
  border-left-color: transparent;
  border-right-color: transparent;
  padding: 0;
}

.local-data td {
  text-align: right;
  padding: 10px 12px;
  font-size: 11px;
}

.sig td {
  text-align: center;
  vertical-align: bottom;
  padding: 8px 10px 10px;
}

.sig .role {
  font-size: 9.5px;
  color: #6b7280;
  background: #f7faf7;
  padding: 5px;
  vertical-align: middle;
}

.sig .area {
  height: 78px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.sig .area img {
  max-height: 60px;
  max-width: 70%;
}

.sig .line {
  border-top: 1px solid #111827;
  width: 75%;
  margin: 0 auto;
  padding-top: 4px;
}

.sig .name {
  font-weight: 800;
  font-size: 10.5px;
  text-transform: uppercase;
}

.sig .sub {
  font-size: 9.5px;
  font-weight: 600;
  color: #374151;
}

.avoid-break {
  page-break-inside: avoid;
  break-inside: avoid;
}

/* ---------------- Toast ---------------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%) translateY(20px);
  background: var(--marca-escura);
  color: #fff;
  padding: 10px 18px;
  border-radius: 10px;
  font-size: 14px;
  opacity: 0;
  transition: .25s;
  pointer-events: none;
  z-index: 50;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* evita borda dupla entre tabelas consecutivas */
.doc table {
  margin-top: -1px;
}

/* botão voltar ao início */
.back {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid var(--line);
  color: var(--marca-escura);
  background: #fff;
  text-decoration: none;
  transition: .15s;
}

.back:hover {
  border-color: var(--marca);
  color: var(--marca);
}

/* ============================================================
   Anexo I · Relação de documentos (checklist Sim/Não)
   ============================================================ */
.btn.sm {
  padding: 5px 12px;
  font-size: 13px;
}

.bulk {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.bulk .hint {
  margin: 0;
}

.item-check .row-head b {
  font-weight: 600;
  line-height: 1.35;
}

.item-ctrl {
  display: flex;
  gap: 10px;
  align-items: center;
}

.item-ctrl input[type="text"] {
  flex: 1;
  min-width: 0;
}

@media (max-width: 520px) {
  .item-ctrl {
    flex-direction: column;
    align-items: stretch;
  }
}

.seg {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  flex-shrink: 0;
}

.seg-opt {
  position: relative;
  flex-direction: row;
  gap: 0;
  cursor: pointer;
}

.seg-opt input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.seg-opt span {
  display: block;
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  background: #fff;
  transition: .15s;
}

.seg-opt+.seg-opt span {
  border-left: 1px solid var(--line);
}

.seg-opt input:focus-visible+span {
  box-shadow: inset 0 0 0 2px var(--marca);
}

.seg-opt.sim input:checked+span {
  background: var(--marca);
  color: #fff;
}

.seg-opt.nao input:checked+span {
  background: #dc2626;
  color: #fff;
}

.seg-opt input[value=""]:checked+span {
  background: #f3f4f6;
  color: var(--marca-escura);
}

.checklist .cols th:first-child {
  text-align: left;
}

.checklist td {
  font-size: 9.5px;
}

.checklist td.esp {
  font-weight: 600;
  color: #111827;
  line-height: 1.35;
}

.checklist td.esp .n {
  color: var(--inst-cor-2);
  font-weight: 800;
}

.checklist td.esp .detalhe {
  font-weight: 400;
  font-size: 7.5px;
  line-height: 1.35;
  margin-top: 4px;
  color: #374151;
  text-align: justify;
}

.checklist td.mark {
  text-align: center;
}

.checklist td.obs {
  font-size: 9.5px;
}

.checklist tr:nth-child(odd) td {
  background: rgba(238, 247, 237, .45);
}

.checklist tr.spacer td,
.checklist tr.cols th {
  background: none;
}

.checklist tr.cols th {
  background: #eef7ed;
}

/* ============================================================
   Componentes de formulário compartilhados (listas, conferências)
   ============================================================ */
select {
  font: inherit;
  font-size: 14px;
  color: var(--ink);
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffef2;
  width: 100%;
}

select:focus {
  outline: none;
  border-color: var(--marca);
  box-shadow: 0 0 0 3px rgba(138, 90, 52, .15);
}

.grid.grid-3 {
  grid-template-columns: repeat(3, 1fr);
  align-items: end;
}

.col-3 {
  grid-column: span 3;
}

@media (max-width: 520px) {
  .grid.grid-3 {
    grid-template-columns: 1fr;
  }

  .col-3 {
    grid-column: span 1;
  }
}

.row-actions {
  display: inline-flex;
  gap: 4px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.btn.mini {
  padding: 4px 9px;
  font-size: 12px;
  background: #fff;
  border-color: var(--line);
  color: var(--marca-escura);
}

.btn.mini:hover:not(:disabled) {
  border-color: var(--marca);
  color: var(--marca);
}

.btn.mini:disabled {
  opacity: .35;
  cursor: default;
}

.btn.mini.danger {
  color: #b91c1c;
  border-color: #fecaca;
}

.btn.mini.danger:hover {
  background: #fef2f2;
  color: #b91c1c;
  border-color: #fca5a5;
}

.btn.add.sm {
  padding: 6px 12px;
  font-size: 13px;
  margin-top: 8px;
}

.tag {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  padding: 2px 6px;
  border-radius: 999px;
  background: #dbeafe;
  color: #1e3a8a;
  margin-left: 6px;
}

.calc {
  margin-top: 10px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
}

.calc b {
  color: var(--marca-escura);
}

.calc .ok,
.doc-status .ok {
  color: #166534;
  font-weight: 600;
}

.calc .warn,
.doc-status .warn {
  color: #b45309;
  font-weight: 600;
}

.doc-status {
  font-weight: 500;
}

.calc.total-geral {
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--marca-suave);
  color: var(--texto);
  font-size: 13px;
}

/* Itens da NF (Relação de Pagamentos) */
details.nf-itens {
  margin-top: 12px;
  border-top: 1px dashed var(--line);
  padding-top: 10px;
}

details.nf-itens summary {
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
  color: var(--texto);
  text-transform: uppercase;
  letter-spacing: .04em;
}

.nf-item {
  display: grid;
  grid-template-columns: 1fr 30px;
  gap: 6px;
  padding: 8px 0;
  border-bottom: 1px dashed var(--line);
}

.nf-item>input {
  padding: 7px 9px;
  font-size: 13px;
}

.nf-nums {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: .8fr 1.1fr .8fr 1.3fr 1.3fr;
  gap: 6px;
}

.nf-nums label {
  font-size: 10.5px;
  gap: 3px;
}

.nf-nums input {
  padding: 6px 7px;
  font-size: 12.5px;
}

.nf-item .btn.mini {
  justify-content: center;
  padding: 4px 0;
}

@media (max-width: 520px) {
  .nf-nums {
    grid-template-columns: 1fr 1fr;
  }
}

/* Grupos recolhíveis (Mapa Comparativo) */
details.grupo-form {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}

details.grupo-form>summary {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  cursor: pointer;
  list-style: none;
  border-left: 4px solid var(--marca);
  border-radius: 10px;
}

details.grupo-form>summary::-webkit-details-marker {
  display: none;
}

details.grupo-form>summary::before {
  content: "▸";
  color: var(--marca);
  font-weight: 800;
}

details.grupo-form[open]>summary::before {
  content: "▾";
}

details.grupo-form[open]>summary {
  border-bottom-left-radius: 0;
  border-bottom: 1px solid var(--line);
}

.g-titulo {
  flex: 1;
  font-weight: 700;
  font-size: 13px;
  color: var(--marca-escura);
}

.g-resumo {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}

.grupo-body {
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.grupo-body>.row-head {
  align-items: flex-end;
  gap: 12px;
  margin: 0;
}

.g-label {
  flex: 1;
}

/* ============================================================
   Papel A4 paisagem (usar com baixarPdf(..., { orientacao: "landscape" }))
   ============================================================ */
.paper.landscape {
  width: 297mm;
  min-height: 210mm;
}

.paper.landscape .doc,
.doc.landscape {
  width: 277mm;
}

/* .doc.landscape: o html2pdf clona só o #doc (sem o .paper) */

/* ============================================================
   Tabelas dos documentos financeiros
   ============================================================ */
.doc td.l {
  text-align: left;
}

.doc td.r {
  text-align: right;
}

.doc td.c {
  text-align: center;
}

/* "R$" à esquerda e valor à direita, como na formatação contábil do Excel */
.doc td.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.doc td.num .rs {
  float: left;
  color: #4b5563;
}

.legenda td {
  font-size: 9px;
  color: #374151;
  padding: 4px 8px;
  background: #fbfdfb;
}

/* Relação de Pagamentos */
.pagamentos td,
.pagamentos th {
  font-size: 8.5px;
  text-align: center;
  vertical-align: middle;
}

.pagamentos .cols th {
  font-size: 8.5px;
}

.pagamentos td.desc {
  text-align: left;
  font-size: 7.5px;
  line-height: 1.35;
  vertical-align: top;
}

.pagamentos td.valor {
  text-align: right;
  font-weight: 700;
  white-space: nowrap;
}

.pagamentos tr.total td {
  background: var(--inst-cor-fundo);
  font-weight: 800;
  color: var(--inst-cor-texto);
  font-size: 9.5px;
}

.doc table.nf-mini {
  margin: 5px 0 0;
}

.nf-mini th,
.nf-mini td {
  font-size: 7px !important;
  padding: 2px 4px !important;
  border-color: #dde5e1 !important;
  text-align: center;
}

.nf-mini th {
  background: #f3f8f2;
  color: var(--inst-cor-2);
  font-weight: 700;
}

.nf-mini td.l {
  text-align: left;
}

.nf-mini td.r {
  text-align: right;
  white-space: nowrap;
}

.nf-mini tr.t td {
  font-weight: 800;
  background: #f3f8f2;
}

/* Conciliação Bancária */
.conc td,
.conc th {
  font-size: 9.5px;
  text-align: center;
}

.conc tr.banco td {
  font-weight: 700;
  color: var(--inst-cor-2);
}

.conc tr.total td {
  background: #eef2fb;
  font-weight: 800;
  color: var(--inst-cor-2);
}

.conc tr.spacer td {
  height: 8px;
}

/* Balancete Financeiro */
.balancete td,
.balancete th {
  font-size: 9.5px;
  text-align: center;
}

.balancete tr.sub td {
  background: #fbfdfb;
  font-size: 9.5px;
  color: #374151;
}

.balancete tr.total td {
  background: var(--inst-cor-fundo);
  font-weight: 800;
  color: var(--inst-cor-texto);
}

/* Mapa Comparativo */
.mapa th,
.mapa td {
  font-size: 7.2px;
  padding: 3px 4px;
  text-align: center;
}

.mapa .cols th {
  font-size: 7.2px;
}

.mapa th.forn {
  font-size: 8px;
  letter-spacing: .04em;
}

.mapa td.desc {
  text-align: left;
  line-height: 1.3;
}

.mapa tr.grupo td {
  background: #cfeccb;
  color: var(--inst-cor-texto);
  font-weight: 800;
  text-align: left;
  font-size: 8px;
  padding: 4px 6px;
}

.mapa td.min {
  font-weight: 800;
  color: #166534;
  background: #ecfdf0;
}

.mapa .media {
  background: #f3f6fb;
}

.mapa tr.total td {
  background: var(--inst-cor-fundo);
  font-weight: 800;
  color: var(--inst-cor-texto);
  font-size: 7.6px;
}

.mapa tr.total td.media {
  background: var(--inst-cor-2-suave);
  color: var(--inst-cor-2);
}
/* ============================================================
   Cartas em papel timbrado (ofício + declarações)
   view/oficio-prestacao-contas.html — PDF com baixarPdf(..., { timbre: true })
   ============================================================ */
.checks {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

label.check-item {
  align-items: flex-start;
  font-size: 13px;
  line-height: 1.35;
}

label.check-item input {
  flex: none;
  margin-top: 1px;
}

.carta {
  font-family: Arial, Helvetica, sans-serif;
  font-size: 14.5px;
  line-height: 1.6;
  color: #111;
  padding: 0 8mm;
}

.carta p {
  margin: 0 0 12px;
}

.carta .just {
  text-align: justify;
}

.carta .recuo {
  text-indent: 12mm;
}

/* timbre só na tela; no PDF é desenhado em todas as páginas (decorarPdf) */
.timbre-tela {
  margin: -4mm -8mm 8mm;
}

.timbre-tela img {
  width: 100%;
  display: block;
}

/* timbre com sangria (ex.: IIDHS): encosta no topo e nas laterais da folha
   (.paper tem padding 12mm 10mm e .carta 0 8mm) */
.timbre-tela.sangria {
  margin: -12mm -18mm 8mm;
}

/* planilha timbrada (sem .carta): o .doc ocupa a largura útil, só o padding do .paper (12mm 10mm) */
.doc > .timbre-tela {
  margin: 0 0 6mm;
}

.doc > .timbre-tela.sangria {
  margin: -12mm -10mm 6mm;
}

/* timbre montado em peças (ex.: IIDHS) — mesmas medidas do PDF; o conteúdo começa logo abaixo */
.doc .timbre-tela.composto {
  position: relative;
  margin-bottom: 0;
}

/* rodapé centralizado com rótulos (ex.: IIDHS) — linha a 20,4 mm do pé, como no PDF */
.paper-footer.campos {
  display: block;
  left: 20mm;
  right: 20mm;
  top: calc(100% - 20.4mm);
  bottom: auto;
  border-top: .25mm solid #d5dce3;
  padding-top: 1.4mm;
  text-align: center;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 8.2px;
  line-height: 1.5;
  color: #3f4a55;
}

.paper-footer.campos b {
  color: #527d9c;
}

.paper-footer.campos i {
  font-style: normal;
  color: #a9b2ba;
  margin: 0 7px;
}

.paper-footer.campos small {
  position: absolute;
  right: 0;
  top: 13mm;
  font-size: 7px;
  color: #a9b2ba;
}

/* rodapé em imagem da instituição — só em documento timbrado, como no PDF */
.paper-footer .rodape-img {
  display: none;
}

.paper:has(.carta .timbre-tela) .paper-footer:has(.rodape-img) {
  border-top: 0;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 0 10mm calc(210mm * var(--rodape-prop, .04) + 2mm);
}

.paper:has(.carta .timbre-tela) .paper-footer .rodape-img {
  display: block;
  position: absolute;
  left: 0;
  bottom: 0;
  width: 100%;
}

.doc.pdf-timbre .timbre-tela {
  display: none;
}

.carta .of-topo p {
  margin: 0;
}

.carta .of-topo {
  margin-bottom: 16px;
}

.carta .c-data {
  text-align: right;
  margin: 16px 0 0;
}

.carta .dest {
  margin-bottom: 14px;
}

.carta .voc {
  margin: 22px 0 14px 12mm;
}

.carta .c-titulo {
  text-align: center;
  text-decoration: underline;
  font-size: 15px;
  font-weight: 700;
  margin: 10mm 0 9mm;
}

.carta .lista-docs {
  margin: 0 0 18px;
  padding-left: 14mm;
}

.carta .lista-docs li {
  margin: 0 0 2px;
}

.carta .c-sig {
  text-align: center;
  margin-top: 6mm;
}

.carta .c-sig .area {
  height: 22mm;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.carta .c-sig .area img {
  max-height: 20mm;
  max-width: 60%;
}

.carta .c-sig b {
  display: block;
}

/* campo ainda não preenchido. inline-block/nowrap: se o marcador quebrar entre linhas,
   o html2canvas apaga o texto do parágrafo em volta no PDF */
.doc .ph {
  display: inline-block;
  white-space: nowrap;
  line-height: 1.25;
  color: #b45309;
  background: #fef3c7;
  border-radius: 3px;
  padding: 0 3px;
}

/* separação entre documentos na pré-visualização */
.doc .html2pdf__page-break {
  border-top: 2px dashed #cbd5d1;
  margin: 14mm -10mm;
}

.doc.pdf-timbre .html2pdf__page-break {
  border: 0;
  margin: 0;
}

/* ---------- Contrato (view/contrato-servicos.html) ---------- */
.carta.contrato p {
  margin: 0 0 10px;
}

.carta.contrato .ct-titulo {
  text-align: center;
  font-size: 15px;
  font-weight: 700;
  margin: 2mm 0 7mm;
}

.carta.contrato .clausula {
  margin-bottom: 14px;
}

.carta.contrato .clausula h3 {
  font-size: 14.5px;
  font-weight: 700;
  margin: 0;
}

.carta .linhas p {
  margin: 0;
}

.carta .linhas {
  margin-bottom: 10px;
}

.carta.contrato .ct-sig {
  text-align: center;
  margin-top: 12mm;
}

.carta.contrato .ct-sig .area {
  height: 18mm;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.carta.contrato .ct-sig .area img {
  max-height: 17mm;
  max-width: 60%;
}

.carta.contrato .ct-sig span,
.carta.contrato .ct-sig b {
  display: block;
}

.carta.contrato .ct-sig .area + span {
  border-top: 1px solid #111;
  width: 60%;
  margin: 0 auto;
  padding-top: 3px;
}

/* ---------- Relatório de Execução do Objeto (view/relatorio-execucao-objeto.html) ---------- */
.carta.relatorio-exec {
  line-height: 1.75;
}

.carta.relatorio-exec p {
  margin: 0 0 4px;
}

.carta.relatorio-exec .ct-titulo {
  text-align: center;
  font-size: 15px;
  font-weight: 700;
  margin: 2mm 0 2mm;
}

.carta.relatorio-exec .re-cab {
  margin-bottom: 18px;
}

.carta.relatorio-exec .re-cab p {
  margin: 0;
}

.carta.relatorio-exec .re-secao {
  margin-bottom: 16px;
}

.carta.relatorio-exec h3,
.carta.relatorio-exec h4 {
  font-size: 14.5px;
  font-weight: 700;
  margin: 0 0 2px;
}

/* tabela de execução: faixa azul + cabeçalho verde (como no modelo) */
.carta table.re-exec {
  margin-top: 8px;
  font-family: "Times New Roman", Times, serif;
  font-size: 13px;
  line-height: 1.3;
}

.carta table.re-exec th,
.carta table.re-exec td {
  border: 1px solid #111;
  padding: 4px 8px;
}

.carta table.re-exec tr.re-faixa th {
  background: #6f7fe0;
  color: #fff;
  text-align: center;
}

.carta table.re-exec tr.re-cols th {
  background: #c4d79b;
  color: #111;
  text-align: center;
}

.carta table.re-exec tr.re-linha td {
  height: 16mm;
  vertical-align: middle;
}

.carta table.re-exec td.c {
  text-align: center;
}

/* ---------- Termo de Compromisso e LGPD (view/termo-compromisso.html) ---------- */
/* formulário: lista de pessoas selecionável */
.tc-busca {
  width: 100%;
  margin-bottom: 8px;
}

.tc-lista {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 320px;
  overflow: auto;
  margin-bottom: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 4px;
}

.tc-pessoa {
  display: grid;
  grid-template-columns: 28px 1fr auto auto;
  gap: 8px;
  align-items: center;
  padding: 6px 8px;
  border-radius: 8px;
  cursor: pointer;
  border-left: 3px solid transparent;
}

.tc-pessoa:hover {
  background: #f6efe5;
}

.tc-pessoa.sel {
  background: var(--marca-suave);
  border-left-color: var(--marca);
}

.tc-pessoa .tc-n {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  text-align: right;
}

.tc-pessoa .tc-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.tc-pessoa .tc-info b {
  font-size: 13px;
  color: var(--marca-escura);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tc-pessoa .tc-info small {
  font-size: 11.5px;
  color: var(--muted);
}

.tc-pessoa .ok { color: #166534; font-weight: 700; }
.tc-pessoa .warn { color: #b45309; font-weight: 700; }

.tc-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 12px;
  font-size: 13px;
  color: var(--muted);
  font-weight: 600;
}

.tc-gerar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.tc-upload {
  cursor: pointer;
}

/* documento */
.carta.termo-comp {
  font-size: 13.5px;
  line-height: 1.55;
}

.carta.termo-comp p {
  margin: 0 0 7px;
}

.carta.termo-comp .ct-titulo {
  text-align: center;
  font-size: 16px;
  font-weight: 700;
  margin: 2mm 0 7mm;
}

.carta.termo-comp .tc-ident {
  text-align: left;
  line-height: 2;
}

.carta.termo-comp .tc-cond {
  margin: 10px 0 12px;
}

.carta.termo-comp .tc-sec {
  font-size: 13.5px;
  font-weight: 700;
  margin: 14px 0 4px;
}

.carta.termo-comp .tc-sec span {
  display: inline-block;
  width: 9mm;
  color: #3a6ea5;
}

.carta.termo-comp .tc-ul {
  margin: 0 0 8px;
  padding-left: 9mm;
}

.carta.termo-comp .tc-ul li {
  margin: 0 0 2px;
  text-align: justify;
}

.carta.termo-comp .tc-linha {
  display: inline-block;
  border-bottom: 1px solid #111;
  height: 1em;
  vertical-align: baseline;
}

.carta.termo-comp .tc-sig {
  text-align: center;
  margin-top: 6mm;
}

.carta.termo-comp .tc-sig .area {
  height: 18mm;
  width: 110mm;
  margin: 0 auto;
  border-bottom: 1px solid #111;
}

.carta.termo-comp .tc-sig > span,
.carta.termo-comp .tc-sig > b {
  display: block;
  margin-top: 3px;
}

/* ============================================================
   Seletor de instituição (topbar de todas as telas)
   ============================================================ */
.inst-switch {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  padding: 4px 6px 4px 12px;
  border: 1.5px solid rgba(138, 90, 52, .3);
  border-radius: 999px;
  background: rgba(255, 253, 249, .8);
  font-size: 11px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--marca);
  font-weight: 500;
  cursor: pointer;
}

.inst-switch img {
  height: 26px;
  max-width: 70px;
  object-fit: contain;
}

.inst-switch select {
  width: auto;
  border: 0;
  background: transparent;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
  color: var(--marca-escura);
  padding: 4px 6px;
  cursor: pointer;
}

.inst-switch select:focus {
  outline: none;
  box-shadow: none;
}

.inst-switch:focus-within {
  border-color: var(--marca);
}
