/* dicode.ai — CSS só da página Assinar PDF (/assinar-pdf).
   Tela: assets/js/ferramentas/telas/assinar-pdf.js; opções: templates/ferramentas/assinar-pdf.html. */
/* dicode.ai — editor de páginas (assets/js/ferramentas/telas/editor-paginas.js). Parte comum: a
   página de cada ferramenta que usa o editor traz este arquivo com  @import "_editor-paginas.css";
   (o build põe o conteúdo no lugar da linha). Primeiro uso: Assinar PDF. */

/* A caixa que rola: as páginas uma embaixo da outra, num fundo cinza, como num leitor de PDF.
   Altura fixa pela tela (nada embaixo dela pula quando as páginas chegam). */
.ed { min-width: 0; }
.ed-rolagem {
  position: relative;
  height: min(78vh, 920px);
  overflow-y: auto;
  border: 1px solid var(--preto);
  background: var(--superficie);
}
/* No celular, a caixa deixa sobrar tela para rolar a página do site; no fim do PDF, o dedo segue
   rolando a página (sem overscroll-behavior: contain). */
@media (max-width: 640px) { .ed-rolagem { height: min(65vh, 620px); height: min(65svh, 620px); } }
.ed-rolagem:focus-visible { outline: 2px solid var(--preto); outline-offset: 3px; }
.ed-lista { display: grid; gap: 16px; padding: 16px; justify-items: center; }
@media (max-width: 640px) { .ed-lista { padding: 10px; gap: 10px; } }
.ed-estado { margin: 0 0 8px; color: var(--cinza); }
.ed-estado[hidden] { display: none; }

