/* PROTÓTIPO do editor em página A4 (decisão EDITOR-A, 13/10/2026) — public/js/editor-pagina.js.
   A folha é papel branco com texto preto também no modo escuro (é o que sai no Word). */

.ep-mesa { background: #e6e8ec; border-radius: 10px; padding: 24px 12px; overflow-x: auto; }
.ep-area { position: relative; margin: 0 auto; }
.ep-fundo { position: absolute; inset: 0; pointer-events: none; }
.ep-folha { position: absolute; left: 0; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .18), 0 6px 18px rgba(0, 0, 0, .08); }
.ep-folha-cab, .ep-folha-rod { position: absolute; overflow: hidden; opacity: .72; color: #000; white-space: pre-wrap; }
.ep-folha-guia { position: absolute; right: -34px; top: 4px; font: 11px/1 var(--font, system-ui, sans-serif); color: #7a808a; }
.ep-coluna { position: relative; z-index: 1; box-sizing: border-box; color: #000; }

.ep-fluxo { outline: none; white-space: pre-wrap; overflow-wrap: break-word; caret-color: #000; min-height: 2em; }
.ep-fluxo:focus-visible { outline: none; }
.ep-area .ep-p { margin: 0; white-space: pre-wrap; overflow-wrap: break-word;
  /* O Word não usa ligaduras nem ajuste entre pares de letras por padrão */
  font-kerning: none; font-variant-ligatures: none; hyphens: manual; }
.ep-n { font-weight: 700; }
.ep-i { font-style: italic; }
.ep-s { text-decoration: underline; }
.ep-lacuna { background: #ffff00; }
.ep-selo { color: #6b6f76; }
.ep-lista::before { content: '–'; display: inline-block; width: var(--ep-marcador, .63cm); text-indent: 0; font-weight: 400; font-style: normal; text-decoration: none; }
.ep-quebra { display: inline-block; width: 100%; vertical-align: top; user-select: none; -webkit-user-select: none; }
.ep-fixo { opacity: .55; cursor: default; user-select: none; -webkit-user-select: none; }
.ep-imagem { display: inline-block; padding: 0 4px; border: 1px dashed #9aa0a8; color: #6b6f76; font-size: 9pt; }
.ep-tabela { outline: 1px dashed #c3c7cd; outline-offset: -1px; }
.ep-nota { font-size: .67em; }
.ep-notas { margin: 18px auto 0; background: #fff; padding: 12px 16px; box-sizing: border-box; max-width: 100%; color: #000; border-radius: 4px; }
.ep-notas-t { font: 600 12px var(--font, system-ui, sans-serif); color: #5b616b; margin-bottom: 6px; }

/* Página de teste */
.et-faixa { background: #fff4d6; border: 1px solid #ead9b0; color: #6a4b00; border-radius: 8px; padding: 8px 12px; font-size: 13px; margin: 0 0 12px; }
.et-faixa strong { letter-spacing: .06em; }
.et-barra { position: sticky; top: 0; z-index: 5; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; background: #fff; border: 1px solid #dde3ea; border-radius: 10px; padding: 8px; margin: 0 0 10px; }
.et-barra button, .et-barra select { font: 13px var(--font, system-ui, sans-serif); border: 1px solid #d6dde6; background: #fff; border-radius: 6px; padding: 5px 9px; cursor: pointer; color: #1d2b3a; }
.et-barra button[aria-pressed="true"] { background: #dff0f1; border-color: #0e5c64; }
.et-barra .et-sep { width: 1px; align-self: stretch; background: #e3e7ec; margin: 0 2px; }
.et-barra .et-b { font-weight: 700; } .et-barra .et-i { font-style: italic; } .et-barra .et-u { text-decoration: underline; }
.et-lado { display: grid; grid-template-columns: 1fr; gap: 14px; }
.et-lado.duas { grid-template-columns: repeat(auto-fit, minmax(min(100%, 560px), 1fr)); }
.et-titulo-mesa { font-size: 13px; font-weight: 600; color: #1d2b3a; margin: 0 0 6px; display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.et-titulo-mesa span { font-weight: 500; color: #5b616b; }
.et-avisos { font-size: 12.5px; color: #5b616b; margin: 6px 0 10px; padding-left: 18px; }
.et-avisos li { margin: 2px 0; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .et-barra { background: #fff; }
}

/* ── Editor próprio em A4 para toda peça (G05-1, esboço aprovado em 12/11/2026) ──
   Marcas novas, chamada de nota, numeração, tabela e imagem: o mesmo que sai no Word gerado. */
.ep-r { text-decoration: line-through; }
.ep-s.ep-r { text-decoration: underline line-through; }
.ep-sup { vertical-align: super; font-size: .67em; }
.ep-sub { vertical-align: sub; font-size: .67em; }
.ep-h { background: #ffff00; }
/* Chamada de nota: a âncora (1 caractere) fica invisível; o número vem do contador, na ordem do texto,
   junto com as marcas [Fonte: …], que também viram nota no Word */
.ep-fluxo { counter-reset: ep-nota ep-par ep-item; }
.ep-nota-ref { font-size: 0; }
.ep-nota-ref::after { counter-increment: ep-nota; content: counter(ep-nota); font-size: calc(var(--ep-fs, 12pt) * .67); vertical-align: super; line-height: 0; cursor: help; }
.ep-selo::after { counter-increment: ep-nota; content: counter(ep-nota); font-size: .67em; vertical-align: super; line-height: 0; color: #000; }
/* Lista numerada (recomeça a cada lista) e numeração dos parágrafos de texto */
.ep-numerada { counter-increment: ep-item; }
.ep-fluxo > :not(.ep-numerada) + .ep-numerada, .ep-fluxo > .ep-numerada:first-child { counter-reset: ep-item; counter-increment: ep-item; }
.ep-numerada::before { content: counter(ep-item) '.'; display: inline-block; width: var(--ep-marcador, .63cm); text-indent: 0; font-weight: 400; font-style: normal; text-decoration: none; }
.ep-fluxo.ep-numerar > .ep-corpo.ep-cheio { counter-increment: ep-par; }
.ep-fluxo.ep-numerar > .ep-corpo.ep-cheio::before { content: counter(ep-par) '. '; font-weight: 400; font-style: normal; text-decoration: none; }
/* Tabela e imagem (fora da digitação do texto, com os controles delas) */
.ep-ilha { position: relative; margin: 0 0 6pt; white-space: normal; }
.ep-tab { width: 100%; border-collapse: collapse; table-layout: fixed; line-height: 1.15; }
.ep-tab td, .ep-tab th { border: 1px solid #000; padding: .1cm .15cm; vertical-align: top; text-align: left; font-weight: 400; overflow-wrap: anywhere; outline: none; }
.ep-tab th { font-weight: 700; background: #e7e9ed; }
.ep-tab td:focus, .ep-tab th:focus { box-shadow: inset 0 0 0 2px #0e5c64; }
.ep-img { display: inline-block; max-width: 100%; object-fit: fill; }
.ep-ilha-ferr { display: none; position: absolute; left: 0; top: calc(100% + 2px); z-index: 6; gap: 4px; flex-wrap: wrap; align-items: center; background: #fff; border: 1px solid #d6dde6; border-radius: 8px; padding: 4px; box-shadow: 0 4px 14px rgba(0,0,0,.12); font: 12px var(--font, system-ui, sans-serif); color: #1d2b3a; }
.ep-ilha:hover .ep-ilha-ferr, .ep-ilha:focus-within .ep-ilha-ferr { display: flex; }
.ep-ilha-bt { font: 12px var(--font, system-ui, sans-serif); border: 1px solid #d6dde6; background: #fff; border-radius: 6px; padding: 3px 8px; cursor: pointer; color: #1d2b3a; }
.ep-ilha-campo { display: inline-flex; gap: 4px; align-items: center; }
.ep-ilha-campo input { font: 12px var(--font, system-ui, sans-serif); border: 1px solid #d6dde6; border-radius: 6px; padding: 2px 6px; width: 7em; }
.ep-ilha-campo input[type=number] { width: 4.5em; }
/* Régua: margens do modelo em cinza; marcadores da 1ª linha (em cima), esquerdo e direito (embaixo) */
.ep-regua { position: sticky; top: 0; z-index: 7; height: 24px; margin: 0 auto 8px; background: #f3f4f6; border: 1px solid #d6dde6; border-radius: 3px; box-sizing: border-box; user-select: none; -webkit-user-select: none; }
.ep-regua-faixa { position: absolute; top: 0; bottom: 0; background: #fff; }
.ep-regua-t { position: absolute; bottom: 0; width: 1px; height: 4px; background: #9aa0a8; font: 9px/1 var(--font, system-ui, sans-serif); color: #5b616b; }
.ep-regua-t-cm { height: 7px; }
.ep-regua-n { position: absolute; bottom: 9px; left: 0; transform: translateX(-50%); font: 9px/1 var(--font, system-ui, sans-serif); color: #5b616b; }
.ep-regua-m { position: absolute; width: 0; height: 0; border-left: 6px solid transparent; border-right: 6px solid transparent; margin-left: -6px; cursor: ew-resize; touch-action: none; outline: none; }
.ep-regua-pri { top: 0; border-top: 8px solid #0e5c64; }
.ep-regua-esq, .ep-regua-dir { bottom: 0; border-bottom: 8px solid #0e5c64; }
.ep-regua-m:focus-visible { filter: drop-shadow(0 0 2px #0e5c64); }
.ep-regua-ilha .ep-regua-m { opacity: .35; }
.ep-regua-dica { position: absolute; top: 26px; transform: translateX(-50%); background: #1d2b3a; color: #fff; font: 11px/1.4 var(--font, system-ui, sans-serif); padding: 1px 6px; border-radius: 4px; white-space: nowrap; z-index: 8; }

/* Editor A4 em tela inteira (public/js/editor-a4.js): janela da minuta e peça por perguntas */
.ea-tela { position: fixed; inset: 0; z-index: 900; background: #fff; display: flex; flex-direction: column; color: #1d2b3a; font-family: var(--font, system-ui, sans-serif); }
.ea-topo { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 8px 16px; border-bottom: 1px solid #e3e8ee; }
.ea-titulo { flex: 1 1 200px; min-width: 0; margin: 0; font-size: 15px; font-weight: 700; color: var(--navy, #1d2b3a); overflow-wrap: anywhere; }
.ea-titulo small { display: block; font-weight: 500; font-size: 12px; color: #5d6b7e; }
.ea-salvo { font-size: 12px; color: #2f6b3a; }
.ea-acoes { display: flex; gap: 6px; flex-wrap: wrap; }
.ea-barra { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; padding: 6px 16px; border-bottom: 1px solid #e3e8ee; background: #fafbfc; position: relative; }
.ea-grupo { display: flex; gap: 3px; align-items: center; flex-wrap: wrap; }
.ea-grupo + .ea-grupo { padding-left: 10px; border-left: 1px solid #e3e7ec; }
.ea-b, .ea-sel { font: 13px var(--font, system-ui, sans-serif); border: 1px solid #d6dde6; background: #fff; border-radius: 999px; padding: 4px 10px; cursor: pointer; color: #1d2b3a; min-height: 30px; }
.ea-b[aria-pressed="true"] { background: #dff0f1; border-color: #0e5c64; color: #0e5c64; }
.ea-b-p { background: var(--petroleo, #0e5c64); border-color: var(--petroleo, #0e5c64); color: #fff; }
.ea-b:focus-visible, .ea-sel:focus-visible { outline: 2px solid #0e5c64; outline-offset: 1px; }
.ea-desf { font-size: 12px; color: #5d6b7e; display: inline-flex; align-items: center; gap: 2px; }
.ea-desf-b, .ea-link { border: 0; background: none; padding: 0 2px; color: #0e5c64; text-decoration: underline; cursor: pointer; font: inherit; }
.ea-ancora { position: relative; display: inline-flex; }
.ea-pop { position: absolute; top: calc(100% + 4px); left: 0; z-index: 20; display: flex; gap: 6px; align-items: center; background: #fff; border: 1px solid #d6dde6; border-radius: 10px; padding: 8px; box-shadow: 0 6px 18px rgba(0,0,0,.12); }
.ea-campo { font-size: 12px; display: inline-flex; gap: 4px; align-items: center; }
.ea-campo input { width: 4.2em; font: 13px var(--font, system-ui, sans-serif); border: 1px solid #d6dde6; border-radius: 6px; padding: 3px 6px; }
.ea-loc { flex-basis: 100%; display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.ea-loc input { font: 13px var(--font, system-ui, sans-serif); border: 1px solid #d6dde6; border-radius: 6px; padding: 4px 8px; min-width: 0; flex: 1 1 140px; max-width: 260px; }
.ea-loc-msg { font-size: 12px; color: #5d6b7e; }
.ea-msg { margin: 0; padding: 0 16px; font-size: 13px; color: #a12a2a; }
.ea-msg:empty { display: none; }
.ea-corpo { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) 280px; }
.ea-rolagem { overflow: auto; background: #e6e8ec; padding: 16px 12px 40px; }
.ea-mesa { min-width: min-content; }
.ea-lado { overflow: auto; border-left: 1px solid #e3e8ee; padding: 12px; background: #fff; }
.ea-painel { border: 1px solid #e3e8ee; border-radius: 10px; padding: 10px; margin-bottom: 10px; }
.ea-painel h3 { margin: 0 0 6px; font-size: 13px; }
.ea-item { display: block; width: 100%; text-align: left; border: 0; border-top: 1px solid #eef1f4; background: none; padding: 6px 2px; cursor: pointer; font: 12.5px var(--font, system-ui, sans-serif); color: #1d2b3a; }
.ea-lac { background: #ffff00; }
.ea-mini { font-size: 12px; color: #5d6b7e; margin: 4px 0; }
.ea-nota { border-top: 1px solid #eef1f4; padding: 6px 0; }
.ea-nota-cab { display: flex; justify-content: space-between; gap: 6px; font-size: 12.5px; }
.ea-nota textarea { width: 100%; box-sizing: border-box; font: 12.5px var(--font, system-ui, sans-serif); border: 1px solid #d6dde6; border-radius: 6px; padding: 4px 6px; resize: vertical; margin-top: 4px; }
@media (max-width: 860px) {
  .ea-corpo { grid-template-columns: 1fr; grid-template-rows: minmax(0, 1fr) auto; }
  .ea-lado { border-left: 0; border-top: 1px solid #e3e8ee; max-height: 34vh; }
}
@media (prefers-reduced-motion: reduce) { .ea-tela * { scroll-behavior: auto !important; } }
