/* o atributo hidden sempre esconde (os estilos de botão/rótulo do ERP não podem vencer) */
[hidden] { display: none !important; }
.ed-aviso-sem-cert { margin: 8px 0 4px; padding: 12px 14px; border: 1px solid #fcd34d; border-radius: 10px; background: #fffbeb; }
.ed-aviso-sem-cert p { margin: 0 0 6px; }

/* Editor de PDF das licitações (templates/licitacoes/editor.html) */
.ed-corpo { margin: 0; height: 100vh; display: flex; flex-direction: column; background: #e9edf2; overflow: hidden; }
.ed-topo { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 8px 14px;
  background: #fff; border-bottom: 1px solid #d8dee6; flex-wrap: wrap; }
.ed-titulo { display: flex; align-items: center; gap: 10px; min-width: 0; }
.ed-voltar { font-size: 20px; text-decoration: none; color: inherit; padding: 4px 8px; border-radius: 6px; }
.ed-voltar:hover { background: #eef2f7; }
.ed-nome { font: inherit; font-weight: 600; font-size: 16px; border: 1px solid transparent; border-radius: 6px;
  padding: 2px 6px; min-width: 260px; background: transparent; }
.ed-nome:hover, .ed-nome:focus { border-color: #c7d0db; background: #fff; }
.ed-sub { font-size: 12px; color: #5b6573; padding-left: 6px; }
.ed-acoes-topo { display: flex; gap: 6px; flex-wrap: wrap; }

.ed-ferramentas { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; padding: 6px 14px;
  background: #f8fafc; border-bottom: 1px solid #d8dee6; }
.ed-grupo { display: flex; gap: 4px; align-items: center; flex-wrap: wrap; }
.ed-grupo button { font: inherit; font-size: 13px; padding: 5px 10px; border: 1px solid #c7d0db; background: #fff;
  border-radius: 6px; cursor: pointer; }
.ed-grupo button:hover { background: #eef2f7; }
.ed-grupo button.ativa { background: #1e40af; color: #fff; border-color: #1e40af; }
.ed-opcoes label { font-size: 12px; display: flex; gap: 4px; align-items: center; }
.ed-opcoes input[type=number] { width: 52px; }
.ed-opcoes select, .ed-opcoes input { font: inherit; font-size: 12px; }
#ed-zoom { min-width: 46px; text-align: center; font-size: 13px; }

.ed-area { flex: 1; display: flex; min-height: 0; }
.ed-lado { width: 260px; background: #fff; border-right: 1px solid #d8dee6; display: flex; flex-direction: column;
  min-height: 0; }
.ed-abas { display: flex; gap: 0; border-bottom: 1px solid #d8dee6; }
.ed-abas button { flex: 1; font: inherit; font-size: 13px; padding: 8px 4px; border: 0; background: none; cursor: pointer;
  border-bottom: 2px solid transparent; }
.ed-abas button[aria-selected=true] { border-bottom-color: #1e40af; font-weight: 600; }
.ed-painel { overflow: auto; padding: 10px; flex: 1; }
.ed-paginas-acoes { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.ed-miniaturas { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.ed-miniaturas li { border: 2px solid transparent; border-radius: 6px; padding: 4px; background: #f3f6f9; }
.ed-miniaturas li.atual { border-color: #1e40af; }
.ed-miniaturas li[draggable="true"] { cursor: grab; }
.ed-miniaturas li.arrastando { opacity: .45; }
.ed-miniaturas li.alvo { border-color: #d97706; border-style: dashed; }
.ed-miniaturas canvas { width: 100%; height: auto; display: block; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.2);
  cursor: pointer; }
.ed-mini-barra { display: flex; justify-content: space-between; align-items: center; font-size: 12px; margin-top: 4px; }
.ed-mini-barra button { font-size: 12px; padding: 1px 5px; border: 1px solid #c7d0db; background: #fff; border-radius: 4px;
  cursor: pointer; }
.ed-mini-barra button:disabled { opacity: .35; cursor: default; }
.ed-campos { display: grid; gap: 8px; }
.ed-campos label { font-size: 12px; display: grid; gap: 2px; }
.ed-campos input[type=text], .ed-campos select, .ed-campos textarea { font: inherit; font-size: 13px; width: 100%; box-sizing: border-box; }
.ed-campos .ed-campo-caixa { display: flex; gap: 6px; align-items: center; }
.ed-achatar { display: flex; gap: 6px; margin-top: 12px; }
.ed-dados { display: grid; gap: 4px; margin-bottom: 10px; }
.ed-dados button { text-align: left; font: inherit; font-size: 12px; border: 1px solid #e1e6ec; background: #f8fafc;
  border-radius: 6px; padding: 5px 7px; cursor: copy; }
.ed-dados button b { display: block; font-size: 11px; color: #5b6573; font-weight: 600; }
.ed-dados button:hover { background: #eef2f7; }

.ed-paginas { flex: 1; overflow: auto; padding: 18px; display: flex; flex-direction: column; align-items: center; gap: 18px;
  outline: none; }
.ed-pagina { position: relative; background: #fff; box-shadow: 0 2px 8px rgba(0,0,0,.18); flex: none; }
.ed-pagina canvas { display: block; }
.ed-numero { position: absolute; top: -16px; left: 0; font-size: 11px; color: #5b6573; }
.ed-camada { position: absolute; inset: 0; }
.ed-camada-texto { position: absolute; inset: 0; pointer-events: none; }
.ed-editavel .ed-camada-texto { pointer-events: auto; }
.ed-trecho { position: absolute; cursor: text; border-radius: 2px; color: transparent; white-space: pre; }
.ed-editavel .ed-trecho:hover { outline: 1px dashed #2563eb; background: rgba(37,99,235,.08); }
.ed-trecho.usado { display: none; }
.ed-widget { position: absolute; border: 1px dashed rgba(37,99,235,.6); background: rgba(37,99,235,.06); cursor: pointer; }
.ed-widget.editavel { cursor: text; }
.ed-widget .ed-widget-campo { all: unset; display: block; width: 100%; height: 100%; box-sizing: border-box; padding: 0 3px;
  background: rgba(255,255,255,.96); color: #000; font-family: Helvetica, Arial, sans-serif; line-height: 1.1;
  white-space: pre; overflow: hidden; cursor: text; }
.ed-widget textarea.ed-widget-campo { white-space: pre-wrap; padding-top: 2px; }
.ed-widget .ed-widget-campo:focus { background: #fff; box-shadow: inset 0 0 0 2px #2563eb; }
.ed-widget input[type="checkbox"].ed-widget-campo { all: revert; display: block; width: 72%; height: 72%; margin: 14% auto; padding: 0;
  accent-color: #1e40af; cursor: pointer; }
.ed-ferr-editar .ed-widget-campo, .ed-editavel .ed-widget-campo { pointer-events: none; }

.ed-obj { position: absolute; box-sizing: border-box; }
.ed-obj.sel { outline: 2px solid #2563eb; outline-offset: 1px; }
.ed-obj-texto .ed-txt { outline: none; white-space: pre; line-height: 1.2; min-width: 8px; cursor: text; }
.ed-obj-cobrir { background: #fff; border: 1px dashed #94a3b8; }
.ed-obj-cobrir.final { border-color: transparent; }
.ed-obj-marca { line-height: 1; }
.ed-obj-imagem img { width: 100%; height: 100%; display: block; pointer-events: none; }
.ed-obj-campo { border: 1px solid #2563eb; background: rgba(219,234,254,.6); font-size: 10px; color: #1e3a8a; padding: 1px 3px;
  overflow: hidden; }
.ed-obj-caixa { border: 1px solid #2563eb; background: rgba(219,234,254,.6); }
.ed-obj-local { padding: 0; overflow: visible; border-radius: 10px; outline: 2px dashed rgba(217,119,6,.9); outline-offset: 2px; }
/* prévia do selo (o selo final é desenhado no servidor com o nome e a hora da assinatura) */
.ed-selo { position: absolute; inset: 0; display: grid; grid-template-columns: auto 1fr; grid-template-rows: 1fr auto;
  border-radius: .9em; overflow: hidden; background: #0b2554; color: #fff; font-family: "DejaVu Sans", Verdana, sans-serif;
  line-height: 1.15; pointer-events: none; box-shadow: 0 2px 8px rgba(0,0,0,.25); }
.ed-selo-visto { grid-row: 1; align-self: center; margin: 0 .6em 0 .7em; width: 2.7em; height: 2.7em; border-radius: 50%;
  display: grid; place-items: center; background: #22c55e; box-shadow: 0 0 0 .25em rgba(255,255,255,.2); font-size: 1.15em; font-weight: 700; }
.ed-selo-txt { grid-row: 1; align-self: center; display: flex; flex-direction: column; min-width: 0; }
.ed-selo-txt b { color: #fcd34d; letter-spacing: .02em; white-space: nowrap; }
.ed-selo-txt strong { font-size: .95em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ed-selo-txt span { color: #cbd5e1; font-size: .85em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ed-selo em { grid-column: 1 / -1; font-style: normal; font-weight: 700; font-size: .7em; text-align: center; padding: .35em .4em;
  background: #0ea5e9; white-space: nowrap; overflow: hidden; }
.ed-barra-selo { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); z-index: 60; display: flex; align-items: center;
  gap: 10px; max-width: min(860px, calc(100vw - 32px)); padding: 10px 12px 10px 14px; border-radius: 14px; background: #0b2554;
  color: #fff; box-shadow: 0 10px 30px rgba(0,0,0,.3); font-size: 13px; }
.ed-barra-selo-icone { width: 26px; height: 26px; flex: none; display: grid; place-items: center; border-radius: 50%; background: #22c55e; font-weight: 700; }
.ed-barra-selo span#ed-barra-selo-texto { flex: 1; }
.ed-alca { position: absolute; width: 10px; height: 10px; background: #2563eb; border-radius: 2px; right: -6px; bottom: -6px;
  cursor: nwse-resize; display: none; }
.ed-mover { position: absolute; left: -2px; top: -18px; font-size: 11px; background: #2563eb; color: #fff; border-radius: 4px 4px 0 0;
  padding: 0 5px; cursor: move; display: none; user-select: none; white-space: nowrap; }
.ed-excluir { position: absolute; right: -2px; top: -18px; font-size: 11px; background: #dc2626; color: #fff; border: 0;
  border-radius: 4px 4px 0 0; padding: 0 5px; cursor: pointer; display: none; }
.ed-obj.sel .ed-alca, .ed-obj.sel .ed-mover, .ed-obj.sel .ed-excluir { display: block; }
.ed-obj-texto .ed-alca { display: none !important; }
.ed-arrasto { position: absolute; border: 1px dashed #2563eb; background: rgba(37,99,235,.1); pointer-events: none; }

.ed-ferr-texto .ed-camada, .ed-ferr-marcar .ed-camada, .ed-ferr-marcar-x .ed-camada, .ed-ferr-imagem .ed-camada, .ed-ferr-caixa .ed-camada { cursor: crosshair; }
.ed-ferr-cobrir .ed-camada, .ed-ferr-campo .ed-camada, .ed-ferr-local-assinatura .ed-camada { cursor: crosshair; }

.ed-vazio { margin: auto; text-align: center; background: #fff; padding: 30px 40px; border-radius: 10px;
  box-shadow: 0 2px 8px rgba(0,0,0,.12); }
.ed-lista-arquivos { max-height: 50vh; overflow: auto; display: grid; gap: 4px; margin: 8px 0; }
.ed-lista-arquivos h3 { font-size: 13px; margin: 8px 0 2px; }
.ed-lista-arquivos button { text-align: left; font: inherit; font-size: 13px; padding: 6px 8px; border: 1px solid #e1e6ec;
  border-radius: 6px; background: #fff; cursor: pointer; }
.ed-lista-arquivos button:hover { background: #eef2f7; }
.ed-lista-arquivos small { color: #5b6573; }
.ed-desenho { border: 1px solid #c7d0db; border-radius: 6px; background: #fff; width: 100%; max-width: 560px; touch-action: none;
  cursor: crosshair; }
.ed-opcoes-salvar { display: grid; gap: 6px; margin: 10px 0; font-size: 14px; }
.ed-aviso { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); background: #111827; color: #fff;
  padding: 10px 16px; border-radius: 8px; font-size: 14px; max-width: 80vw; z-index: 50; box-shadow: 0 4px 12px rgba(0,0,0,.3); }
.ed-aviso.erro { background: #b91c1c; }
.ed-aviso a { color: #bfdbfe; }

@media (max-width: 900px) { .ed-lado { width: 200px; } .ed-nome { min-width: 140px; } }
/* celular: documento em cima ocupando a largura, páginas em faixa embaixo, botões em uma linha com rolagem */
@media (max-width: 760px) {
  .ed-corpo { height: 100dvh; }
  .ed-topo { padding: 6px 8px; gap: 6px; }
  .ed-titulo { width: 100%; }
  .ed-titulo > div { flex: 1; min-width: 0; }
  .ed-nome { min-width: 0; width: 100%; box-sizing: border-box; font-size: 15px; }
  .ed-sub { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .ed-acoes-topo, .ed-ferramentas, .ed-ferramentas .ed-grupo { flex-wrap: nowrap; }
  .ed-acoes-topo { width: 100%; overflow-x: auto; padding-bottom: 2px; }
  .ed-acoes-topo > * { flex: none; }
  .ed-ferramentas { overflow-x: auto; padding: 6px 8px; gap: 10px; }
  .ed-ferramentas .ed-grupo > * { flex: none; }
  .ed-area { flex-direction: column; }
  .ed-paginas { order: 1; padding: 20px 6px 10px; }
  .ed-lado { order: 2; width: 100%; max-height: 32vh; border-right: 0; border-top: 1px solid #d8dee6; }
  .ed-miniaturas { grid-auto-flow: column; grid-auto-columns: 96px; overflow-x: auto; }
  .ed-vazio { margin: 0; max-width: 100%; box-sizing: border-box; padding: 18px 14px; }
  .ed-barra-selo { flex-wrap: wrap; bottom: 10px; }
}
@media print { .ed-topo, .ed-ferramentas, .ed-lado { display: none; } }
.ed-editavel .ed-camada { pointer-events: none; }
.ed-editavel .ed-camada .ed-obj { pointer-events: auto; }
.ed-lista-declaracoes { display: grid; gap: 6px; max-height: 45vh; overflow: auto; margin: 8px 0; font-size: 14px; }
.ed-lista-declaracoes label, .ed-lista-arquivos label { display: flex; gap: 8px; align-items: flex-start; padding: 5px 7px;
  border: 1px solid #e1e6ec; border-radius: 6px; cursor: pointer; font-size: 13px; }
.ed-lista-arquivos label small { color: #5b6573; }
.ed-barra-selo .botao:not(.primario) { background: #fff; color: #0b2554; border-color: #fff; }

/* arrastar e soltar PDFs do computador */
.ed-vazio-arrastar { margin-top: 18px; padding: 22px 16px; border: 2px dashed #b8c4d3; border-radius: 12px; background: #f7f9fc;
  display: flex; flex-direction: column; align-items: center; gap: 4px; color: #334155; }
.ed-vazio-arrastar-icone { font-size: 28px; line-height: 1; color: #2563eb; }
.ed-vazio-arrastar small { color: #5b6573; }
.ed-soltar { position: fixed; inset: 0; z-index: 80; display: flex; gap: 18px; padding: 28px; background: rgba(11,37,84,.55);
  backdrop-filter: blur(2px); }
.ed-soltar[hidden] { display: none !important; }
.ed-soltar-zona { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  border: 3px dashed rgba(255,255,255,.85); border-radius: 18px; color: #fff; font-size: 20px; text-align: center; padding: 20px;
  transition: background .12s, border-color .12s; }
.ed-soltar-zona.ativa { background: rgba(255,255,255,.18); border-color: #fcd34d; }
.ed-soltar-zona > * { pointer-events: none; }
.ed-soltar-icone { font-size: 54px; line-height: 1; }

/* Assinador Construtech (certificados do Windows) */
.ed-pc-instalar { margin: 8px 0 4px; padding: 12px 14px; border: 1px solid #bfdbfe; border-radius: 10px; background: #eff6ff; }
.ed-pc-instalar p { margin: 0 0 6px; }
.ed-pc-instalar ol { margin: 0 0 8px 18px; padding: 0; }
#ed-com-pc-lista { display: contents; }

/* passo a passo do pacote de habilitação */
.ed-roteiro { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; padding: 7px 14px; background: #fff7e6;
  border-bottom: 1px solid #f2d7a1; font-size: 13px; }
.ed-roteiro button[data-passo] { font: inherit; font-size: 13px; padding: 4px 10px; border: 1px solid #e3b862; border-radius: 999px;
  background: #fff; cursor: pointer; }
.ed-roteiro button[data-passo].feito { background: #dcfce7; border-color: #86efac; }
.ed-roteiro button[data-passo].feito::before { content: "✓ "; color: #15803d; font-weight: 700; }
.ed-roteiro small { color: #7c5a12; }
.ed-roteiro-fechar { margin-left: auto; border: 0; background: none; cursor: pointer; font-size: 15px; }
/* painel de assinaturas */
.ed-assinaturas { display: grid; gap: 8px; margin-bottom: 10px; }
.ed-assinatura { border: 1px solid #d8dee6; border-left: 4px solid #16a34a; border-radius: 8px; padding: 8px 10px; font-size: 12px; }
.ed-assinatura.alerta { border-left-color: #dc2626; }
.ed-assinatura b { display: block; font-size: 13px; }
.ed-assinatura .situacao { font-weight: 600; margin: 2px 0 4px; }
.ed-assinatura.alerta .situacao { color: #b91c1c; }
.ed-assinatura:not(.alerta) .situacao { color: #15803d; }
.ed-assinatura dl { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 1px 8px; }
.ed-assinatura dt { color: #5b6573; }
.ed-assinatura dd { margin: 0; }
@media (max-width: 760px) { .ed-roteiro { flex-wrap: nowrap; overflow-x: auto; padding: 6px 8px; } .ed-roteiro > * { flex: none; } }
/* validade das certidões na lista de arquivos */
.ed-validade { font-weight: 600; padding: 0 6px; border-radius: 999px; }
.ed-validade.vencida { background: #fee2e2; color: #b91c1c; }
.ed-validade.vencendo { background: #fef3c7; color: #92400e; }
.ed-validade.trocada, .ed-validade.sem-data { background: #e5e7eb; color: #374151; }