/* Uma página: a proporção certa desde o começo; o desenho do PDF.js entra por baixo das peças. */
.ed-pagina {
  position: relative;
  width: 100%;
  max-width: 820px;
  background: var(--branco);
  box-shadow: 0 0 0 1px var(--linha);
  container-type: inline-size;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
}
.ed-pagina:focus { outline: none; }
.ed-pagina:focus-visible { outline: 2px solid var(--preto); outline-offset: 3px; }
.ed-fundo { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.ed-fundo:not([src]) { visibility: hidden; }
/* Enquanto o desenho não chega: listras leves (a página existe, só não foi desenhada ainda). */
.ed-pagina:not(.ed-pagina--pronta) {
  background-image: repeating-linear-gradient(135deg, transparent 0 14px, var(--superficie) 14px 15px);
}
.ed-pagina--falhou { background-image: none; }
/* Página que não deu para desenhar: o motivo (data-falhou) aparece no lugar do desenho. ::before
   (o 1º filho) fica por baixo das peças (tarjas, carimbos) já postas na página. */
.ed-pagina--falhou[data-falhou]::before {
  content: attr(data-falhou);
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  padding: 16px; text-align: center; font-size: 14px; line-height: 1.4; color: var(--cinza);
  pointer-events: none;
}
.ed-num {
  position: absolute; left: 0; bottom: 100%; padding: 0 0 2px; font-size: 12px; color: var(--cinza);
  pointer-events: none;
}
.ed-lista .ed-pagina { margin-top: 18px; }

/* Peça: a área toda arrasta; a alça do canto muda o tamanho (com a proporção travada). */
.ed-peca {
  position: absolute;
  box-sizing: border-box;
  cursor: grab;
  touch-action: none;
  outline: 1px dashed transparent;
  outline-offset: 0;
}
.ed-peca img { display: block; width: 100%; height: 100%; pointer-events: none; }
.ed-peca:hover { outline-color: var(--cinza); }
.ed-peca.ed-peca--escolhida, .ed-peca.ed-peca:focus-visible { outline: 2px solid var(--laranja); outline-offset: 1px; z-index: 2; }
.ed-peca:active { cursor: grabbing; }
.ed-texto {
  display: block; height: 100%; white-space: pre; line-height: 1.3;
  font-family: Archivo, Arial, Helvetica, sans-serif; font-weight: 400; pointer-events: none;
}
.ed-alca {
  position: absolute; right: -14px; bottom: -14px; width: 16px; height: 16px;
  background: var(--laranja); border: 2px solid var(--branco); box-sizing: border-box;
  cursor: nwse-resize; display: none; z-index: 1;
}
/* Área de toque maior que o quadradinho, quase toda FORA da peça (encostar na peça move). */
.ed-alca::after { content: ''; position: absolute; left: -4px; top: -4px; right: -10px; bottom: -10px; }
/* Peça pequena na tela (rubrica, data no celular): a área de pegar passa um pouco da borda. */
.ed-peca::before { content: ''; position: absolute; inset: -6px; }
.ed-peca--escolhida .ed-alca { display: block; }

/* Barra da peça escolhida, acima da caixa das páginas: altura fixa (nada pula quando aparece). */
.ed-barra {
  display: flex; align-items: center; gap: 12px; height: 52px;
  padding: 0 6px 0 14px; box-sizing: border-box; background: var(--preto); color: var(--branco);
  border: 1px solid var(--preto); border-bottom: 0;
}
.ed-barra-rotulo { font-size: 14px; flex: 1 1 auto; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ed-acoes { display: flex; flex: none; gap: 4px; }
.ed-acoes[hidden] { display: none; }
.ed-acao {
  font: inherit; font-size: 14px; font-weight: 500; color: var(--branco); background: transparent;
  border: 1px solid #555; padding: 0 12px; height: 40px; cursor: pointer; white-space: nowrap;
}
@media (max-width: 400px) { .ed-barra { padding-left: 10px; gap: 8px; } .ed-acao { padding: 0 9px; font-size: 13px; } }
.ed-acao:hover { background: #2A2A2A; }
.ed-acao:focus-visible { outline: 2px solid var(--laranja); outline-offset: 1px; }
.ed-acao[hidden] { display: none; }

/* As letras de mão do "Digitar" (licença OFL, em assets/fonts). Só baixam quando aparecem: ao
   abrir a aba Digitar da janela. */
@font-face { font-family: 'dc-assinatura-1'; font-display: swap; src: url(../../fonts/dancing-script-latin-ext.woff2) format('woff2'); font-weight: 500; unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'dc-assinatura-1'; font-display: swap; src: url(../../fonts/dancing-script-latin.woff2) format('woff2'); font-weight: 500; unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'dc-assinatura-2'; font-display: swap; src: url(../../fonts/great-vibes-latin-ext.woff2) format('woff2'); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'dc-assinatura-2'; font-display: swap; src: url(../../fonts/great-vibes-latin.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'dc-assinatura-3'; font-display: swap; src: url(../../fonts/herr-von-muellerhoff-latin-ext.woff2) format('woff2'); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'dc-assinatura-3'; font-display: swap; src: url(../../fonts/herr-von-muellerhoff-latin.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'dc-assinatura-4'; font-display: swap; src: url(../../fonts/caveat-latin-ext.woff2) format('woff2'); font-weight: 500; unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'dc-assinatura-4'; font-display: swap; src: url(../../fonts/caveat-latin.woff2) format('woff2'); font-weight: 500; unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

.ass { display: grid; gap: 32px; min-width: 0; }
.ass-passo { display: grid; gap: 14px; min-width: 0; }
.ass-passo-titulo { color: var(--preto); }

/* 1 — Assinatura e rubrica criadas (ou o espaço vazio delas) */
.ass-modelos { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); max-width: 640px; }
.ass-modelo { display: grid; gap: 10px; align-content: start; justify-items: start; min-width: 0; }
.ass-modelo-caixa {
  width: 100%; height: 96px; display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--preto); background: var(--branco); padding: 10px; box-sizing: border-box;
}
.ass-modelo-img { max-width: 100%; max-height: 100%; object-fit: contain; }
.ass-modelo-img[hidden], .ass-modelo-vazio[hidden] { display: none; }
.ass-modelo-vazio { color: var(--cinza); font-size: 15px; text-align: center; }

/* 2 — Pôr nas páginas */
.ass-por { display: flex; flex-wrap: wrap; gap: 8px; }
.ass-texto { display: grid; gap: 12px; max-width: 520px; padding: 16px; border: 1px solid var(--preto); background: var(--branco); }
.ass-texto[hidden] { display: none; }
.ass-texto-acoes { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; }
.ass-rubricar-linha { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 20px; }
.ass-cor-amostra { display: inline-block; flex: none; width: 14px; height: 14px; margin-right: 8px; border: 1px solid var(--preto); }
.ass-cor-amostra--preto { background: #141418; }
.ass-cor-amostra--azul { background: #1A3F9C; }
.escolha input:checked + span .ass-cor-amostra { border-color: var(--branco); }

/* 3 — Editor */
.ass-doc { max-width: 520px; }
.ass-doc[hidden] { display: none; }
.ass-resumo { margin: 0; font-size: 15px; font-weight: 600; min-height: 1.45em; }
.ass-grande { display: grid; gap: 12px; justify-items: start; padding: 16px 20px; border: 1px solid var(--preto); background: var(--branco); }
.ass-grande[hidden] { display: none; }
.ass-grande p { margin: 0; }

/* Janela de criar a assinatura */
.ass-dialogo {
  width: min(640px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); padding: 0;
  border: 1px solid var(--preto); background: var(--branco); color: var(--preto); overflow: auto;
}
.ass-dialogo::backdrop { background: rgba(10, 10, 10, 0.55); }
.ass-dialogo-corpo { display: grid; gap: 20px; padding: 24px; }
@media (max-width: 640px) { .ass-dialogo-corpo { padding: 18px 16px; gap: 16px; } }
.ass-dialogo-titulo { margin: 0; font-size: 24px; line-height: 1.15; font-weight: 700; }
.ass-painel { display: grid; gap: 12px; min-width: 0; }
.ass-painel[hidden] { display: none; }
.ass-painel-acoes { display: flex; flex-wrap: wrap; gap: 8px; }
.ass-dialogo-acoes { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; }
.ass-dialogo-nota { font-size: 14px; }

/* Desenhar: área branca com uma linha de base, como numa folha. */
.ass-area { position: relative; height: 200px; border: 1px solid var(--preto); background: var(--branco); }
.ass-dialogo[data-tipo="rubrica"] .ass-area { height: 170px; max-width: 360px; }
.ass-canvas { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; cursor: crosshair; }
.ass-area-linha { position: absolute; left: 8%; right: 8%; bottom: 28%; border-bottom: 1px solid var(--linha); pointer-events: none; }

/* Digitar: o nome em cada estilo, como um botão grande. */
.ass-estilos { display: grid; gap: 8px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); }
.ass-estilo { position: relative; display: block; cursor: pointer; }
.ass-estilo input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.ass-estilo-amostra {
  display: flex; align-items: center; height: 72px; padding: 0 16px; border: 1px solid var(--linha);
  font-size: 34px; line-height: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ass-estilo input:checked ~ .ass-estilo-amostra { border: 2px solid var(--preto); padding: 0 15px; }
.ass-estilo input:focus-visible ~ .ass-estilo-amostra { outline: 2px solid var(--laranja); outline-offset: 2px; }
.ass-estilo-amostra--1 { font-family: 'dc-assinatura-1', cursive; font-weight: 500; }
.ass-estilo-amostra--2 { font-family: 'dc-assinatura-2', cursive; font-size: 38px; }
.ass-estilo-amostra--3 { font-family: 'dc-assinatura-3', cursive; font-size: 44px; }
.ass-estilo-amostra--4 { font-family: 'dc-assinatura-4', cursive; font-weight: 500; }

/* Foto: a foto limpa (só a tinta) sobre xadrez claro, com o retângulo do corte por cima. */
.ass-foto { position: relative; justify-self: start; max-width: 100%; line-height: 0; }
.ass-foto[hidden] { display: none; }
.ass-foto-canvas {
  display: block; max-width: 100%; max-height: 50vh; width: auto; height: auto;
  border: 1px solid var(--preto);
  background-color: var(--branco);
  background-image: linear-gradient(45deg, var(--superficie) 25%, transparent 25%, transparent 75%, var(--superficie) 75%),
    linear-gradient(45deg, var(--superficie) 25%, transparent 25%, transparent 75%, var(--superficie) 75%);
  background-size: 16px 16px; background-position: 0 0, 8px 8px;
}
.ass-corte { position: absolute; box-sizing: border-box; border: 2px dashed var(--laranja); cursor: move; touch-action: none; }
.ass-corte-alca { position: absolute; width: 16px; height: 16px; background: var(--laranja); border: 2px solid var(--branco); box-sizing: border-box; }
.ass-corte-alca::after { content: ''; position: absolute; inset: -12px; }
.ass-corte-alca--ec { left: -9px; top: -9px; cursor: nwse-resize; }
.ass-corte-alca--dc { right: -9px; top: -9px; cursor: nesw-resize; }
.ass-corte-alca--eb { left: -9px; bottom: -9px; cursor: nesw-resize; }
.ass-corte-alca--db { right: -9px; bottom: -9px; cursor: nwse-resize; }
.ass-foto-ajustes { display: grid; gap: 8px; max-width: 420px; }
.ass-foto-ajustes[hidden] { display: none; }
.ass-sensibilidade { width: 100%; accent-color: var(--preto); }
.ass-foto-info { margin: 0; font-size: 15px; }
.ass-foto-info:empty { display: none; }

@media (max-width: 640px) {
  .ass-por .botao { flex: 1 1 140px; justify-content: center; }
}

/* Resultado: a página assinada, desenhada do PDF pronto. */
.ass-resultado { display: grid; gap: 8px; justify-items: start; margin: 0; }
.ass-resultado-img { display: block; width: auto; max-width: min(100%, 260px); height: auto; border: 1px solid var(--preto); background: var(--branco); }
.ass-resultado figcaption { color: var(--cinza); overflow-wrap: anywhere; }

/* "Ficaram de fora" (tela "pronto"): igual a Girar PDF e Marca d'água. */
.lote-fora { display: grid; gap: 8px; padding: 16px 20px; border: 1px solid var(--preto); background: var(--branco); }
.lote-fora ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 10px; font-size: 15px; line-height: 1.45; }
.lote-fora li { display: grid; grid-template-columns: 7px minmax(0, 1fr); column-gap: 10px; align-items: baseline; }
.lote-fora li::before { content: ''; grid-row: 1; width: 7px; height: 7px; background: var(--laranja); }
.lote-fora-nome { font-weight: 600; overflow-wrap: anywhere; text-decoration: line-through; text-decoration-thickness: 1px; }
.lote-fora-motivo { grid-column: 2; overflow-wrap: anywhere; }

/* Só no app instalado (pwa/foto-tela.js, molde "paginas"): o editor (data-app-palco) fica no meio da
   tela, com as páginas rolando na altura que sobra, sobre o escuro, e a barra da peça escolhida em
   cima; as opções ficam nas abas do pé, mais juntas. A janela de criar não tem aba: aberta, aparece
   por cima de tudo (o molde esconde o que não tem aba). */
.ft .ft-palco > .ed { display: flex; flex-direction: column; overflow: hidden; padding: 0; background: none; }
.ft .ft-palco > .ed .ed-rolagem { flex: 1 1 auto; height: auto; min-height: 0; border: 0; background: none; overscroll-behavior: contain; }
.ft .ft-palco > .ed .ed-lista { padding: 6px 12px 64px; }
.ft .ft-palco > .ed .ed-num { color: #D6D6D2; }
.ft .ft-palco > .ed .ed-estado { margin: 0; padding: 12px 16px; color: #D6D6D2; }
.ft .ft-palco > .ed .ed-barra { flex: none; border: 0; border-bottom: 1px solid #3A3A3A; }
.ft .ass-dialogo[open] { display: block !important; }
.ft .ass, .ft .ass-passo { gap: 12px; }
.ft .ass-modelos { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; max-width: none; }
.ft .ass-modelo { gap: 6px; }
.ft .ass-modelo-caixa { height: 60px; padding: 6px; }
.ft .ass-modelo-vazio { font-size: 13px; }
.ft .ass-modelo .botao { width: 100%; justify-content: center; padding: 10px 8px; font-size: 14px; }
.ft .ass-por { flex-wrap: nowrap; }
.ft .ass-por .botao { flex: 1 1 0; min-width: 0; justify-content: center; padding: 12px 8px; }
.ft .ass-texto { padding: 12px; max-width: none; }
.ft .ass-rubricar .opcoes-dica { margin-top: 8px; }
