/* SPDX-License-Identifier: GPL-3.0-or-later */
/* Modelos de relatório — padrão Glaux (tokens de glaux_theme.css, tipografia Nunito). Página do shell: <main class="reurb-page">. */
.rm-vazio, .rm-vazio-cartao p { color: var(--glx-muted, #6B7585); font-size: 13px; }
.rm-vazio-cartao { padding: 32px; text-align: center; background: #fff; border-radius: 18px; border: 1px solid #E2E8F0; }

/* lista */
.rm-lista { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.rm-cartao { background: #fff; border: 1px solid #E2E8F0; border-radius: 18px; padding: 16px 18px; display: flex; flex-direction: column; gap: 6px; }
.rm-cartao-topo { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 8px 10px; }
.rm-cartao-topo h2 { min-width: 0; overflow-wrap: anywhere; }
.rm-cartao h2 { margin: 0; font: 800 17px/1.25 var(--glx-font); }
.rm-selo { display: inline-flex; align-items: center; justify-content: center; flex: none; max-width: 100%; white-space: nowrap !important; text-align: center; line-height: 1; padding: 3px 8px; border-radius: 999px; background: #EEF4FA; color: #1B2D47; font: 800 10.5px var(--glx-font); text-transform: uppercase; letter-spacing: .05em; }
.rm-cartao-desc { margin: 0; font-size: 13px; color: var(--glx-text-secondary, #475569); flex: 1; }
.rm-cartao-meta { margin: 0; font-size: 12px; color: var(--glx-muted, #6B7585); }
.rm-cartao-acoes { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 6px; }
.rm-perigo { color: #B42318; }

/* editor */
.rm-editor { display: flex; flex-direction: column; gap: 12px; }
.rm-ed-barra { display: flex; align-items: center; gap: 12px; padding: 8px 14px; flex-wrap: wrap; background: #fff; border-radius: 18px; box-shadow: 0 1px 3px rgba(15,23,42,.04); }
.rm-ed-barra strong { font: 800 15px var(--glx-font); }
.rm-ed-aviso { flex: 1; font-size: 12.5px; font-weight: 600; color: var(--glx-muted, #6B7585); }
.rm-ed-aviso[data-tipo="erro"], .rm-aviso[data-tipo="erro"] { color: #B42318; }
.rm-ed-aviso[data-tipo="ok"] { color: #15803D; }
.rm-ed-grade { display: grid; grid-template-columns: 310px minmax(0, 1fr) 330px; gap: 14px; align-items: start; }
.rm-col { min-width: 0; display: flex; flex-direction: column; gap: 12px; }
.rm-bloco-cfg, .rm-sec, .rm-props, .rm-vars { background: #fff; box-shadow: 0 1px 3px rgba(15,23,42,.04); border-radius: 18px; padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; }
.rm-sec > summary { cursor: pointer; font: 800 12px var(--glx-font); text-transform: uppercase; letter-spacing: .08em; color: var(--glx-muted, #6B7585); }
.rm-sec[open] > summary { margin-bottom: 6px; }
.rm-contagem { font-weight: 600; letter-spacing: 0; }
.rm-main label { display: flex; flex-direction: column; gap: 3px; font: 700 11.5px var(--glx-font); color: var(--glx-muted, #6B7585); }
.rm-main label.rm-chk { flex-direction: row; align-items: center; gap: 8px; font: 600 13px var(--glx-font); color: var(--glx-text, #1F2733); }
.rm-main label.glx-btn, .rm-main label.rm-arquivo, .rm-main label.rm-cor-linha-badge, .rm-main label.ath-btn-slot-img {
  flex-direction: row !important;
  align-items: center !important;
  justify-content: center;
  gap: 6px;
}
.rm-main input[type="text"], .rm-main input[type="number"], .rm-main input:not([type]), .rm-main input[type="search"], .rm-main textarea {
  width: 100%; border: 1px solid #CBD5E1; border-radius: 12px; background: #fff; padding: 7px 11px; font: 600 13px var(--glx-font); color: var(--glx-text, #1F2733); box-sizing: border-box; }
.rm-main select.glx-select {
  width: 100%; min-width: 0; border: 1px solid #CBD5E1; border-radius: 12px; background: #fff; padding: 6px 24px 6px 10px; font: 600 12px var(--glx-font); color: var(--glx-text, #1F2733); box-sizing: border-box; text-overflow: ellipsis;
}
.rm-main textarea { resize: vertical; line-height: 1.4; }
.rm-main input:focus, .rm-main textarea:focus, .rm-main select.glx-select:focus { outline: none; border-color: var(--glx-primary, #314F79); box-shadow: 0 0 0 3px rgba(49, 79, 121, 0.16); }
.rm-linha2, .ath-linha2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; align-items: end; }
.rm-logo-prev { display: flex; align-items: center; gap: 10px; }
.rm-logo-prev img { max-height: 40px; max-width: 120px; object-fit: contain; border-radius: 6px; background: #fff; }
.rm-add { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.rm-blocos { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 5px; width: 100%; box-sizing: border-box; }
.rm-bl {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  border-radius: 12px;
  background: #fff;
  border: 1.5px solid #E2E8F0;
  padding: 4px 6px 4px 4px;
  width: 100%;
  box-sizing: border-box;
  transition: border-color .14s ease, background .14s ease, box-shadow .14s ease;
}
.rm-bl:hover {
  border-color: #CBD5E1;
  background: #F8FAFC;
}
.rm-bl.sel {
  border-color: var(--glx-primary, #314F79);
  background: #EEF4FA;
  box-shadow: 0 2px 6px rgba(49, 79, 121, 0.12);
}
.rm-bl-nome { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; text-align: left; background: none; border: 0; padding: 4px 6px; cursor: pointer; font-family: var(--glx-font); }
.rm-bl-nome strong { font-size: 12px; font-weight: 800; line-height: 1.25; color: var(--glx-text, #1F2733); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }
.rm-bl-nome span { font-size: 11px; color: var(--glx-muted, #6B7585); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.rm-bl-acoes { display: flex; align-items: center; gap: 1px; flex: none; user-select: none; -webkit-user-drag: none; }
.rm-bl-acoes .rm-ic { width: 22px; height: 22px; }
.rm-bl-acoes button { user-select: none; -webkit-user-drag: none; }
.rm-bl-acoes svg, .rm-bl-acoes path, .rm-ic svg, .rm-ic path { pointer-events: none; }
.rm-ic { width: 26px; height: 26px; display: inline-flex; align-items: center; justify-content: center; border: 0; border-radius: 50%; background: transparent; color: #64748B; cursor: pointer; }
.rm-ic:hover { background: #F1F5F9; color: var(--glx-text, #1F2733); }
.rm-ic-perigo:hover { background: #FDE8E6; color: #B42318; }

/* prévia */
.rm-col-prev { position: sticky; top: 0; }
.rm-prev-topo { display: flex; align-items: baseline; gap: 10px; }
.rm-prev-info { font-size: 12px; color: var(--glx-muted, #6B7585); }
.rm-prev { width: 100%; height: min(78vh, 1000px); border: 1px solid #E2E8F0; border-radius: 18px; background: #EEF1F5; }

/* propriedades e variáveis */
.rm-props h3 { margin: 0 0 4px; font: 800 14px var(--glx-font); }
.rm-rot { font: 800 11px var(--glx-font); text-transform: uppercase; letter-spacing: .08em; color: var(--glx-muted, #6B7585); }
.rm-itens { display: flex; flex-direction: column; gap: 6px; }
.rm-item { display: grid; grid-template-columns: 1fr 1fr 26px; gap: 6px; align-items: center; }
.rm-cols { max-height: 220px; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; padding-right: 2px; scrollbar-width: thin; }
.rm-vars { max-height: 52vh; }
.rm-vars-topo { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.rm-vars-topo strong { font: 800 13px var(--glx-font); }
.rm-vars-dica { font-size: 11px; color: var(--glx-muted, #6B7585); }
.rm-var-lista { overflow-y: auto; display: flex; flex-direction: column; gap: 4px; padding-right: 2px; scrollbar-width: thin; }
.rm-vgrupo > summary { cursor: pointer; font: 800 11px var(--glx-font); text-transform: uppercase; letter-spacing: .07em; color: var(--glx-muted, #6B7585); padding: 4px 2px; }
.rm-var { display: flex; flex-direction: column; align-items: flex-start; width: 100%; text-align: left; border: 0; border-radius: 12px; background: #fff; padding: 5px 10px; margin: 2px 0; cursor: pointer; font-family: var(--glx-font); }
.rm-var:hover { background: #EEF4FA; }
.rm-var span { font-size: 12.5px; font-weight: 700; }
.rm-var code { font-size: 10.5px; color: var(--glx-muted, #6B7585); font-family: var(--glx-font-mono, ui-monospace, monospace); }

/* gerar */
.rm-dialog { border: 0; border-radius: 24px; padding: 0; width: min(560px, calc(100vw - 32px)); box-shadow: 0 24px 60px rgba(31, 39, 51, .28); }
.rm-dialog::backdrop { background: rgba(15, 23, 42, .55); }
.rm-dlg-corpo { padding: 22px 24px; display: flex; flex-direction: column; gap: 10px; }
.rm-dlg-corpo h2 { margin: 0; font: 800 19px var(--glx-font); }
.rm-dlg-sub { margin: 0; font-size: 13px; color: var(--glx-muted, #6B7585); }
.rm-alvo { display: flex; flex-direction: column; gap: 10px; }
.rm-marcaveis { display: flex; flex-direction: column; gap: 6px; }
.rm-marc-lista { max-height: 240px; overflow-y: auto; display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 2px 12px; padding-right: 2px; scrollbar-width: thin; }
.rm-todos { font-weight: 800; }
.rm-aviso { min-height: 18px; margin: 0; font-size: 12.5px; font-weight: 600; color: var(--glx-muted, #6B7585); }
.rm-dlg-acoes { display: flex; justify-content: flex-end; gap: 8px; }

.rm-vazio-cartao { grid-column: 1 / -1; }
.rm-comecar { display: flex; flex-direction: column; gap: 8px; }
.rm-opcao { display: flex; flex-direction: column; gap: 2px; text-align: left; padding: 12px 16px; border: 1px solid #E6E9EF; border-radius: 18px; background: #fff; cursor: pointer; font-family: var(--glx-font); }
.rm-opcao:hover { border-color: var(--glx-primary, #314F79); background: #EEF4FA; }
.rm-opcao strong { font-size: 14px; font-weight: 800; } .rm-opcao span { font-size: 12.5px; color: var(--glx-muted, #6B7585); }

.rm-toast { margin: 0; padding: 10px 16px; border-radius: 999px; background: #EEF4FA; color: #1B2D47; font: 700 13px var(--glx-font); }
.rm-toast[hidden] { display: none; }

.rm-acoes-lista { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.rm-acoes-lista[hidden] { display: none; }
.rm-acoes-lista strong { font: 800 15px var(--glx-font); }


/* ---- Correções de padrão do editor (caixas dentro dos painéis, setas, caixas de marcar, botão de arquivo) ---- */
.rm-main *, .rm-main *::before, .rm-main *::after { box-sizing: border-box; }
.rm-main input:not([type="checkbox"]):not([type="file"]), .rm-main textarea, .rm-main select { max-width: 100%; min-width: 0; }
.rm-main input:not([type="checkbox"]):not([type="file"]) { height: 36px; border-radius: 999px; padding: 0 14px; }
.rm-main textarea { border-radius: 16px; padding: 9px 14px; }
.rm-main .glx-custom-select-wrap { width: 100%; min-width: 0; }
.rm-item { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 26px; }
.rm-itens > .glx-btn { align-self: flex-start; }
.rm-dica { font-size: 11.5px; color: var(--glx-muted, #6B7585); }

/* seta de abrir/fechar: a mesma "seta aberta" do resto do sistema, no lugar do triângulo do navegador */
.rm-main summary { list-style: none; display: flex; align-items: center; gap: 8px; }
.rm-main summary::-webkit-details-marker { display: none; }
.rm-main summary::marker { content: ''; }
.rm-main summary::before { content: ''; flex: none; width: 12px; height: 12px; background: currentColor; transition: transform .15s ease;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M9 3.5l7.5 8.5-7.5 8.5'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M9 3.5l7.5 8.5-7.5 8.5'/%3E%3C/svg%3E") center / contain no-repeat; }
.rm-main details[open] > summary::before { transform: rotate(90deg); }

/* caixas de marcar no nosso traço */
.rm-main input[type="checkbox"] { appearance: none; -webkit-appearance: none; flex: none; width: 18px; height: 18px; margin: 0; border: 1.5px solid #CBD5E1; border-radius: 6px; background: #fff; cursor: pointer; display: inline-grid; place-content: center; transition: background .12s, border-color .12s; }
.rm-main input[type="checkbox"]:checked { background: var(--glx-primary, #314F79); border-color: var(--glx-primary, #314F79); }
.rm-main input[type="checkbox"]:checked::after { content: ''; width: 9px; height: 5px; border: 2px solid #fff; border-top: 0; border-right: 0; transform: rotate(-45deg) translate(1px, -1px); }
.rm-main input[type="checkbox"]:focus-visible { outline: 2px solid var(--glx-primary, #314F79); outline-offset: 2px; }

/* botão de arquivo: rótulo no padrão dos botões, input escondido */
.rm-main label.rm-arquivo { flex-direction: row; align-items: center; align-self: flex-start; gap: 8px; cursor: pointer; width: auto; font: 700 12px var(--glx-font); color: var(--glx-text, #1F2733); }
.rm-arquivo svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.rm-logo-prev { flex-wrap: wrap; }
.rm-sec[open] > summary, .rm-vgrupo[open] > summary { margin-bottom: 4px; }
.rm-var-lista, .rm-props, .rm-bloco-cfg, .rm-sec { min-width: 0; }
.rm-cols .rm-chk { padding: 2px 0; }
.rm-main label.rm-arquivo { width: fit-content !important; align-self: flex-start !important; }

/* Editor com altura fixa: o canvas (prévia) não se move; só as colunas laterais rolam, cada uma sozinha. */
.rm-conteudo:has(> .rm-editor:not([hidden])) { overflow: hidden; height: 100vh; }
.rm-editor:not([hidden]) { flex: 1 1 0; min-height: 0; display: flex; flex-direction: column; height: 100%; overflow: hidden; }
.rm-ed-grade { flex: 1 1 0; min-height: 0; align-items: stretch; height: 100%; overflow: hidden; }
.rm-col-esq, .rm-col-dir { min-height: 0; overflow-y: auto; padding-right: 4px; scrollbar-width: thin; }
.rm-col-prev { position: relative !important; min-height: 0; flex: 1 1 0; height: 100%; }
.rm-col-prev .rm-prev { flex: 1 1 0; height: auto; min-height: 0; }
.rm-col-dir .rm-vars { max-height: none; flex: 0 0 auto; }


/* Folha A4 real na prévia, blocos ao lado dela e seletor de grade */
.rm-prev-topo { flex-wrap: wrap; gap: 4px 12px; }
.rm-guia { margin-left: auto; font: 600 12.5px var(--glx-font); }
.rm-col-prev .rm-add { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 8px 10px; background: #fff; border-radius: 16px; box-shadow: 0 1px 3px rgba(15, 23, 42, .04); }
.rm-prev { background: #E8ECF1; }
.rm-margens { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.rm-margens input { padding: 0 8px !important; text-align: center; }
.rm-cels { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 3px; }
.rm-cel { height: 28px; border: 1px solid #E2E8F0; border-radius: 8px; background: #F8FAFC; color: var(--glx-muted, #6B7585); font: 700 11px var(--glx-font); cursor: pointer; padding: 0; }
.rm-cel:hover { border-color: var(--glx-primary, #314F79); color: #1B2D47; }
.rm-cel.on { background: var(--glx-primary, #314F79); border-color: var(--glx-primary, #314F79); color: #fff; }
.rm-cel.ancora { box-shadow: 0 0 0 2px rgba(49, 79, 121, 0.16); }
.rm-presets { display: flex; flex-wrap: wrap; gap: 6px; }
.rm-grade-sel { display: flex; flex-direction: column; gap: 6px; padding-bottom: 8px; border-bottom: 1px solid #F1F5F9; margin-bottom: 4px; }


/* Seções recolhíveis: o título fica centrado na altura da caixa (antes sobrava espaço embaixo) */
.rm-sec { gap: 0; padding: 0 14px; }
.rm-sec > summary { min-height: 46px; padding: 0; line-height: 1; }
.rm-sec[open] { padding-bottom: 12px; gap: 8px; }
.rm-sec[open] > summary { margin-bottom: 4px; }
.rm-vgrupo > summary { min-height: 32px; line-height: 1.2; }

/* Barra de blocos: só ícones (traço Glaux), grade à direita */
.rm-barra-blocos { display: flex; align-items: center; gap: 8px; padding: 6px 10px; background: #fff; border-radius: 999px; box-shadow: 0 1px 3px rgba(15, 23, 42, .04); }
.rm-col-prev .rm-add { flex: 1 1 auto; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 0; margin: 0; background: transparent; box-shadow: none; border-radius: 0; }
.rm-ic-bt { position: relative; width: 36px; height: 36px; flex: none; display: inline-grid; place-items: center; padding: 0; border: 1px solid #E6E9EF; border-radius: 50%; background: #fff; color: #64748B; cursor: pointer; transition: background .12s, color .12s, border-color .12s; }
.rm-ic-bt[data-tip]::after { content: "+ " attr(data-tip); position: absolute; left: 50%; bottom: calc(100% + 7px); transform: translateX(-50%) translateY(3px); padding: 4px 10px; border-radius: 999px; background: #1F2733; color: #fff; font: 700 11px var(--glx-font); white-space: nowrap; pointer-events: none; opacity: 0; transition: opacity .12s ease, transform .12s ease; z-index: 40; box-shadow: 0 4px 12px rgba(31, 39, 51, .18); }
.rm-ic-bt[data-tip]:hover::after, .rm-ic-bt[data-tip]:focus-visible::after { opacity: 1; transform: translateX(-50%) translateY(0); }
.rm-ic-bt svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; display: block; }
.rm-ic-bt:hover { border-color: var(--glx-primary, #314F79); color: #1B2D47; background: #EEF4FA; }
.rm-ic-bt:focus-visible { outline: 2px solid var(--glx-primary, #314F79); outline-offset: 2px; }
.rm-ic-guia { margin-left: 0; }
.rm-ic-guia[aria-pressed="true"] { background: var(--glx-primary, #314F79); border-color: var(--glx-primary, #314F79); color: #fff; box-shadow: 0 4px 12px rgba(49, 79, 121, 0.16); }

.rm-ic-guia { --rm-ic-fundo: #fff; }
.rm-ic-guia:hover { --rm-ic-fundo: #EEF4FA; }
.rm-ic-guia[aria-pressed="true"] { --rm-ic-fundo: var(--glx-primary, #314F79); }

/* Mais respiro entre os campos e caixas de marcar redondas (círculo com visto) */
.rm-sec[open] { gap: 16px; padding-bottom: 16px; }
.rm-bloco-cfg { gap: 14px; padding: 14px; }
.rm-main label { gap: 6px; }
.rm-main label.rm-chk { gap: 10px; padding: 2px 0; line-height: 1.3; }
.rm-main label.rm-chk + label, .rm-main .rm-rot + .rm-arquivo { margin-top: 0; }
.rm-main textarea { margin-top: 0; }
.rm-main input[type="checkbox"] { width: 20px; height: 20px; border-radius: 50%; border: 1.6px solid #CBD5E1; }
.rm-main input[type="checkbox"]:hover { border-color: var(--glx-primary, #314F79); }
.rm-main input[type="checkbox"]:checked { background: var(--glx-primary, #314F79); border-color: var(--glx-primary, #314F79); }
.rm-main input[type="checkbox"]:checked::after { content: ''; width: 9px; height: 5px; border: 2px solid #fff; border-top: 0; border-right: 0; border-radius: 1px; transform: rotate(-45deg) translate(1px, -1px); }
/* o conteúdo de <details> não é item direto do flex: o afastamento vertical vai por margem */
.rm-sec[open] > summary ~ * { margin-top: 16px; margin-bottom: 0; }
.rm-sec[open] > summary ~ *:first-of-type { margin-top: 10px; }
.rm-sec[open] > summary + * { margin-top: 10px; }
.rm-sec[open] > summary { margin-bottom: 0; }


/* ---- Variáveis coloridas por tipo (como num editor de código) ---- */
.v-social { --vc: #7C3AED; --vf: rgba(124, 58, 237, .14); }
.v-fisico { --vc: #0E9F6E; --vf: rgba(14, 159, 110, .16); }
.v-vetorial { --vc: #2563EB; --vf: rgba(37, 99, 235, .13); }
.v-geral { --vc: #B45309; --vf: rgba(245, 158, 11, .20); }
.v-desconhecida { --vc: #B42318; --vf: rgba(229, 72, 77, .16); }

/* espelho atrás do campo: o texto é do campo; o espelho só pinta o fundo das variáveis */
.rm-hl { position: relative; display: block; width: 100%; }
.rm-hl > textarea, .rm-hl > input { position: relative; z-index: 1; background: transparent !important; display: block; width: 100%; }
.rm-hl-fundo { position: absolute; inset: 0; z-index: 0; overflow: hidden; pointer-events: none; color: transparent; background: #fff;
  font: 600 13px var(--glx-font); border: 1px solid transparent; box-sizing: border-box; white-space: pre; letter-spacing: normal; }
.rm-hl:not(.rm-hl-multi) > .rm-hl-fundo { height: 36px; line-height: 34px; padding: 0 14px; border-radius: 999px; }
.rm-hl-multi > .rm-hl-fundo { padding: 9px 14px; line-height: 1.4; border-radius: 16px; white-space: pre-wrap; overflow-wrap: break-word; word-break: normal; }
.rm-hl-fundo mark { color: transparent; background: var(--vf); border-radius: 5px; box-shadow: 0 0 0 1.5px var(--vf); }
.rm-hl > textarea, .rm-hl > input { color: var(--glx-text, #1F2733); }
.rm-hl:focus-within > .rm-hl-fundo { border-color: var(--glx-primary, #314F79); box-shadow: 0 0 0 3px rgba(49, 79, 121, 0.16); }
.rm-hl > textarea, .rm-hl > input { border-color: #CBD5E1; }
.rm-hl > textarea:focus, .rm-hl > input:focus { box-shadow: none !important; border-color: var(--glx-primary, #314F79); }

/* lista de variáveis com a cor do tipo */
.rm-var { border-left: 3px solid var(--vc, #CBD5E1); border-radius: 4px 12px 12px 4px; }
.rm-var code { color: var(--vc, var(--glx-muted, #6B7585)); }
.rm-var:hover { background: var(--vf, #EEF4FA); }

/* legenda no canto inferior esquerdo do editor */
.rm-legenda { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 16px; padding: 4px 8px 0; font: 600 12px var(--glx-font); color: var(--glx-muted, #6B7585); }
.rm-leg-t { font-weight: 800; text-transform: uppercase; letter-spacing: .07em; font-size: 11px; }
.rm-leg-i { display: inline-flex; align-items: center; gap: 6px; }
.rm-leg-i i { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
@media (min-width: 1181px) { .rm-editor:not([hidden]) > .rm-legenda { flex: 0 0 auto; } }


/* ---- Ajustes: espaço título→primeiro item, cor só na letra (sutil), margens da folha ---- */
.rm-sec[open] { gap: 0 !important; }
.rm-sec[open] > summary { margin-bottom: 0 !important; }
.rm-sec[open] > summary + * { margin-top: 6px !important; }
.rm-sec[open] > summary ~ * { margin-top: 14px; }
.rm-sec[open] > summary + * { margin-top: 6px !important; }

.v-social { --vc: #8E74C8; } .v-fisico { --vc: #4A9C80; } .v-vetorial { --vc: #5B86C2; } .v-geral { --vc: #A98750; } .v-desconhecida { --vc: #C0605F; }
/* o texto colorido fica no espelho (atrás); o campo real fica transparente, só com o cursor */
.rm-hl > textarea, .rm-hl > input { color: transparent !important; caret-color: var(--glx-text, #1F2733); }
.rm-hl > textarea::selection, .rm-hl > input::selection { background: rgba(49, 79, 121, 0.16); color: transparent; }
.rm-hl-fundo { color: var(--glx-text, #1F2733); }
.rm-hl-fundo mark { color: var(--vc); background: none; box-shadow: none; border-radius: 0; font: inherit; }
.rm-var { border-left-width: 2px; }
.rm-var:hover { background: #F8FAFC; }
.rm-leg-i i { width: 8px; height: 8px; }

/* margens da folha: miniatura da página + quatro campos com "mm" (padrão de InDesign/Affinity) e botão de margens iguais */
.rm-margens { display: grid; grid-template-columns: 62px minmax(0, 1fr) 34px; gap: 12px; align-items: center; }
.rm-folha-mini { position: relative; width: 62px; background: #fff; border: 1px solid #CBD5E1; border-radius: 4px; box-shadow: 0 1px 3px rgba(15, 23, 42, .1); aspect-ratio: 210 / 297; max-height: 88px; }
.rm-folha-mini i { position: absolute; border: 1px dashed var(--glx-primary, #314F79); background: rgba(49, 79, 121, 0.16); border-radius: 1px; }
.rm-margens-campos { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 10px; }
.rm-main label.rm-mm { gap: 3px; font: 700 11px var(--glx-font); color: var(--glx-muted, #6B7585); }
.rm-mm-in { position: relative; }
.rm-main .rm-mm-in input { height: 34px; width: 100%; padding: 0 30px 0 12px; text-align: left; border-radius: 999px; appearance: textfield; -moz-appearance: textfield; font-variant-numeric: tabular-nums; }
.rm-mm-in input::-webkit-outer-spin-button, .rm-mm-in input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.rm-mm-in em { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); font: 600 11px var(--glx-font); font-style: normal; color: var(--glx-muted, #6B7585); pointer-events: none; }
.rm-ic-elo { width: 34px; height: 34px; }
.rm-ic-elo[aria-pressed="true"] { background: var(--glx-primary, #314F79); border-color: var(--glx-primary, #314F79); color: #fff; }
.rm-mm-t { order: 1; } .rm-mm-b { order: 2; } .rm-mm-l { order: 3; } .rm-mm-r { order: 4; }
/* o tema global pinta o fundo de todo input/textarea com !important: aqui o fundo é do espelho */
body .rm-main .rm-hl > textarea, body .rm-main .rm-hl > input { background: transparent !important; background-color: transparent !important; box-shadow: none !important; }
/* espelho POR CIMA do campo (sem tocar no fundo do input): ele só desenha as letras; cliques e cursor passam direto para o campo */
.rm-hl-fundo { z-index: 2 !important; background: transparent !important; }
.rm-hl:focus-within > .rm-hl-fundo { border-color: transparent; box-shadow: none; }
.rm-sec[open] > summary { min-height: 38px; }


/* ---- Posição na folha: miniaturas de layout + 12 círculos (substituem os retângulos numerados) ---- */
.rm-grade-sel { gap: 10px; }
.rm-pres { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
.rm-pre { display: flex; flex-direction: column; align-items: center; gap: 5px; padding: 8px 4px 6px; border: 1px solid #E6E9EF; border-radius: 14px; background: #fff; cursor: pointer; font-family: var(--glx-font); transition: border-color .12s, background .12s; }
.rm-pre small { font: 700 10px/1.15 var(--glx-font); color: var(--glx-muted, #6B7585); text-align: center; }
.rm-pre:hover:not(:disabled) { border-color: var(--glx-primary, #314F79); background: #EEF4FA; }
.rm-pre:hover:not(:disabled) small { color: #1B2D47; }
.rm-pre:disabled { opacity: .4; cursor: not-allowed; }
.rm-pre-bar { width: 100%; height: 16px; display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 1px; background: #F1F5F9; border-radius: 4px; padding: 2px; box-sizing: border-box; }
.rm-pre-bar i { background: #D9DEE6; border-radius: 2px; }
.rm-pre-bar i.on { background: var(--glx-primary, #314F79); }
.rm-pre-bar i.ref { background: #B8C0CC; }
.rm-trilha { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); padding: 2px 0; }
.rm-pt { position: relative; height: 26px; padding: 0; border: 0; background: transparent; cursor: pointer; display: grid; place-items: center; }
.rm-pt i { position: relative; z-index: 1; width: 14px; height: 14px; border-radius: 50%; border: 1.6px solid #CBD5E1; background: #fff; transition: background .12s, border-color .12s, transform .12s; box-sizing: border-box; }
.rm-pt:hover i { border-color: var(--glx-primary, #314F79); transform: scale(1.12); }
.rm-pt.on i { background: var(--glx-primary, #314F79); border-color: var(--glx-primary, #314F79); }
.rm-pt.ancora i { box-shadow: 0 0 0 4px rgba(49, 79, 121, 0.16); }
.rm-pt.lig::after { content: ''; position: absolute; left: 50%; width: 100%; top: 50%; height: 4px; margin-top: -2px; background: rgba(49, 79, 121, 0.16); z-index: 0; }
.rm-pt:focus-visible { outline: 2px solid var(--glx-primary, #314F79); outline-offset: -2px; border-radius: 8px; }


/* ---- Linhas da folha ---- */
.rm-pres { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.rm-linha-ctl { display: flex; flex-direction: column; gap: 8px; padding-bottom: 12px; border-bottom: 1px solid #F1F5F9; }
.rm-linha-ctl .rm-dica { margin: 0; }
.rm-linha-bt { display: flex; flex-wrap: wrap; gap: 6px; }
.rm-linha-bt .glx-btn:disabled { opacity: .4; cursor: not-allowed; }
/* na lista de blocos, quem divide a linha ganha uma barra laranja ligando os blocos */
.rm-bl.rm-na-linha { position: relative; margin-left: 10px; border-radius: 6px 14px 14px 6px; }
.rm-bl.rm-na-linha::before { content: ''; position: absolute; left: -8px; top: 0; bottom: 0; width: 4px; background: rgba(49, 79, 121, 0.16); }
.rm-bl.rm-na-linha.ini::before { top: 6px; border-radius: 4px 4px 0 0; }
.rm-bl.rm-na-linha.fim::before { bottom: 6px; border-radius: 0 0 4px 4px; }
.rm-bl.rm-na-linha.ini.fim::before { border-radius: 4px; }


/* ---- Linhas numeradas ---- */
.rm-lns { display: flex; flex-wrap: wrap; gap: 6px; }
.rm-ln { width: 32px; height: 32px; padding: 0; border: 1.6px solid #CBD5E1; border-radius: 50%; background: #fff; color: var(--glx-muted, #6B7585); font: 800 12px var(--glx-font); cursor: pointer; transition: border-color .12s, background .12s, color .12s; }
.rm-ln:hover:not(:disabled):not(.on) { border-color: var(--glx-primary, #314F79); color: #1B2D47; }
.rm-ln.on { background: var(--glx-primary, #314F79); border-color: var(--glx-primary, #314F79); color: #fff; cursor: default; }
.rm-ln:disabled { opacity: .35; cursor: not-allowed; }
.rm-ln-nova { border-style: dashed; font-size: 15px; }
.rm-linha-cab { display: flex; align-items: center; gap: 8px; margin: 8px 0 2px; font: 800 10.5px var(--glx-font); text-transform: uppercase; letter-spacing: .07em; color: var(--glx-muted, #6B7585); list-style: none; }
.rm-linha-cab:first-child { margin-top: 0; }
.rm-linha-num { width: 18px; height: 18px; border-radius: 50%; display: inline-grid; place-items: center; background: #EEF4FA; color: #1B2D47; font-size: 10px; letter-spacing: 0; }
.rm-bl.rm-na-linha::before { display: none; }
.rm-bl.rm-na-linha { margin-left: 0; }


/* ---- Grupo de linha na lista de blocos: painelzinho que reúne os blocos lado a lado ---- */
.rm-grupo { list-style: none; margin: 8px 0 4px; padding: 8px 8px 6px; background: #EEF4FA; border: 1px solid #EEF4FA; border-radius: 18px; }
.rm-grupo-cab { display: flex; align-items: center; gap: 8px; padding: 0 4px 6px; font: 800 10.5px var(--glx-font); text-transform: uppercase; letter-spacing: .07em; color: #1B2D47; }
.rm-grupo-lista { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.rm-grupo .rm-bl { background: #fff; }


/* ---- Controles de texto (tamanho em quadradinho, alinhamentos em ícones) e estilos ---- */
.rm-ctl-texto { display: flex; flex-direction: column; gap: 10px; }
.rm-fmt { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.rm-main input.rm-quad { width: 58px; height: 32px; padding: 0 6px; text-align: center; border-radius: 10px; appearance: textfield; -moz-appearance: textfield; font-variant-numeric: tabular-nums; }
.rm-quad::-webkit-outer-spin-button, .rm-quad::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.rm-icg { display: flex; flex-wrap: wrap; gap: 3px; }
.rm-ic-sm { width: 30px; height: 30px; }
.rm-ic-sm svg { width: 16px; height: 16px; }
.rm-ic-sm[aria-pressed="true"] { background: var(--glx-primary, #314F79); border-color: var(--glx-primary, #314F79); color: #fff; }
.rm-estilos { display: flex; flex-direction: column; gap: 12px; }
.rm-est-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.rm-est-chip { padding: 5px 12px; border: 1px solid #E6E9EF; border-radius: 999px; background: #fff; font: 700 12px var(--glx-font); color: var(--glx-muted, #6B7585); cursor: pointer; }
.rm-est-chip:hover { border-color: var(--glx-primary, #314F79); color: #1B2D47; }
.rm-est-chip.on { background: var(--glx-primary, #314F79); border-color: var(--glx-primary, #314F79); color: #fff; }
.rm-est-novo { border-style: dashed; }
.rm-est-linha { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; align-items: start; }
.rm-est-linha > .rm-campo > .rm-quad { width: 100%; height: 38px; box-sizing: border-box; }
.rm-cor-linha { display: flex; align-items: center; gap: 8px; height: 36px; }
.rm-main input.rm-cor { width: 30px; height: 30px; padding: 0; border: 1.6px solid #CBD5E1; border-radius: 50%; background: none; cursor: pointer; overflow: hidden; }
.rm-cor::-webkit-color-swatch-wrapper { padding: 0; } .rm-cor::-webkit-color-swatch { border: 0; border-radius: 50%; }
.rm-hex { font: 600 11px var(--glx-font-mono, ui-monospace, monospace); color: var(--glx-muted, #6B7585); }
.rm-main input.rm-cor { padding: 0 !important; width: 30px !important; height: 30px !important; border-radius: 50% !important; }
.rm-main input.rm-quad { padding: 0 6px !important; height: 32px !important; border-radius: 10px !important; }


/* ---- Mapa vetorial: camadas e simbologia (estilo "Estilo de camada" do QGIS na linguagem Glaux) ---- */
.rm-presets { display: flex; flex-wrap: wrap; gap: 6px; }
.rm-interruptores { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2px 12px; }
.rm-camadas { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.rm-camada { display: flex; align-items: center; gap: 4px; padding: 2px 4px 2px 2px; background: #fff; border-radius: 14px; box-shadow: inset 0 0 0 1px #E6E9EF; }
.rm-camada.sel { box-shadow: 0 0 0 2px var(--glx-primary, #314F79); background: #EEF4FA; }
.rm-camada.oculta .rm-camada-nome { opacity: .5; }
.rm-camada-nome { flex: 1; min-width: 0; display: flex; flex-direction: column; text-align: left; background: none; border: 0; padding: 6px 8px; cursor: pointer; font-family: var(--glx-font); }
.rm-camada-nome strong { font-size: 12.5px; font-weight: 800; }
.rm-camada-nome span { font-size: 11px; color: var(--glx-muted, #6B7585); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rm-camada .rm-ic[disabled] { opacity: .3; cursor: not-allowed; }
.rm-camada-add { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: center; }
.rm-sub { border-top: 1px solid #E6E9EF; padding-top: 8px; }
.rm-sub > summary { font: 800 11px var(--glx-font); text-transform: uppercase; letter-spacing: .07em; color: var(--glx-muted, #6B7585); cursor: pointer; margin-bottom: 4px; }
.rm-sub > summary ~ * { margin-top: 8px; }


/* ---- Voltar e Salvar como ícones na barra de blocos ---- */
.rm-barra-sep { width: 1px; height: 22px; background: #E6E9EF; flex: none; }
.rm-ic-primario { background: var(--glx-primary, #314F79); border-color: var(--glx-primary, #314F79); color: #fff; box-shadow: 0 4px 12px rgba(49, 79, 121, 0.16); }
.rm-ic-primario:hover { background: #1B2D47; border-color: #1B2D47; color: #fff; }
.rm-ic-primario:disabled { opacity: .5; cursor: progress; }

/* ==========================================================================
   ATHENES — INDICADOR VISUAL CIRCULAR DE SALVAMENTO (R1)
   Substitui injeção de texto por spinner concêntrico elegante sobre o botão circular
   ========================================================================== */

/* 1. Estado Ativo de Salvamento */
.rm-ic-bt.rm-ic-primario.ath-salvando,
.rm-ic-bt.ath-salvando {
  position: relative !important;
  cursor: wait !important;
  opacity: 1 !important;
  pointer-events: none !important;
}

/* 2. Spinner de linha branca circular concêntrico */
.rm-ic-bt.rm-ic-primario.ath-salvando::before,
.rm-ic-bt.ath-salvando::before {
  content: '';
  position: absolute;
  inset: 2px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.22);
  border-top-color: #ffffff;
  animation: ath-spinner-salvar 0.8s linear infinite;
  box-sizing: border-box;
  pointer-events: none;
  z-index: 2;
}

/* 3. Ícone central preservado com leve redução de escala para respiro */
.rm-ic-bt.ath-salvando svg {
  opacity: 0.85;
  transform: scale(0.88);
  transition: transform 0.2s ease, opacity 0.2s ease;
}

@keyframes ath-spinner-salvar {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* 4. Estado de Confirmação de Sucesso (após salvar) */
.rm-ic-bt.rm-ic-primario.ath-salvo,
.rm-ic-bt.ath-salvo {
  background: #15803D !important;
  border-color: #15803D !important;
  box-shadow: 0 4px 12px rgba(21, 128, 61, 0.25) !important;
  transition: background 0.25s ease, border-color 0.25s ease;
}

.rm-ic-bt.ath-salvo svg {
  transform: scale(1.05);
  transition: transform 0.2s ease;
}

/* 5. Estado de Erro no Salvamento */
.rm-ic-bt.rm-ic-primario.ath-salvar-erro,
.rm-ic-bt.ath-salvar-erro {
  background: #B91C1C !important;
  border-color: #B91C1C !important;
  box-shadow: 0 4px 12px rgba(185, 28, 28, 0.25) !important;
  animation: ath-shake-salvar 0.35s ease;
}

@keyframes ath-shake-salvar {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-2.5px); }
  75% { transform: translateX(2.5px); }
}


/* ---- Cartões com borda de acento (laranja + tons complementares) ---- */
.rm-cartao { --ac: var(--glx-acento-1); position: relative; padding-top: 22px; border: 1.5px solid color-mix(in srgb, var(--ac) 45%, #fff); box-shadow: 0 10px 26px -14px color-mix(in srgb, var(--ac) 55%, transparent); transition: box-shadow .18s, border-color .18s; }
.rm-cartao:nth-child(5n+2) { --ac: var(--glx-acento-2); }
.rm-cartao:nth-child(5n+3) { --ac: var(--glx-acento-3); }
.rm-cartao:nth-child(5n+4) { --ac: var(--glx-acento-4); }
.rm-cartao:nth-child(5n+5) { --ac: var(--glx-acento-5); }
.rm-cartao::before { content: ''; position: absolute; top: -1.5px; left: 22px; width: 38px; height: 5px; border-radius: 0 0 6px 6px; background: var(--ac); }
.rm-cartao:hover { border-color: var(--ac); box-shadow: 0 14px 30px -14px color-mix(in srgb, var(--ac) 70%, transparent); }
.rm-cartao .rm-selo { background: color-mix(in srgb, var(--ac) 12%, #fff); color: color-mix(in srgb, var(--ac) 80%, #1F2733); }

/* ---- Painéis de formatação (grupos recolhíveis, campos em pílula, cor com hex, alinhamentos segmentados) ---- */
.rm-sub > summary { display: flex; align-items: center; justify-content: space-between; list-style: none; padding: 2px 2px 2px 0; }
.rm-sub > summary::-webkit-details-marker { display: none; }
.rm-sub > summary::after { content: ''; width: 7px; height: 7px; margin-right: 6px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg) translateY(-2px); transition: transform .18s ease; opacity: .7; }
.rm-sub:not([open]) > summary::after { transform: rotate(-45deg); }
.rm-cor-linha { background: var(--glx-field, #F4F5F8); border-radius: 999px; padding: 0 12px 0 6px; gap: 10px; }
.rm-cor-linha .rm-hex { font: 700 12px var(--glx-font); letter-spacing: .02em; color: var(--glx-muted, #6B7585); background: none; padding: 0; }
.rm-icg { background: var(--glx-field, #F4F5F8); border-radius: 999px; padding: 3px; width: max-content; max-width: 100%; }
.rm-icg .rm-ic-bt { border-color: transparent; background: transparent; }
.rm-icg .rm-ic-bt:hover { background: #fff; }
.rm-icg .rm-ic-bt[aria-pressed="true"] { background: var(--glx-primary, #314F79); border-color: var(--glx-primary, #314F79); color: #fff; box-shadow: 0 4px 10px rgba(49, 79, 121, 0.16); }
.rm-icg .rm-ic-bt[aria-pressed="true"]:hover { background: #243C5E; }
/* número com o rótulo depois da caixa, alinhado na vertical com os campos ao lado */
.rm-main label.rm-campo.rm-inline { flex-direction: row; align-items: center; gap: 8px; }
.rm-campo.rm-inline > span { white-space: nowrap; }
/* caixa dos círculos de ícones um pouco mais alta */
.rm-icg { padding: 6px 8px; gap: 4px; }
.rm-icg .rm-ic-bt { width: 34px; height: 34px; }
/* caixas numéricas com rótulo ao lado: todas do mesmo tamanho */
.rm-campo.rm-inline .rm-quad { flex: none; width: 72px; min-width: 72px; height: 36px; padding: 0 8px; text-align: center; box-sizing: border-box; }
.rm-campo.rm-inline { min-width: 0; }
/* colunas laterais sem rolagem horizontal: só rolam na vertical e o conteúdo se ajusta à largura */
.rm-col-esq, .rm-col-dir { overflow-x: hidden; min-width: 0; }
.rm-col-esq *, .rm-col-dir * { min-width: 0; }
.rm-col-esq :is(input, select, textarea), .rm-col-dir :is(input, select, textarea) { max-width: 100%; box-sizing: border-box; }
.rm-col-esq .rm-bl-nome, .rm-col-dir .rm-bl-nome { min-width: 0; }
/* caixas de texto do painel: crescem com o conteúdo e podem ser esticadas na vertical */
.rm-props textarea, .rm-main .rm-props textarea { resize: vertical; min-height: 44px; overflow-y: auto; }

/* arrastar blocos e camadas: marca onde o item vai entrar */
.rm-bl[draggable="true"], .rm-camada[draggable="true"] { cursor: grab; }
.rm-bl.arrastando, .rm-camada.arrastando { opacity: .45; }
.rm-bl.drop-antes, .rm-camada.drop-antes { box-shadow: 0 -3px 0 0 #314F79; }
.rm-bl.drop-depois, .rm-camada.drop-depois { box-shadow: 0 3px 0 0 #314F79; }
.rm-var[draggable="true"] { cursor: grab; }
.rm-ic-bt:disabled { opacity: .38; cursor: default; }

/* campos de texto do bloco, logo acima das variáveis (mais simples para inserir variáveis) */
.rm-campos-texto { border: 1.5px solid #C8D7E6; background: #F4F7FB; }
.rm-campos-texto[hidden] { display: none; }
.rm-bl.drop-grupo { outline: 2px dashed #314F79; outline-offset: -2px; background: #EEF4FA; }
/* Condições do foco do mapa (SE / E / OU) */
.rm-conds { display: grid; gap: 8px; }
.rm-cond { display: grid; gap: 6px; padding: 10px; border: 1px solid var(--glx-line, #E6E9EF); border-radius: 12px; background: var(--glx-field, #F7F8FA); }
.rm-cond > .glx-select, .rm-cond > input { width: 100%; min-width: 0; box-sizing: border-box; height: 38px; }
.rm-cond-topo { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.rm-cond-topo .glx-select { min-width: 0; width: 84px; }
.rm-cond-se { font-size: 12px; letter-spacing: .06em; color: var(--ath-primary, #314F79); }
.rm-filtro-doc { display: grid; gap: 8px; margin: 4px 0 8px; }
.rm-filtro-doc-topo { display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; box-sizing: border-box; }
.rm-filtro-doc-topo .rm-rot { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1 1 auto; min-width: 0; }
.rm-filtro-doc-topo .glx-btn { white-space: nowrap !important; flex: 0 0 auto !important; flex-shrink: 0 !important; }

/* Cards de Páginas Mestras na barra lateral */
.rm-mestra-card { transition: border-color .15s, background .15s; }
.rm-mestra-card:hover { border-color: var(--ath-primary, #314F79) !important; }
.rm-mestra-card-topo { width: 100%; }
.rm-mestra-card-meta { width: 100%; }
.rm-mestra-card-meta .rm-selo { white-space: nowrap !important; flex: none !important; }
.rm-mestra-card-acoes { width: 100%; }
.rm-mestra-card-acoes .glx-btn { white-space: nowrap !important; flex: none !important; flex-shrink: 0 !important; }


/* =========================================================================
   Athenes — Estilos da Folha Real (WYSIWYG na Página) e Blocos Compostos
   ========================================================================= */

.rm-conteudo {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
  background: var(--ath-bg, #EFF2F6);
}

.ath-topo-shell {
  height: 52px;
  background: #FFFFFF;
  border-bottom: 1.5px solid #E2E8F0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 18px;
  flex-shrink: 0;
  z-index: 50;
}

.ath-topo-esq, .ath-topo-dir {
  display: flex;
  align-items: center;
  gap: 12px;
}

.ath-marca-link {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
  font-size: 16px;
  color: #1F2733;
  text-decoration: none;
  cursor: pointer;
}

.ath-marca-link svg {
  color: #314F79;
}

.ath-doc-titulo-topo {
  font-size: 13.5px;
  font-weight: 700;
  border: 1px solid transparent;
  background: #F4F5F8;
  padding: 5px 12px;
  border-radius: 999px;
  color: #1F2733;
  min-width: 200px;
  max-width: 380px;
  transition: all 0.15s ease;
}

.ath-doc-titulo-topo:focus {
  background: #FFFFFF;
  border-color: #314F79;
  outline: none;
  box-shadow: 0 0 0 3px rgba(49, 79, 121, 0.16);
}

/* Palco de Prévia e Folhas */
.rm-prev-palco {
  flex: 1;
  overflow-y: auto;
  overflow-x: auto;
  padding: 24px 16px 80px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 32px;
  background: #E8ECF1;
  position: relative;
}

/* Folha A4 Real no Palco (Escala proporcional A4 210 x 297 mm) */
.ath-folha-a4 {
  position: relative;
  width: 794px; /* ~210mm a 96 DPI */
  min-height: 1123px; /* ~297mm a 96 DPI */
  background: #FFFFFF;
  box-shadow: 0 10px 32px rgba(15, 23, 42, 0.12), 0 1px 3px rgba(15, 23, 42, 0.06);
  border-radius: 2px;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  transition: box-shadow 0.2s ease;
  user-select: text;
}

.rm-col-prev { position: relative; }

/* Zoom do canvas (Ctrl + roda): escala via CSS zoom para preservar layout e rolagem.
   Margens automáticas evitam que a folha ampliada fique cortada à esquerda. */
.rm-prev-palco > .ath-folha-a4 {
  zoom: var(--ath-zoom, 1);
  margin-left: auto;
  margin-right: auto;
}

.ath-zoom-indicador {
  position: absolute;
  right: 22px;
  bottom: 16px;
  z-index: 5;
  border: 1px solid #C8D7E6;
  background: rgba(255, 255, 255, 0.92);
  color: #314F79;
  font-size: 11px;
  font-weight: 800;
  padding: 3px 9px;
  border-radius: 999px;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.12);
}

.ath-folha-a4.paisagem {
  width: 1123px;
  min-height: 794px;
}

/* Área útil interna limitada pelas margens configuradas */
.ath-folha-area-util {
  position: relative;
  flex: 1;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
  z-index: 2;
}

/* Linha pontilhada indicativa das margens na folha */
.ath-folha-guia-margem {
  position: absolute;
  pointer-events: none;
  border: 1px dashed rgba(49, 79, 121, 0.16);
  border-radius: 1px;
  z-index: 1;
}

/* Sobreposição da grade de 12 colunas quando ativada */
.ath-folha-grade-12 {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 8px;
  pointer-events: none;
  z-index: 1;
  opacity: 0.22;
}

.ath-folha-grade-12 .ath-col-guia {
  background: #314F79;
  border-radius: 2px;
  height: 100%;
}

/* Cabeçalho e Rodapé dentro da Folha */
.ath-folha-cabecalho {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid #E2E8F0;
  padding-bottom: 6px;
  margin-bottom: 14px;
  font-size: 11px;
  color: #6B7585;
}

.ath-folha-rodape {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid #E2E8F0;
  padding-top: 8px;
  margin-top: auto;
  font-size: 11px;
  color: #6B7585;
}

/* =========================================================================
   Blocos na Folha com Edição Direta (In-Page WYSIWYG)
   ========================================================================= */

.ath-bloco-folha {
  position: relative;
  margin-bottom: 12px;
  padding: 4px 6px;
  border-radius: 6px;
  border: 1.5px solid transparent;
  transition: border-color 0.12s ease, background 0.12s ease;
  cursor: text;
}

.ath-bloco-folha:hover {
  border-color: #CBD5E1;
  background: rgba(241, 245, 249, 0.5);
}

.ath-bloco-folha.sel {
  border-color: #314F79;
  background: #F8FAFC;
  box-shadow: 0 0 0 3px rgba(49, 79, 121, 0.16);
}

.ath-bloco-folha [contenteditable="true"] {
  outline: none;
}

.ath-bloco-folha [contenteditable="true"]:focus {
  background: transparent;
}

/* Identificador flutuante do bloco selecionado */
.ath-bloco-cracha {
  position: absolute;
  top: -10px;
  left: 8px;
  background: #314F79;
  color: #FFFFFF;
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 1px 7px;
  border-radius: 999px;
  pointer-events: none;
  display: none;
  z-index: 10;
}

.ath-bloco-folha.sel .ath-bloco-cracha {
  display: none; /* A barra rápida substitui o crachá quando o bloco é selecionado */
}

/* Barra flutuante de seleção rápida de estilos e tipos no bloco da página */
.ath-bloco-barra-rapida {
  position: absolute;
  top: calc(100% + 4px);
  bottom: auto;
  left: 0;
  right: 0;
  width: auto;
  box-sizing: border-box;
  display: none;
  align-items: center;
  gap: 4px;
  background: #FFFFFF;
  border: 1.5px solid #CBD5E1;
  border-radius: 6px;
  padding: 2px 6px;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.12);
  z-index: 50;
  font-family: var(--glx-font, Nunito), system-ui, sans-serif;
  user-select: none;
  white-space: nowrap;
  flex-wrap: wrap; /* em blocos estreitos quebra em 2 linhas (cresce para baixo) em vez de cortar */
  overflow: visible;
}

.ath-bloco-barra-rapida::-webkit-scrollbar {
  display: none;
}

.ath-bloco-folha.sel .ath-bloco-barra-rapida {
  display: flex;
}

.ath-bloco-folha.sel > .ath-bloco-alca.topo {
  display: none !important;
}

.ath-bloco-barra-rapida .ath-sel-rapido {
  flex: 1 1 64px;
  min-width: 64px;
  text-overflow: ellipsis;
  height: 23px;
  min-height: 23px;
  padding: 0 6px;
  font-size: 11px;
  font-weight: 700;
  color: #1E293B;
  background: #F8FAFC;
  border: 1px solid #CBD5E1;
  border-radius: 6px;
  outline: none;
  cursor: pointer;
  white-space: nowrap;
}

.ath-bloco-barra-rapida .ath-sel-rapido:hover,
.ath-bloco-barra-rapida .ath-sel-rapido:focus {
  border-color: #314F79;
  background: #FFFFFF;
}

.ath-bloco-barra-rapida .ath-btn-rapido {
  height: 23px;
  min-height: 23px;
  padding: 0 7px;
  font-size: 11px;
  font-weight: 700;
  border: 1px solid #CBD5E1;
  border-radius: 6px;
  background: #F8FAFC;
  color: #334155;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  white-space: nowrap !important;
  line-height: 1;
  flex: 0 0 auto;
  transition: all 0.15s ease;
}

.ath-bloco-barra-rapida .ath-btn-rapido:hover {
  background: #EFF6FF;
  border-color: #314F79;
  color: #314F79;
}

.ath-bloco-barra-rapida .ath-btn-rapido.ativo {
  background: #314F79;
  border-color: #314F79;
  color: #FFFFFF;
}

/* Card e Avatar do Perfil Google na Barra Superior / Popover */
.ath-google-user-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 8px;
  background: #F8FAFC;
  border: 1px solid #E2E8F0;
}

.ath-google-user-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid #CBD5E1;
}


/* =========================================================================
   Blocos Compostos: Figura, Mapa, Tabela, Quadro, Fórmula
   ========================================================================= */

/* Bloco Figura Composta (Título acima, grid de imagens, legenda e fonte) */
.ath-composto-figura {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 12px 0;
}

.ath-fig-titulo, .ath-mapa-titulo, .ath-tab-titulo, .ath-quadro-titulo {
  font-weight: 800;
  font-size: 13px;
  color: #1F2733;
}

.ath-fig-grid {
  display: grid;
  gap: 8px;
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 0;
}

.ath-fig-grid[data-layout="1"] { grid-template-columns: 1fr; }
.ath-fig-grid[data-layout="2_lado"] { grid-template-columns: 1fr 1fr; }
.ath-fig-grid[data-layout="2_empilhado"] { grid-template-columns: 1fr; }
.ath-fig-grid[data-layout="3_linha"] { grid-template-columns: 1fr 1fr 1fr; }
.ath-fig-grid[data-layout="3_misto"] { grid-template-columns: 2fr 1fr; }
.ath-fig-grid[data-layout="4_grade"] { grid-template-columns: 1fr 1fr; }
.ath-fig-grid[data-layout="6_grade"] { grid-template-columns: 1fr 1fr 1fr; }

.ath-fig-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.ath-fig-item img {
  max-width: 100%;
  max-height: 280px;
  object-fit: contain;
  border-radius: 4px;
}

.ath-fig-sublegenda {
  font-size: 11px;
  color: #6B7585;
  font-style: italic;
}

.ath-fig-legenda-geral {
  font-size: 12px;
  color: #475569;
  line-height: 1.35;
}

.ath-bloco-fonte {
  font-size: 11px;
  color: #6B7585;
  font-style: italic;
}

/* Bloco Mapa */
.ath-composto-mapa {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 12px 0;
}

.ath-mapa-canvas-box {
  position: relative;
  border: 1px solid #CBD5E1;
  border-radius: 8px;
  background: #F1F5F9;
  min-height: 220px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.ath-mapa-norte {
  position: absolute;
  top: 10px;
  right: 12px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid #CBD5E1;
  border-radius: 50%;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  font-weight: 900;
  font-size: 12px;
  color: #314F79;
}

.ath-mapa-escala-badge {
  position: absolute;
  bottom: 8px;
  left: 10px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid #CBD5E1;
  border-radius: 4px;
  padding: 2px 6px;
  font-size: 10px;
  font-weight: 700;
  color: #1F2733;
}

.ath-mapa-legenda-carto {
  font-size: 11px;
  color: #475569;
  background: #F8FAFC;
  border-left: 3px solid #314F79;
  padding: 4px 8px;
  border-radius: 0 4px 4px 0;
}

/* Bloco Tabela (Padrão ABNT / IBGE: laterais verticais abertas) */
.ath-tabela-abnt {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  margin: 6px 0;
}

.ath-tabela-abnt th {
  border-top: 1.5px solid #1F2733;
  border-bottom: 1.5px solid #1F2733;
  padding: 6px 10px;
  text-align: left;
  font-weight: 800;
}

.ath-tabela-abnt td {
  border-bottom: 1px solid #E2E8F0;
  padding: 5px 10px;
}

.ath-tabela-abnt tr:last-child td {
  border-bottom: 1.5px solid #1F2733;
}

/* Bloco Quadro (Padrão ABNT: caixa fechada com todas as bordas) */
.ath-quadro-abnt {
  width: 100%;
  border-collapse: collapse;
  border: 1.5px solid #1F2733;
  font-size: 12px;
  margin: 6px 0;
}

.ath-quadro-abnt th {
  background: #F8FAFC;
  border: 1px solid #1F2733;
  padding: 6px 10px;
  text-align: left;
  font-weight: 800;
}

.ath-quadro-abnt td {
  border: 1px solid #1F2733;
  padding: 5px 10px;
}

/* Bloco Fórmula / Equação */
.ath-bloco-formula {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px;
  background: #F8FAFC;
  border: 1px solid #E2E8F0;
  border-radius: 8px;
  margin: 8px 0;
}

.ath-formula-corpo {
  flex: 1;
  text-align: center;
  font-family: 'Cambria Math', 'Latin Modern Math', 'Times New Roman', serif;
  font-size: 16px;
  color: #1F2733;
}

.ath-formula-numero {
  font-weight: 700;
  font-size: 13px;
  color: #6B7585;
}

/* Tag de Referência Cruzada inline */
.ath-tag-ref {
  display: inline-flex;
  align-items: center;
  background: #EEF4FA;
  color: #1B2D47;
  font-weight: 700;
  font-size: 11px;
  padding: 1px 6px;
  border-radius: 4px;
  border: 1px solid #C8D7E6;
  cursor: pointer;
}

.ath-tag-ref:hover {
  background: #EEF4FA;
}


/* =========================================================================
   Linguagem tipográfica única: Nunito em toda a interface e na folha
   ========================================================================= */
html, body, button, input, select, textarea, option, summary, label, table,
.rm-conteudo, .rm-conteudo *, .glx-btn, .glx-select, .ath-folha-a4, .ath-folha-a4 * {
  font-family: var(--glx-font, 'Nunito', system-ui, sans-serif);
}
.ath-formula-corpo, .rm-var code, .rm-hex { font-family: var(--glx-font, 'Nunito', sans-serif); }

/* Botões e selects do padrão Glaux (glx-btn / glx-select) ausentes no Athenes */
.glx-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid #E6E9EF; border-radius: 999px; background: #fff; color: #1F2733; font: 700 12.5px var(--glx-font); padding: 0 14px; height: 34px; cursor: pointer; white-space: nowrap !important; flex-shrink: 0; transition: background .12s, border-color .12s, color .12s; }
.glx-btn:hover { border-color: #314F79; color: #1B2D47; background: #EEF4FA; }
.glx-btn-sm { height: 30px; padding: 0 12px; font-size: 11.5px; }
.glx-btn-xs { height: 24px; padding: 0 8px; font-size: 11px; font-weight: 700; }
.glx-btn-soft { background: #F4F5F8; border-color: transparent; }
.glx-btn-primary { background: #314F79; border-color: #314F79; color: #fff; }
.glx-btn-primary:hover { background: #1B2D47; border-color: #1B2D47; color: #fff; }
.glx-btn svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.rm-main select, .glx-select { width: 100%; height: 36px; border: 1px solid #CBD5E1; border-radius: 999px; background: #fff; padding: 0 14px; font: 600 13px var(--glx-font); color: #1F2733; }
.rm-main select:focus { outline: none; border-color: #314F79; box-shadow: 0 0 0 3px rgba(49, 79, 121, 0.16); }

/* Ícones SVG do Athenes herdam o traço Glaux */
.ath-icon { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* Layout: o conteúdo ocupa a altura toda e as colunas rolam sozinhas */
.rm-editor { flex: 1 1 0; min-height: 0; padding: 12px 14px; }
.rm-ed-grade { flex: 1 1 0; min-height: 0; align-items: stretch; }
.rm-col-esq, .rm-col-dir { min-height: 0; overflow-y: auto; overflow-x: hidden; }
.rm-col-prev { min-height: 0; position: static; }
.rm-prev-palco { flex: 1 1 0; min-height: 0; border-radius: 18px; }
.ath-folha-a4 { flex-shrink: 0; }


/* =========================================================================
   Estilos de texto em lista, salvar estilo e arrastar blocos
   ========================================================================= */
.rm-lista-estilos { list-style: none; margin: 0 0 14px 0; padding: 2px 2px 6px 2px; display: flex; flex-direction: column; gap: 5px; max-height: 260px; overflow-y: auto; scrollbar-width: thin; }
.rm-estilo-item { width: 100%; display: flex; align-items: center; gap: 10px; text-align: left; padding: 7px 12px 7px 8px; border: 1px solid #E6E9EF; border-radius: 14px; background: #fff; cursor: pointer; font-family: var(--glx-font); transition: border-color .12s, background .12s; }
.rm-estilo-item:hover { border-color: #314F79; background: #EEF4FA; }
.rm-estilo-item.on { border-color: #314F79; background: #EEF4FA; box-shadow: 0 0 0 2px rgba(49, 79, 121, 0.16); }
.rm-estilo-amostra { flex: none; width: 34px; height: 34px; display: grid; place-items: center; border-radius: 10px; background: #F4F5F8; font-size: 15px; }
.rm-estilo-item.on .rm-estilo-amostra { background: #fff; }
.rm-estilo-nome { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.rm-estilo-nome strong { font-size: 12.5px; font-weight: 800; color: #1F2733; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rm-estilo-nome small { font-size: 11px; color: #6B7585; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rm-estilo-tag { font-style: normal; font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; padding: 2px 8px; border-radius: 999px; background: #EEF4FA; color: #1B2D47; }
.rm-estilo-previa { margin: 16px 0 16px 0 !important; padding: 10px 14px; border: 1px dashed #CBD5E1; border-radius: 14px; background: #fff; }
.rm-estilo-acoes { display: flex; flex-wrap: wrap; gap: 8px; padding-top: 4px; }
.rm-estilo-acoes .glx-btn:disabled { opacity: .45; cursor: not-allowed; }
.rm-estilo-acoes .rm-perigo { color: #B42318; }
.rm-ic-bt.on { background: #314F79; border-color: #314F79; color: #fff; box-shadow: 0 4px 10px rgba(49, 79, 121, 0.16); }

/* Alça lateral de mover, na própria folha */
.ath-bloco-alca { position: absolute; left: -22px; top: 0; width: 18px; height: max(26px, 100%); padding: 0; display: grid; place-items: center; border: 0; border-radius: 6px 0 0 6px; background: #fff; color: #94A3B8; cursor: grab; opacity: 0; box-shadow: -1px 1px 4px rgba(15,23,42,.16); transition: opacity .12s, color .12s, background .12s; z-index: 5; } /* acompanha a altura inteira do bloco, colada na borda dele */
.ath-bloco-alca:active { cursor: grabbing; }
.ath-bloco-alca:hover { color: #314F79; background: #EEF4FA; }
.ath-bloco-folha.sel > .ath-bloco-alca { color: #314F79; background: #EEF4FA; }
.ath-bloco-alca.topo { left: 4px; top: -17px; width: clamp(26px, 30%, 64px); height: 16px; border-radius: 6px 6px 0 0; transform: none; box-shadow: 0 -1px 4px rgba(15,23,42,.16); }
.ath-bloco-alca.topo svg { transform: rotate(90deg); }
.ath-bloco-folha:hover > .ath-bloco-alca, .ath-bloco-folha.sel > .ath-bloco-alca { opacity: 1; }
.ath-bloco-alca svg { stroke: none; }

/* Marcas de soltura na folha */
.ath-bloco-folha.arrastando { opacity: .4; }
.ath-bloco-folha.drop-antes { box-shadow: 0 -4px 0 0 #314F79; }
.ath-bloco-folha.drop-depois { box-shadow: 0 4px 0 0 #314F79; }
.ath-bloco-folha.drop-grupo { background: #EEF4FA; outline: 2px dashed #314F79; outline-offset: -2px; }
.ath-bloco-folha.drop-grupo.drop-esq { box-shadow: inset 6px 0 0 0 #314F79; }
.ath-bloco-folha.drop-grupo.drop-dir { box-shadow: inset -6px 0 0 0 #314F79; }
.rm-bl.drop-antes { box-shadow: 0 -3px 0 0 #314F79; }
.rm-bl.drop-depois { box-shadow: 0 3px 0 0 #314F79; }


/* Botões da barra com menu (Figura ▾, Quadro ▾) */
.rm-grupo-bt { position: relative; flex: none; }
.rm-ic-bt.tem-menu {
  position: relative;
  display: inline-flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 1.5px !important;
  padding: 0 !important;
}
.rm-ic-bt.tem-menu > svg:first-child {
  width: 14.5px !important;
  height: 14.5px !important;
  transform: none !important;
  display: block !important;
  margin: 0 !important;
}
.rm-ic-bt svg.rm-seta-dropdown-icone,
.rm-seta-dropdown-icone {
  position: static !important;
  left: auto !important;
  bottom: auto !important;
  transform: none !important;
  width: 5px !important;
  height: 3px !important;
  max-width: 5px !important;
  max-height: 3px !important;
  stroke-width: 1.2 !important;
  display: block !important;
  margin: 0 !important;
  pointer-events: none !important;
  color: var(--ath-primary, #314F79) !important;
  opacity: 0.85 !important;
  transition: transform .12s ease, opacity .12s ease !important;
}
.rm-ic-bt.tem-menu:hover svg.rm-seta-dropdown-icone,
.rm-ic-bt.tem-menu:hover .rm-seta-dropdown-icone {
  color: #1B2D47 !important;
  opacity: 1 !important;
}
.rm-ic-bt.tem-menu[aria-expanded="true"] svg.rm-seta-dropdown-icone,
.rm-ic-bt.tem-menu[aria-expanded="true"] .rm-seta-dropdown-icone {
  transform: rotate(180deg) !important;
}
.rm-ic-bt.on svg.rm-seta-dropdown-icone,
.rm-ic-bt.ativo svg.rm-seta-dropdown-icone,
.rm-ic-bt[aria-pressed="true"] svg.rm-seta-dropdown-icone {
  color: #ffffff !important;
  stroke: #ffffff !important;
}

/* Botões quadrados elegantes para adição de elementos na mestra */
.ath-btn-elem-quadrado {
  width: 34px;
  height: 34px;
  min-width: 34px;
  min-height: 34px;
  display: inline-grid;
  place-items: center;
  padding: 0;
  border-radius: 8px;
  border: 1px solid var(--ath-primary-line, #C8D7E6);
  background: #fff;
  color: var(--ath-primary, #314F79);
  cursor: pointer;
  transition: all .15s ease;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.05);
}
.ath-btn-elem-quadrado:hover {
  background: var(--ath-primary-soft, #EEF4FA);
  border-color: var(--ath-primary, #314F79);
  transform: translateY(-1px);
  box-shadow: 0 3px 8px rgba(49, 79, 121, 0.16);
}
.ath-btn-elem-quadrado:active {
  transform: translateY(0);
}
.rm-cor-linha-badge {
  display: inline-flex !important;
  flex-direction: row !important;
  align-items: center !important;
  white-space: nowrap !important;
  gap: 6px !important;
}
.rm-linha-unica {
  display: flex !important;
  flex-direction: row !important;
  align-items: center !important;
  gap: 8px !important;
  white-space: nowrap !important;
}
.rm-menu-bloco { position: absolute; top: calc(100% + 10px); left: 50%; transform: translateX(-30%); min-width: 270px; padding: 8px; display: flex; flex-direction: column; gap: 2px; background: #fff; border: 1px solid #E6E9EF; border-radius: 18px; box-shadow: 0 16px 36px -10px rgba(31, 39, 51, .28); z-index: 80; }
.rm-menu-bloco[hidden] { display: none; }
.rm-menu-item { display: flex; align-items: center; gap: 12px; width: 100%; padding: 8px 10px; border: 0; border-radius: 12px; background: transparent; text-align: left; cursor: pointer; font-family: var(--glx-font); transition: background .12s; }
.rm-menu-item:hover, .rm-menu-item:focus-visible { background: #EEF4FA; outline: none; }
.rm-menu-icone { flex: none; width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%; background: #F4F5F8; color: #64748B; }
.rm-menu-item:hover .rm-menu-icone { background: #314F79; color: #fff; }
.rm-menu-texto { display: flex; flex-direction: column; min-width: 0; }
.rm-menu-texto strong { font-size: 13px; font-weight: 800; color: #1F2733; }
.rm-menu-texto small { font-size: 11px; color: #6B7585; }


/* Pill flutuante para divisão de bloco no cursor */
.ath-pill-dividir {
  position: fixed;
  z-index: 9000;
  background: #FFFFFF;
  border: 1px solid var(--ath-primary-line, #C8D7E6);
  border-radius: 999px;
  box-shadow: 0 4px 14px rgba(49, 79, 121, 0.18);
  padding: 3px 10px;
  font-family: var(--glx-font, 'Nunito', sans-serif);
  font-size: 11px;
  font-weight: 700;
  color: var(--ath-primary, #314F79);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 5px;
  transform: translate(-50%, -100%);
  margin-top: -10px;
  user-select: none;
  transition: transform .12s, box-shadow .12s, background .12s;
}
.ath-pill-dividir:hover {
  background: var(--ath-primary-soft, #EEF4FA);
  border-color: var(--ath-primary, #314F79);
  transform: translate(-50%, -105%) scale(1.03);
  box-shadow: 0 6px 18px rgba(49, 79, 121, 0.25);
}

/* Pílula flutuante de ações rápidas no cursor (Dividir Bloco + Citar Zotero) - Fica ACIMA da linha de texto */
.ath-pill-cursor-acoes {
  position: fixed;
  z-index: 9100;
  background: #FFFFFF;
  border: 1px solid var(--ath-primary-line, #C8D7E6);
  border-radius: 999px;
  box-shadow: 0 4px 16px rgba(49, 79, 121, 0.20);
  padding: 3px 6px;
  display: flex;
  align-items: center;
  gap: 3px;
  transform: translate(-50%, -100%);
  margin-top: -10px;
  user-select: none;
  pointer-events: auto;
  transition: transform .12s ease, box-shadow .12s ease;
}
.ath-pill-cursor-acoes:hover {
  box-shadow: 0 6px 20px rgba(49, 79, 121, 0.26);
}
.ath-pill-bt {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 999px;
  border: none;
  background: transparent;
  font-family: var(--glx-font, 'Nunito', sans-serif);
  font-size: 11px;
  font-weight: 700;
  color: #1F2733;
  cursor: pointer;
  transition: background .12s, color .12s, transform .12s;
  white-space: nowrap;
}
.ath-pill-bt:hover {
  background: var(--ath-primary-soft, #EEF4FA);
  color: var(--ath-primary, #314F79);
}
.ath-pill-bt:active {
  transform: scale(0.97);
}
.ath-pill-sep {
  width: 1px;
  height: 14px;
  background: var(--ath-primary-line, #CBD5E1);
  margin: 0 2px;
}
.ath-pill-bt-zotero {
  background: var(--ath-primary-soft, #EEF4FA);
  color: var(--ath-primary, #314F79);
}
.ath-pill-bt-zotero:hover {
  background: var(--ath-primary, #314F79);
  color: #FFFFFF;
}

.ath-pill-btn-circulo {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid var(--ath-primary-line, #D6E4F0);
  background: var(--ath-primary-soft, #EEF4FA);
  color: var(--ath-primary, #314F79);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all .12s ease;
  padding: 0;
  box-sizing: border-box;
  flex: none;
}
.ath-pill-btn-circulo:hover {
  background: var(--ath-primary, #314F79);
  color: #FFFFFF;
  border-color: var(--ath-primary, #314F79);
  transform: scale(1.08);
  box-shadow: 0 2px 8px rgba(49, 79, 121, 0.28);
}
.ath-pill-btn-circulo:hover svg {
  color: #FFFFFF !important;
  stroke: #FFFFFF !important;
}
.ath-pill-btn-circulo:active {
  transform: scale(0.95);
}

/* Alça de arraste da pílula móvel e barra contextual */
.ath-pill-drag-handle {
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: grab;
  touch-action: none;
  user-select: none;
  padding: 2px 4px;
  color: #94A3B8;
  border-radius: 999px;
  transition: color .12s, transform .12s;
}
.ath-pill-drag-handle:hover {
  color: var(--ath-primary, #314F79);
}
.ath-pill-drag-handle:active {
  cursor: grabbing;
}

/* Forçar azul da marca em botões selecionados/ativos */
.rm-ic-bt.on, .rm-ic-bt[aria-pressed="true"], .rm-ic-bt.ativo {
  background: var(--ath-primary, #314F79) !important;
  border-color: var(--ath-primary, #314F79) !important;
  color: #FFFFFF !important;
  box-shadow: 0 3px 10px rgba(49, 79, 121, 0.35) !important;
}
.rm-ic-bt.on svg, .rm-ic-bt[aria-pressed="true"] svg, .rm-ic-bt.ativo svg {
  stroke: #FFFFFF !important;
}

/* Botão Filtro dos documentos sem quebra vertical */
.rm-filtro-doc-topo .glx-btn {
  white-space: nowrap !important;
  flex: none !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
}

/* Espaçamentos de Parágrafos (Enter) e Listas */
.ath-texto-editable {
  outline: none;
  min-height: 1.4em;
  word-break: break-word;
}
.ath-texto-editable p,
.ath-texto-editable > div {
  margin: 0 0 var(--ath-paragrafo-gap, 6pt) 0;
}
.ath-texto-editable p:last-child,
.ath-texto-editable > div:last-child {
  margin-bottom: 0;
}
.ath-texto-editable ul,
.ath-texto-editable ol {
  margin: 0 0 var(--ath-paragrafo-gap, 6pt) 0;
  padding-left: 24px;
}
.ath-texto-editable ul:last-child,
.ath-texto-editable ol:last-child {
  margin-bottom: 0;
}
.ath-texto-editable li {
  margin-bottom: calc(var(--ath-paragrafo-gap, 6pt) * 0.4);
  line-height: inherit;
}
.ath-texto-editable li:last-child {
  margin-bottom: 0;
}

/* Alínea ABNT com travessão (–) */
.ath-texto-editable ul.ath-lista-alinea,
ul.ath-lista-alinea {
  list-style-type: none !important;
  padding-left: 24px !important;
}
.ath-texto-editable ul.ath-lista-alinea > li,
ul.ath-lista-alinea > li {
  position: relative !important;
  list-style-type: none !important;
  padding-left: 0 !important;
}
.ath-texto-editable ul.ath-lista-alinea > li::before,
ul.ath-lista-alinea > li::before {
  content: "– " !important;
  color: var(--ath-primary, #314F79) !important;
  font-weight: 700 !important;
  position: absolute !important;
  left: -16px !important;
}

/* Lista Ponto-Traço */
.ath-texto-editable ul.ath-lista-ponto-traco,
ul.ath-lista-ponto-traco {
  list-style-type: none !important;
  padding-left: 24px !important;
}
.ath-texto-editable ul.ath-lista-ponto-traco > li,
ul.ath-lista-ponto-traco > li {
  position: relative !important;
  list-style-type: none !important;
  padding-left: 0 !important;
}
.ath-texto-editable ul.ath-lista-ponto-traco > li::before,
ul.ath-lista-ponto-traco > li::before {
  content: "·– " !important;
  color: var(--ath-primary, #314F79) !important;
  font-weight: 700 !important;
  position: absolute !important;
  left: -18px !important;
}

/* Paleta de Símbolos Matemáticos e Lógicos */
.ath-seletor-simbolos-mat {
  font-family: var(--glx-font, 'Nunito', sans-serif);
}
.ath-btn-simbolo-mat {
  border: 1px solid var(--ath-primary-line, #C8D7E6);
  border-radius: 6px;
  background: #FFFFFF;
  color: var(--ath-primary, #314F79);
  padding: 4px 6px;
  font-size: 13px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all .12s ease;
  min-width: 28px;
  min-height: 28px;
}
.ath-btn-simbolo-mat:hover {
  background: var(--ath-primary-soft, #EEF4FA);
  border-color: var(--ath-primary, #314F79);
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(49, 79, 121, 0.15);
}
.ath-btn-simbolo-mat:active {
  transform: translateY(0);
}

/* Itens de lista selecionável em modais e painéis (Modelos de Apresentação e Estilos de Moldura) */
.ath-lista-selecionavel {
  border: 1px solid var(--ath-primary-line, #CBD5E1);
  border-radius: 8px;
  background: #F8FAFC;
  padding: 4px;
}
.ath-item-lista-sel {
  transition: all .12s ease;
  user-select: none;
}
.ath-item-lista-sel:hover {
  background: var(--ath-primary-soft, #EEF4FA) !important;
  border-color: var(--ath-primary-line, #C8D7E6) !important;
  transform: translateX(1px);
}
.ath-item-lista-sel.ativo {
  background: var(--ath-primary-soft, #EEF4FA) !important;
  border-color: var(--ath-primary, #314F79) !important;
}

/* Quadro do formato ocupando 100% da largura útil disponível, alinhado aos outros quadros */
.rm-icg.rm-icg-formato {
  width: 100% !important;
  max-width: 100% !important;
  box-sizing: border-box !important;
  display: grid !important;
  grid-template-columns: repeat(7, 1fr) !important;
  align-items: center !important;
  justify-items: center !important;
  background: var(--ath-input, #F4F5F8) !important;
  border: 1px solid var(--ath-primary-line, #C8D7E6) !important;
  border-radius: 999px !important;
  padding: 3px 4px !important;
  gap: 0 !important;
  margin: 0 !important;
}

.rm-icg.rm-icg-formato .rm-ic-bt {
  width: 34px !important;
  height: 34px !important;
  display: inline-grid !important;
  place-items: center !important;
  margin: 0 auto !important;
  border-radius: 50% !important;
  border: none !important;
}

.rm-icg.rm-icg-formato .rm-ic-bt.on,
.rm-icg.rm-icg-formato .rm-ic-bt[aria-pressed="true"] {
  background: var(--glx-primary, #314F79) !important;
  color: #FFFFFF !important;
  box-shadow: 0 4px 10px rgba(49, 79, 121, 0.20) !important;
}

/* =========================================================================
   Botões e Painéis de Topo (Arquivo & Margens, Cabeçalho/Rodapé, Estilos)
   e Coluna Esquerda Dividida 50/50 (Mestras em Uso e Blocos da Seção)
   ========================================================================= */

.rm-prev-topo {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 12px !important;
  position: relative !important;
  padding: 2px 0 6px 0 !important;
  flex-wrap: nowrap !important;
}

.rm-prev-topo-esq {
  display: flex;
  align-items: baseline;
  gap: 10px;
  min-width: 0;
  flex: 1 1 auto;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rm-prev-menus-topo {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: none;
  position: relative;
}

.rm-menu-topo-item {
  position: relative;
}

.rm-btn-menu-topo {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--ath-primary-line, #C8D7E6);
  background: #FFFFFF;
  color: var(--ath-primary, #314F79);
  font: 700 12px var(--glx-font, 'Nunito', sans-serif);
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.05);
  transition: all 0.15s ease;
  white-space: nowrap;
}

.rm-btn-menu-topo:hover,
.rm-btn-menu-topo.ativo,
.rm-btn-menu-topo[aria-expanded="true"] {
  background: var(--ath-primary-soft, #EEF4FA);
  border-color: var(--ath-primary, #314F79);
  color: var(--ath-primary, #314F79);
  box-shadow: 0 2px 6px rgba(49, 79, 121, 0.15);
}

.rm-topo-popover {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 320px;
  max-width: 90vw;
  background: #FFFFFF;
  border: 1px solid var(--ath-primary-line, #C8D7E6);
  border-radius: 16px;
  box-shadow: 0 12px 32px -4px rgba(15, 23, 42, 0.18), 0 4px 12px rgba(15, 23, 42, 0.08);
  padding: 14px 16px;
  z-index: 1050;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  gap: 10px;
  animation: athPopoverEntrada 0.16s cubic-bezier(0.16, 1, 0.3, 1);
}

.rm-topo-popover[hidden] {
  display: none !important;
}

.rm-topo-popover-estilos {
  width: 340px;
}

.rm-popover-topo-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--ath-primary-line, #C8D7E6);
}

.rm-popover-topo-head strong {
  font: 800 12px var(--glx-font, 'Nunito', sans-serif);
  color: var(--ath-primary, #314F79);
  text-transform: uppercase;
  letter-spacing: .05em;
}

@keyframes athPopoverEntrada {
  from { opacity: 0; transform: translateY(-6px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* Coluna lateral esquerda dividida 50/50 de forma fixa e elegante */
.rm-col-esq {
  overflow-y: hidden !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 12px !important;
  height: 100% !important;
  padding-right: 0 !important;
  min-height: 0 !important;
}

.rm-card-meio-a-meio {
  flex: 1 1 50% !important;
  min-height: 0 !important;
  max-height: calc(50% - 6px) !important;
  display: flex !important;
  flex-direction: column !important;
  overflow: hidden !important;
  background: #FFFFFF !important;
  border-radius: 18px !important;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04) !important;
  padding: 12px 14px !important;
  box-sizing: border-box !important;
}

.rm-card-meio-a-meio-topo {
  flex: none !important;
}

.rm-card-meio-a-meio-corpo {
  flex: 1 1 auto !important;
  min-height: 0 !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  scrollbar-width: thin !important;
  padding: 3px 6px 6px 3px !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 6px !important;
  box-sizing: border-box !important;
}

.rm-card-meio-a-meio-rodape {
  flex: none !important;
  margin-top: 8px !important;
  padding-top: 6px !important;
  border-top: 1px solid #F1F5F9 !important;
}

/* Botões e menus dropdown da barra contextual de texto (Soft UI) */
.rm-ic-sm {
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--ath-text, #1F2733);
  cursor: pointer;
  padding: 0;
  font-family: var(--glx-font, 'Nunito', sans-serif);
  font-size: 12.5px;
  transition: background .12s ease, border-color .12s ease, color .12s ease;
}
.rm-ic-sm:hover {
  background: var(--ath-surface-elevated, #F1F5F9);
  border-color: var(--ath-primary-line, #C8D7E6);
  color: var(--ath-primary, #314F79);
}
.rm-ic-sm.on {
  background: var(--ath-primary, #314F79);
  color: #FFFFFF;
  border-color: var(--ath-primary, #314F79);
}

.ath-ctx-dropdown-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
}
.ath-ctx-dropdown-btn {
  height: 28px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0 8px;
  border: 1px solid var(--ath-primary-line, #C8D7E6);
  border-radius: 999px;
  background: var(--ath-surface-elevated, #F8FAFC);
  color: var(--ath-primary, #314F79);
  font: 700 11px var(--glx-font, 'Nunito', sans-serif);
  cursor: pointer;
  transition: all .14s ease;
}
.ath-ctx-dropdown-btn:hover,
.ath-ctx-dropdown-btn.on {
  background: var(--ath-primary-soft, #EEF4FA);
  border-color: var(--ath-primary, #314F79);
}
.ath-ctx-dropdown-menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  min-width: 240px;
  background: #FFFFFF;
  border: 1px solid var(--ath-primary-line, #C8D7E6);
  border-radius: 14px;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.18), 0 4px 10px rgba(15, 23, 42, 0.08);
  padding: 8px;
  z-index: 9200;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.ath-ctx-dropdown-menu[hidden] {
  display: none !important;
}
.ath-ctx-menu-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  padding: 6px 10px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--ath-text, #1F2733);
  font: 700 11.5px var(--glx-font, 'Nunito', sans-serif);
  text-align: left;
  cursor: pointer;
  box-sizing: border-box;
}
.ath-ctx-menu-item:hover {
  background: #F1F5F9;
}
.ath-ctx-menu-item.on {
  background: var(--ath-primary-soft, #EEF4FA);
  border-color: var(--ath-primary, #314F79);
  color: var(--ath-primary, #314F79);
}
.ath-ctx-menu-simbolo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 26px;
  height: 20px;
  border-radius: 5px;
  background: #EEF4FA;
  color: var(--ath-primary, #314F79);
  font: 800 11px var(--glx-font, 'Nunito', sans-serif);
  padding: 0 4px;
}

/* ======================================================================
   Marcadores e Numeração Configurável (inspirado no Affinity Publisher)
   ====================================================================== */
.ath-texto-editable ul.ath-lista-quadrado,
ul.ath-lista-quadrado {
  list-style-type: square !important;
}

.ath-texto-editable ol.ath-lista-config,
ol.ath-lista-config,
.ath-texto-editable ul.ath-lista-config,
ul.ath-lista-config {
  list-style-type: none !important;
  margin-left: var(--ath-list-indent, 0mm) !important;
  padding-left: var(--ath-list-tab, 7mm) !important;
  counter-reset: ath-item var(--ath-list-counter-start, 0);
}

.ath-texto-editable ol.ath-lista-config > li,
ol.ath-lista-config > li,
.ath-texto-editable ul.ath-lista-config > li,
ul.ath-lista-config > li {
  position: relative !important;
  list-style-type: none !important;
  padding-left: 0 !important;
}

.ath-texto-editable ol.ath-lista-config > li,
ol.ath-lista-config > li {
  counter-increment: ath-item;
}

.ath-texto-editable ol.ath-lista-config > li::before,
ol.ath-lista-config > li::before,
.ath-texto-editable ul.ath-lista-config > li::before,
ul.ath-lista-config > li::before {
  position: absolute !important;
  left: calc(-1 * var(--ath-list-tab, 7mm)) !important;
  width: calc(var(--ath-list-tab, 7mm) - 1.5mm) !important;
  text-align: var(--ath-list-align, left) !important;
  color: var(--ath-primary, #314F79);
  font-weight: 700;
  white-space: nowrap;
}

/* Marcadores não numerados com ath-lista-config */
ul.ath-lista-config[data-marcador="circulo"] > li::before { content: "•"; }
ul.ath-lista-config[data-marcador="quadrado"] > li::before { content: "▪"; }
ul.ath-lista-config[data-marcador="traco"] > li::before { content: "–"; }
ul.ath-lista-config[data-marcador="ponto_traco"] > li::before { content: "·–"; }

/* Estilos numéricos: decimal (1, 2, 3) */
ol.ath-lista-config[data-num-estilo="decimal"][data-num-sep="ponto"] > li::before,
ol.ath-lista-config:not([data-num-estilo]) > li::before {
  content: counter(ath-item, decimal) ".";
}
ol.ath-lista-config[data-num-estilo="decimal"][data-num-sep="parentese"] > li::before {
  content: counter(ath-item, decimal) ")";
}
ol.ath-lista-config[data-num-estilo="decimal"][data-num-sep="entre_parenteses"] > li::before {
  content: "(" counter(ath-item, decimal) ")";
}
ol.ath-lista-config[data-num-estilo="decimal"][data-num-sep="travessao"] > li::before {
  content: counter(ath-item, decimal) " –";
}

/* Estilos numéricos: decimal_zero (01, 02, 03) */
ol.ath-lista-config[data-num-estilo="decimal_zero"][data-num-sep="ponto"] > li::before {
  content: counter(ath-item, decimal-leading-zero) ".";
}
ol.ath-lista-config[data-num-estilo="decimal_zero"][data-num-sep="parentese"] > li::before {
  content: counter(ath-item, decimal-leading-zero) ")";
}
ol.ath-lista-config[data-num-estilo="decimal_zero"][data-num-sep="entre_parenteses"] > li::before {
  content: "(" counter(ath-item, decimal-leading-zero) ")";
}
ol.ath-lista-config[data-num-estilo="decimal_zero"][data-num-sep="travessao"] > li::before {
  content: counter(ath-item, decimal-leading-zero) " –";
}

/* Estilos numéricos: lower_alpha (a, b, c) */
ol.ath-lista-config[data-num-estilo="lower_alpha"][data-num-sep="ponto"] > li::before {
  content: counter(ath-item, lower-alpha) ".";
}
ol.ath-lista-config[data-num-estilo="lower_alpha"][data-num-sep="parentese"] > li::before {
  content: counter(ath-item, lower-alpha) ")";
}
ol.ath-lista-config[data-num-estilo="lower_alpha"][data-num-sep="entre_parenteses"] > li::before {
  content: "(" counter(ath-item, lower-alpha) ")";
}
ol.ath-lista-config[data-num-estilo="lower_alpha"][data-num-sep="travessao"] > li::before {
  content: counter(ath-item, lower-alpha) " –";
}

/* Estilos numéricos: upper_alpha (A, B, C) */
ol.ath-lista-config[data-num-estilo="upper_alpha"][data-num-sep="ponto"] > li::before {
  content: counter(ath-item, upper-alpha) ".";
}
ol.ath-lista-config[data-num-estilo="upper_alpha"][data-num-sep="parentese"] > li::before {
  content: counter(ath-item, upper-alpha) ")";
}
ol.ath-lista-config[data-num-estilo="upper_alpha"][data-num-sep="entre_parenteses"] > li::before {
  content: "(" counter(ath-item, upper-alpha) ")";
}
ol.ath-lista-config[data-num-estilo="upper_alpha"][data-num-sep="travessao"] > li::before {
  content: counter(ath-item, upper-alpha) " –";
}

/* Estilos numéricos: lower_roman (i, ii, iii) */
ol.ath-lista-config[data-num-estilo="lower_roman"][data-num-sep="ponto"] > li::before {
  content: counter(ath-item, lower-roman) ".";
}
ol.ath-lista-config[data-num-estilo="lower_roman"][data-num-sep="parentese"] > li::before {
  content: counter(ath-item, lower-roman) ")";
}
ol.ath-lista-config[data-num-estilo="lower_roman"][data-num-sep="entre_parenteses"] > li::before {
  content: "(" counter(ath-item, lower-roman) ")";
}
ol.ath-lista-config[data-num-estilo="lower_roman"][data-num-sep="travessao"] > li::before {
  content: counter(ath-item, lower-roman) " –";
}

/* Estilos numéricos: upper_roman (I, II, III) */
ol.ath-lista-config[data-num-estilo="upper_roman"][data-num-sep="ponto"] > li::before {
  content: counter(ath-item, upper-roman) ".";
}
ol.ath-lista-config[data-num-estilo="upper_roman"][data-num-sep="parentese"] > li::before {
  content: counter(ath-item, upper-roman) ")";
}
ol.ath-lista-config[data-num-estilo="upper_roman"][data-num-sep="entre_parenteses"] > li::before {
  content: "(" counter(ath-item, upper-roman) ")";
}
ol.ath-lista-config[data-num-estilo="upper_roman"][data-num-sep="travessao"] > li::before {
  content: counter(ath-item, upper-roman) " –";
}

/* ======================================================================
   Colaboração em Tempo Real, Modos de Trabalho (Google Docs) e Google Drive
   ====================================================================== */
.ath-presenca-avatares {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 6px;
  border-radius: 999px;
  background: #F8FAFC;
  border: 1px solid var(--ath-primary-line, #C8D7E6);
}
.ath-avatar-bolinha {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #FFFFFF;
  font: 800 10.5px var(--glx-font, 'Nunito', sans-serif);
  box-shadow: 0 0 0 2px #FFFFFF;
  position: relative;
  cursor: pointer;
}
.ath-avatar-bolinha::after {
  content: "";
  position: absolute;
  bottom: -1px;
  right: -1px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #10B981;
  border: 1.5px solid #FFFFFF;
}

.ath-seletor-modo-trabalho {
  display: inline-flex;
  align-items: center;
  background: #F1F5F9;
  border: 1px solid var(--ath-primary-line, #C8D7E6);
  border-radius: 999px;
  padding: 2px;
  gap: 2px;
}
.ath-btn-modo-trab {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 26px;
  padding: 0 10px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: #475569;
  font: 700 11.5px var(--glx-font, 'Nunito', sans-serif);
  cursor: pointer;
  transition: all .14s ease;
}
.ath-btn-modo-trab:hover {
  color: var(--ath-text, #1F2733);
}
.ath-btn-modo-trab.on[data-modo="edicao"] {
  background: var(--ath-primary, #314F79);
  color: #FFFFFF;
  box-shadow: 0 1px 4px rgba(49, 79, 121, 0.25);
}
.ath-btn-modo-trab.on[data-modo="sugestao"] {
  background: #059669;
  color: #FFFFFF;
  box-shadow: 0 1px 4px rgba(5, 150, 105, 0.28);
}
.ath-btn-modo-trab.on[data-modo="comparar"] {
  background: #6D28D9;
  color: #FFFFFF;
  box-shadow: 0 1px 4px rgba(109, 40, 217, 0.28);
}
.ath-btn-modo-trab.on[data-modo="leitura"] {
  background: #475569;
  color: #FFFFFF;
}

/* Marcações de Revisão / Sugestão no Texto (Estilo Google Docs): cor do autor via --ath-sug-cor */
ins.ath-sug-ins {
  text-decoration: underline 2px var(--ath-sug-cor, #10B981);
  text-underline-offset: 2px;
  background: color-mix(in srgb, var(--ath-sug-cor, #10B981) 14%, transparent);
  color: inherit;
  padding: 0 2px;
  border-radius: 4px;
  cursor: pointer;
}
del.ath-sug-del {
  text-decoration: line-through 2px var(--ath-sug-cor, #EF4444);
  background: rgba(239, 68, 68, 0.12);
  color: #991B1B;
  padding: 0 2px;
  border-radius: 4px;
  cursor: pointer;
}
ins.ath-sug-ins:hover, del.ath-sug-del:hover { outline: 1.5px solid var(--ath-sug-cor, #10B981); }

/* Card contextual de decisão da sugestão (Aceitar / Rejeitar) */
.ath-card-sugestao {
  position: fixed;
  z-index: 10060;
  width: 288px;
  background: #FFFFFF;
  border: 1px solid #C8D7E6;
  border-radius: 12px;
  box-shadow: 0 12px 36px rgba(15, 23, 42, 0.24);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-family: var(--glx-font, 'Nunito', sans-serif);
}
.ath-card-sug-topo { display: flex; align-items: center; gap: 10px; }
.ath-card-sug-avatar { width: 30px; height: 30px; border-radius: 50%; color: #fff; font-weight: 800; font-size: 13px; display: grid; place-items: center; flex: none; }
.ath-card-sug-quem { display: flex; flex-direction: column; min-width: 0; }
.ath-card-sug-quem strong { font-size: 13px; color: #1F2733; }
.ath-card-sug-quem span { font-size: 11px; color: #64748B; }
.ath-card-sug-corpo { display: flex; flex-direction: column; gap: 6px; }
.ath-card-sug-linha { font-size: 12.5px; line-height: 1.35; padding: 5px 8px; border-radius: 8px; word-break: break-word; }
.ath-card-sug-linha.del { background: #FEE2E2; color: #991B1B; text-decoration: line-through; }
.ath-card-sug-linha.ins { background: #DCFCE7; color: #166534; }
.ath-card-sug-acoes { display: flex; gap: 8px; }
.ath-card-sug-acoes button { flex: 1; height: 32px; border-radius: 8px; border: 1px solid transparent; font: 800 12px var(--glx-font, inherit); cursor: pointer; }
.ath-card-sug-acoes .ath-btn-sug-aceitar { background: #059669; color: #fff; }
.ath-card-sug-acoes .ath-btn-sug-aceitar:hover { background: #047857; }
.ath-card-sug-acoes .ath-btn-sug-rejeitar { background: #fff; color: #B42318; border-color: #F3B4AE; }
.ath-card-sug-acoes .ath-btn-sug-rejeitar:hover { background: #FEF2F2; }

/* Cursor / Etiqueta de Colaborador Remoto no Bloco */
.ath-cursor-remoto-badge {
  position: absolute;
  top: -10px;
  right: 12px;
  z-index: 25;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  border-radius: 999px;
  color: #FFFFFF;
  font: 800 10px var(--glx-font, 'Nunito', sans-serif);
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.18);
  pointer-events: none;
}

/* Balões de Sugestão (Aceitar ✓ / Rejeitar ✗) */
.ath-balao-sugestao {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 12px;
  border-radius: 12px;
  background: #F8FAFC;
  border: 1px solid #CBD5E1;
  border-left: 4px solid #10B981;
}
.ath-balao-sugestao-topo {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}
.ath-balao-sugestao-autor {
  font: 800 11.5px var(--glx-font, 'Nunito', sans-serif);
  color: #065F46;
}
.ath-balao-sugestao-acoes {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.ath-btn-sug-aceitar,
.ath-btn-sug-rejeitar {
  height: 24px;
  padding: 0 8px;
  border-radius: 6px;
  font: 800 11px var(--glx-font, 'Nunito', sans-serif);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  border: 1px solid transparent;
}
.ath-btn-sug-aceitar {
  background: #DCFCE7;
  color: #166534;
  border-color: #86EFAC;
}
.ath-btn-sug-aceitar:hover {
  background: #16A34A;
  color: #FFFFFF;
}
.ath-btn-sug-rejeitar {
  background: #FEE2E2;
  color: #991B1B;
  border-color: #FCA5A5;
}
.ath-btn-sug-rejeitar:hover {
  background: #DC2626;
  color: #FFFFFF;
}

/* ==========================================================================
   POPOVER DE GOOGLE DRIVE & ARQUIVO PDF (ESTÚDIO DE ARTIGOS)
   ========================================================================== */
.ath-topo-popover-drive {
  width: 440px !important;
  max-width: min(440px, 94vw) !important;
  padding: 16px 18px !important;
  border-radius: 18px !important;
  box-shadow: 0 16px 36px -6px rgba(15, 23, 42, 0.2), 0 4px 12px rgba(15, 23, 42, 0.08) !important;
}

.ath-pop-drive-head {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  padding-bottom: 12px !important;
  border-bottom: 1px solid var(--ath-primary-line, #C8D7E6) !important;
  margin-bottom: 12px !important;
}

.ath-pop-drive-head strong {
  font: 800 13px var(--glx-font, 'Nunito', sans-serif) !important;
  color: var(--ath-primary, #314F79) !important;
  letter-spacing: .02em !important;
}

.ath-pop-drive-body {
  display: flex !important;
  flex-direction: column !important;
  gap: 12px !important;
}

.ath-pop-drive-card {
  background: #F8FAFC !important;
  border: 1px solid #E2E8F0 !important;
  border-radius: 12px !important;
  padding: 12px 14px !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 8px !important;
}

.ath-pop-drive-card-destaque {
  background: #F0F7FF !important;
  border-color: #BFDBFE !important;
}

.ath-pop-drive-card-tit {
  display: flex !important;
  align-items: center !important;
  gap: 6px !important;
  font-weight: 800 !important;
  font-size: 12.5px !important;
  color: #1E293B !important;
}

.ath-pop-label {
  font-size: 11.5px !important;
  font-weight: 700 !important;
  color: #475569 !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 4px !important;
}

.ath-pop-input {
  height: 36px !important;
  padding: 6px 10px !important;
  border-radius: 8px !important;
  border: 1px solid #CBD5E1 !important;
  font-size: 12px !important;
  font-family: inherit !important;
  background: #FFFFFF !important;
  width: 100% !important;
  box-sizing: border-box !important;
}

.ath-pop-drive-card-dica {
  font-size: 11px !important;
  color: #64748B !important;
  line-height: 1.4 !important;
}

.ath-pop-drive-status-pdf {
  display: flex !important;
  align-items: center !important;
  gap: 8px !important;
  font-size: 12px !important;
  margin-top: 2px !important;
}

.ath-pop-tag-ok {
  background: #DCFCE7 !important;
  color: #15803D !important;
  font-weight: 800 !important;
  padding: 3px 8px !important;
  border-radius: 6px !important;
  font-size: 11px !important;
  flex-shrink: 0 !important;
}

.ath-pop-tag-aviso {
  background: #FEF3C7 !important;
  color: #B45309 !important;
  font-weight: 800 !important;
  padding: 3px 8px !important;
  border-radius: 6px !important;
  font-size: 11px !important;
  flex-shrink: 0 !important;
}

.ath-pop-nome-arquivo {
  font-weight: 700 !important;
  color: #1E293B !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  max-width: 240px !important;
}

.ath-pop-nome-arquivo-vazio {
  font-size: 11.5px !important;
  color: #64748B !important;
  font-style: italic !important;
}

.ath-pop-drive-details {
  border: 1px solid #E2E8F0 !important;
  border-radius: 10px !important;
  padding: 8px 12px !important;
  background: #FFFFFF !important;
}

.ath-pop-drive-summary {
  font-size: 11.5px !important;
  font-weight: 700 !important;
  color: #64748B !important;
  cursor: pointer !important;
  user-select: none !important;
}

.ath-pop-drive-details-corpo {
  display: flex !important;
  flex-direction: column !important;
  gap: 8px !important;
  margin-top: 8px !important;
  padding-top: 8px !important;
  border-top: 1px dashed #E2E8F0 !important;
}

/* Aviso de vincular PDF na folha */
.ath-pdf-folha-vincular-aviso {
  width: 100%;
  height: 100%;
  min-height: 600px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 24px;
  box-sizing: border-box;
}

.ath-pdf-vincular-card {
  max-width: 540px;
  width: 100%;
  padding: 36px 28px;
  background: #FFFFFF;
  border: 2px dashed #93C5FD;
  border-radius: 20px;
  text-align: center;
  box-shadow: 0 10px 25px -5px rgba(37, 99, 235, 0.08);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.ath-pdf-vincular-icone {
  width: 64px;
  height: 64px;
  border-radius: 16px;
  background: #EFF6FF;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #2563EB;
}

.ath-pdf-vincular-titulo {
  font: 800 18px var(--glx-font, 'Nunito', sans-serif);
  color: var(--ath-primary, #314F79);
  margin: 0;
}

.ath-pdf-vincular-sub {
  font-size: 13.5px;
  color: #334155;
  margin: 0;
  line-height: 1.45;
}

.ath-pdf-vincular-instrucao {
  font-size: 12px;
  color: #64748B;
  margin: 0;
  line-height: 1.45;
}

.ath-pdf-vincular-botoes {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: 6px;
}

.ath-pdf-vincular-dropzone {
  font-size: 11.5px;
  color: #64748B;
  background: #F8FAFC;
  border: 1px solid #E2E8F0;
  border-radius: 8px;
  padding: 8px 12px;
  width: 100%;
  box-sizing: border-box;
}

.ath-palco-dragover {
  outline: 3px dashed #2563EB !important;
  outline-offset: -8px;
  background: rgba(239, 246, 255, 0.6) !important;
}

.ath-pdf-folha-vazia-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  min-height: 500px;
  text-align: center;
  color: #94A3B8;
  padding: 40px;
  box-sizing: border-box;
}

.ath-pdf-folha-vazia-aviso {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
}

.ath-pdf-folha-vazia-aviso span {
  font-weight: 800;
  font-size: 14px;
  color: #64748B;
}

.ath-pdf-folha-vazia-aviso p {
  font-size: 12px;
  max-width: 320px;
  margin: 0;
  line-height: 1.4;
}





/* ==========================================================================
   ATHENES — BARRA LATERAL DE PASTAS DO GOOGLE DRIVE NO DASHBOARD
   ========================================================================== */

.ath-dash-layout {
  display: flex;
  flex: 1 1 0;
  min-height: 0;
  height: 100%;
  max-height: 100%;
  background: var(--ath-fundo, #F8FAFC);
  border: 1px solid #E2E8F0;
  border-radius: 16px;
  overflow: hidden;
  box-sizing: border-box;
  position: relative;
}

.ath-dash-scrim {
  display: none;
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  z-index: 45;
  opacity: 0;
  transition: opacity 0.2s ease;
  pointer-events: none;
}

.ath-dash-scrim.ath-aberto {
  display: block;
  opacity: 1;
  pointer-events: auto;
}

.ath-dash-alca-pastas {
  display: none;
  position: absolute;
  top: 14px;
  left: 0;
  z-index: 40;
  width: 32px;
  height: 38px;
  background: #FFFFFF;
  border: 1px solid #CBD5E1;
  border-left: none;
  border-radius: 0 8px 8px 0;
  box-shadow: 2px 2px 8px rgba(15, 23, 42, 0.08);
  color: #314F79;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
}

.ath-dash-alca-pastas:hover {
  background: #EEF4FA;
  width: 36px;
}

.ath-dash-sidebar {
  width: 275px;
  min-width: 275px;
  height: 100%;
  max-height: 100%;
  background: #FFFFFF;
  border-right: 1px solid #E2E8F0;
  padding: 14px 12px 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-sizing: border-box;
  flex-shrink: 0;
  overflow: hidden;
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.ath-dash-sidebar-fechar-btn {
  display: none;
}

.ath-dash-sidebar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 8px;
  border-bottom: 1px solid #F1F5F9;
  flex-shrink: 0;
}

.ath-dash-pastas-lista {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding-right: 3px;
  -webkit-overflow-scrolling: touch;
}

.ath-dash-pastas-lista::-webkit-scrollbar {
  width: 5px;
}

.ath-dash-pastas-lista::-webkit-scrollbar-track {
  background: transparent;
}

.ath-dash-pastas-lista::-webkit-scrollbar-thumb {
  background: #CBD5E1;
  border-radius: 999px;
}

.ath-dash-pastas-lista::-webkit-scrollbar-thumb:hover {
  background: #94A3B8;
}

.ath-dash-grupo-titulo {
  font-size: 10.5px;
  font-weight: 800;
  color: #64748B;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin: 12px 6px 4px 6px;
}

.ath-pasta-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 10px;
  border-radius: 8px;
  color: #1E293B;
  font-size: 12px;
  font-weight: 650;
  cursor: pointer;
  transition: all 0.15s ease;
  border: 1px solid transparent;
  user-select: none;
}

.ath-pasta-item:hover {
  background: #F1F5F9;
}

.ath-pasta-item.active {
  background: #EEF4FA;
  color: #314F79;
  font-weight: 750;
  border-color: #C8D7E6;
}

.ath-pasta-item-sub {
  margin-left: 16px;
  font-size: 11.5px;
}

.ath-pasta-badge {
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 10px;
  background: #F1F5F9;
  color: #64748B;
  font-weight: 700;
}

.ath-pasta-item.active .ath-pasta-badge {
  background: #DBEAFE;
  color: #1E40AF;
}

.ath-dash-sidebar-acoes {
  flex-shrink: 0;
  padding-top: 10px;
  padding-bottom: 2px;
  border-top: 1px solid #F1F5F9;
  margin-top: auto;
}

.ath-dash-main-area {
  flex: 1 1 0;
  min-width: 0;
  height: 100%;
  max-height: 100%;
  padding: 20px 24px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
  box-sizing: border-box;
}

.ath-dash-pasta-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #FFFFFF;
  border: 1px solid #E2E8F0;
  border-radius: 10px;
  padding: 10px 16px;
  margin-bottom: 20px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.03);
}

/* Modo Gaveta Responsiva no Tablet e Telas Menores (<= 1024px) */
@media (max-width: 1024px) {
  .ath-dash-sidebar {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 50;
    width: 300px;
    max-width: 85vw;
    height: 100%;
    max-height: 100%;
    background: #FFFFFF;
    box-shadow: 4px 0 24px rgba(15, 23, 42, 0.18);
    transform: translateX(-105%);
    border-right: 1px solid #CBD5E1;
    pointer-events: none;
    visibility: hidden;
  }

  .ath-dash-sidebar.ath-aberto {
    transform: translateX(0);
    pointer-events: auto;
    visibility: visible;
  }

  .ath-dash-sidebar-fechar-btn {
    display: inline-flex !important;
  }

  .ath-dash-alca-pastas {
    display: inline-flex;
  }

  .ath-dash-main-area {
    width: 100%;
    height: 100%;
    max-height: 100%;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-y: contain;
    padding: 14px 16px;
  }

  .ath-dash-pasta-banner {
    padding: 8px 12px;
    margin-bottom: 14px;
  }
}

@media (max-width: 640px) {
  .ath-dash-main-area {
    padding: 10px 12px;
  }
  .ath-dash-topbar {
    padding: 6px 12px;
    gap: 8px;
  }
}


/* ===== Modos somente leitura: Leitura fiel e Comparar lado a lado ===== */
.rm-editor.ath-modo-revisao .rm-ed-grade { grid-template-columns: minmax(0, 1fr); }
.rm-editor.ath-modo-revisao .rm-col-esq,
.rm-editor.ath-modo-revisao .rm-col-dir,
.rm-editor.ath-modo-revisao .rm-prev-menus-topo,
.rm-editor.ath-modo-revisao .rm-barra-blocos,
.rm-editor.ath-modo-revisao .ath-zoom-indicador { display: none !important; }
.rm-prev-palco.ath-palco-revisao {
  padding: 0;
  gap: 0;
  overflow: hidden;
  align-items: stretch;
  background: #E8ECF1;
}
.ath-rev { display: flex; flex-direction: column; flex: 1; min-height: 0; width: 100%; height: 100%; }
.ath-rev-barra {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 8px 14px; background: #FFFFFF; border-bottom: 1px solid #D5DEE9;
  font-family: var(--glx-font, 'Nunito', sans-serif); font-size: 12px; color: #1F2733; flex: none;
}
.ath-rev-sub { color: #64748B; font-size: 11.5px; font-weight: 600; }
.ath-rev-espaco { flex: 1; }
.ath-rev-btn, .ath-rev-zoom {
  height: 28px; padding: 0 10px; border-radius: 8px; border: 1px solid #C8D7E6; background: #fff; color: #314F79;
  font: 700 11.5px var(--glx-font, inherit); cursor: pointer;
}
.ath-rev-btn:hover:not(:disabled), .ath-rev-zoom:hover { background: #EEF4FA; }
.ath-rev-btn:disabled { opacity: .45; cursor: default; }
.ath-rev-legenda { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.ath-rev-chip { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 700; color: #334155; }
.ath-rev-chip i { width: 12px; height: 12px; border-radius: 3px; display: inline-block; border: 1px solid #94A3B8; background: #fff; }
.ath-rev-chip.del i { background: #FEE2E2; border-color: #FCA5A5; }
.ath-rev-chip.add i { background: #DCFCE7; border-color: #86EFAC; }
.ath-rev-nav { display: inline-flex; align-items: center; gap: 6px; }
.ath-rev iframe { flex: 1; width: 100%; min-height: 0; border: 0; background: #E2E8F0; }
.ath-rev-paineis { flex: 1; min-height: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 10px; }
.ath-rev-quadro { display: flex; flex-direction: column; min-height: 0; border: 1px solid #CBD5E1; border-radius: 12px; overflow: hidden; background: #E2E8F0; }
.ath-rev-quadro-topo { flex: none; padding: 6px 12px; font: 800 11px var(--glx-font, inherit); text-transform: uppercase; letter-spacing: .04em; color: #475569; background: #F8FAFC; border-bottom: 1px solid #D5DEE9; }
.ath-rev-quadro.esq .ath-rev-quadro-topo { color: #991B1B; background: #FEF2F2; }
.ath-rev-quadro.dir .ath-rev-quadro-topo { color: #166534; background: #F0FDF4; }

/* Seções numeradas automaticamente: o número é pseudo-elemento (não faz parte do texto editável) */
.ath-titulo-numerado::before { content: attr(data-prefixo) " "; margin-right: .35em; user-select: none; pointer-events: none; }
/* Mapa do documento: recuo proporcional ao nível do título */
.rm-bl .rm-bl-nome { padding-left: var(--ath-outline-recuo, 0px); }
/* Salto a partir do sumário */
.ath-bloco-destaque-salto { outline: 2px solid #2F7BD0; outline-offset: 4px; border-radius: 4px; transition: outline-color .3s; }
.ath-sumario-vivo .ath-toc-link { cursor: pointer; }
.ath-sumario-vivo .ath-toc-link:hover .ath-toc-txt { text-decoration: underline; }

/* Painel da página inicial: o cartão branco (Escrita ou Leitura) ocupa toda a altura útil, em todas as abas,
   e cresce com o conteúdo (a área rola quando passa da tela). Antes o cartão terminava no último documento. */
.ath-dash-main-area { display: flex; flex-direction: column; overflow: hidden; min-height: 0; }
.ath-dash-main-area > .ath-dash-pasta-banner { flex: 0 0 auto; }
.ath-dashboard.ath-dashboard-estudio-full .ath-dash-main-area,
.ath-dashboard.ath-dashboard-estudio-full .ath-dash-main-area > #athSecaoDashArtigosZotero,
.ath-dashboard.ath-dashboard-estudio-full .ath-dash-main-area > #athSecaoDashArtigosZotero:not([hidden]) {
  flex: 1 1 auto !important;
  height: 100% !important;
  min-height: 100% !important;
  max-height: 100% !important;
  padding: 0 !important;
  margin: 0 !important;
  border: none !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  overflow: hidden !important;
}

.ath-dash-main-area > #athSecaoDashEscrita:not([hidden]),
.ath-dash-main-area > #athSecaoDashArtigosZotero:not([hidden]) {
  flex: 1 1 0;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior-y: contain;
  scrollbar-width: thin;
}

/* Menu de configurações (engrenagem): Tema & Estilos e Nuvem & Drive */
.rm-topo-config { width: 270px; padding: 6px; display: flex; flex-direction: column; gap: 2px; }
.rm-config-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; border: 0; border-radius: 8px; background: transparent; text-align: left; cursor: pointer; color: #1F2733; font: inherit; }
.rm-config-item:hover, .rm-config-item:focus-visible { background: #EEF4FA; outline: none; }
.rm-config-item svg { flex: none; color: #314F79; }
.rm-config-item strong { display: block; font: 700 12.5px var(--glx-font, inherit); }
.rm-config-item small { display: block; font-size: 11px; color: #64748B; }

/* Fidelidade com o PDF/DOCX: o bloco na folha não ganha preenchimento nem borda que estreitem o texto ou aumentem a distância
   entre blocos; o destaque de passar o mouse/selecionar é desenhado por fora (sombra), sem ocupar espaço. */
.ath-folha-area-util .ath-bloco-folha { padding: 0; border: 0; }
.ath-folha-area-util .ath-bloco-folha:hover { box-shadow: 0 0 0 1.5px #CBD5E1; }
.ath-folha-area-util .ath-bloco-folha.sel { box-shadow: 0 0 0 1.5px #314F79, 0 0 0 4.5px rgba(49, 79, 121, 0.16); }

/* Marcadores e numeração em títulos: o rótulo (data-marc) fica à esquerda, em recuo suspenso, e não entra no texto */
.ath-titulo-marcado { position: relative; }
.ath-titulo-marcado[data-marc]::after {
  content: attr(data-marc);
  position: absolute; left: var(--ath-marc-esq, 0); top: 0;
  width: var(--ath-marc-larg, 5.5mm); text-align: var(--ath-marc-alin, left);
  white-space: nowrap; user-select: none; pointer-events: none;
}

/* Lista com rolagem dentro do painel: barra fina, recuada das bordas arredondadas */
.ath-rolagem-interna { scrollbar-width: thin; scrollbar-color: #C3CEDB transparent; }
.ath-rolagem-interna::-webkit-scrollbar { width: 6px; }
.ath-rolagem-interna::-webkit-scrollbar-track { background: transparent; margin: 2px 0; }
.ath-rolagem-interna::-webkit-scrollbar-thumb { background: #C3CEDB; border-radius: 999px; }
.ath-rolagem-interna::-webkit-scrollbar-thumb:hover { background: #9DB0C6; }

/* ===== Layout: menus de página no cabeçalho; estilo em uso e modo de trabalho na barra de ferramentas ===== */
.ath-topo-shell .rm-prev-menus-topo { margin-right: 4px; }
.ath-topo-shell.ath-modo-revisao .rm-prev-menus-topo { display: none !important; }
.rm-editor.ath-modo-revisao .rm-barra-blocos { display: flex !important; justify-content: flex-end; }
.rm-editor.ath-modo-revisao .rm-barra-blocos > :not(.ath-modo-wrap) { display: none !important; }
.rm-prev-topo { display: none !important; }

.ath-caixa-estilo { position: relative; flex: none; }
.ath-caixa-estilo-btn { display: inline-flex; align-items: center; justify-content: space-between; gap: 8px; width: 168px; height: 32px; padding: 0 12px; border: 1px solid var(--ath-primary-line, #C8D7E6); border-radius: 10px; background: #fff; color: #1F2733; font: 700 12px var(--glx-font, 'Nunito', sans-serif); cursor: pointer; }
.ath-caixa-estilo-btn span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ath-caixa-estilo-btn:hover, .ath-caixa-estilo-btn[aria-expanded="true"] { background: #EEF4FA; border-color: var(--ath-primary, #314F79); }
.ath-caixa-estilo-btn.vazio { color: #94A3B8; font-weight: 600; }
.ath-caixa-estilo-menu { position: absolute; top: calc(100% + 6px); left: 0; width: 248px; max-height: 300px; overflow-y: auto; padding: 4px; background: #fff; border: 1px solid var(--ath-primary-line, #C8D7E6); border-radius: 14px; box-shadow: 0 12px 32px -4px rgba(15, 23, 42, .18); z-index: 1060; scrollbar-width: thin; scrollbar-color: #C3CEDB transparent; }
.ath-caixa-estilo-menu[hidden] { display: none !important; }
.ath-caixa-estilo-item { display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; padding: 7px 10px; border: 0; border-radius: 8px; background: transparent; color: #1E293B; font: 600 12px var(--glx-font, 'Nunito', sans-serif); text-align: left; cursor: pointer; }
.ath-caixa-estilo-item small { color: #64748B; font-size: 10.5px; }
.ath-caixa-estilo-item:hover, .ath-caixa-estilo-item.on { background: #EEF4FA; }

.ath-modo-wrap { position: relative; flex: none; margin-left: auto !important; }
.ath-modo-atual { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border: 1px solid var(--ath-primary-line, #C8D7E6); border-radius: 999px; background: #fff; color: var(--ath-primary, #314F79); font: 700 12px var(--glx-font, 'Nunito', sans-serif); cursor: pointer; }
.ath-modo-atual:hover, .ath-modo-atual[aria-expanded="true"] { background: #EEF4FA; border-color: var(--ath-primary, #314F79); }
.ath-modo-menu { position: absolute; top: calc(100% + 6px); right: 0; width: 190px; display: flex; flex-direction: column; gap: 2px; padding: 4px; background: #fff; border: 1px solid var(--ath-primary-line, #C8D7E6); border-radius: 14px; box-shadow: 0 12px 32px -4px rgba(15, 23, 42, .18); z-index: 1060; }
.ath-modo-menu[hidden] { display: none !important; }
.ath-modo-menu .ath-btn-modo-trab { height: 34px; width: 100%; padding: 0 10px; border-radius: 8px; justify-content: flex-start; background: transparent !important; color: #1E293B !important; box-shadow: none !important; }
.ath-modo-menu .ath-btn-modo-trab:hover { background: #EEF4FA !important; }
.ath-modo-menu .ath-btn-modo-trab.on { background: #EEF4FA !important; color: var(--ath-primary, #314F79) !important; }
.rm-barra-blocos .ath-modo-wrap ~ .rm-ic-bt,
.rm-barra-blocos .ath-modo-wrap ~ .rm-ic-guia,
.rm-barra-blocos #rmRegua,
.rm-barra-blocos #rmGuia,
.rm-barra-blocos .rm-ic-guia {
  margin-left: 0 !important;
}

/* A barra de ferramentas nunca passa da coluna do meio: se não couber, os itens quebram para a linha de baixo */
.rm-barra-blocos { flex-wrap: wrap; row-gap: 6px; min-width: 0; max-width: 100%; box-sizing: border-box; border-radius: 22px; }
.rm-barra-blocos > * { min-width: 0; }
.ath-caixa-estilo-btn { width: 150px; }
.rm-barra-blocos { gap: 6px; }
.rm-barra-blocos .rm-ic-bt { width: 34px; height: 34px; }

/* Dicas dos botões da barra: abrem para baixo (em cima o texto era cortado pela borda da área) */
.rm-barra-blocos .rm-ic-bt[data-tip]::after { top: calc(100% + 7px); bottom: auto; transform: translateX(-50%) translateY(-3px); }
.rm-barra-blocos .rm-ic-bt[data-tip]:hover::after, .rm-barra-blocos .rm-ic-bt[data-tip]:focus-visible::after { transform: translateX(-50%) translateY(0); }

/* Citação linkada à referência: herda cor e sem sublinhado (a limpeza de estilos remove o style inline) */
a.ath-citacao-link { color: inherit; text-decoration: none; cursor: pointer; }

/* Barras laterais recolhíveis e de largura ajustável (athenes_colunas_redim.js) */
.rm-editor .rm-ed-grade.ath-redim { position: relative; grid-template-columns: var(--ath-col-esq, 310px) minmax(0, 1fr) var(--ath-col-dir, 330px) !important; transition: grid-template-columns .18s ease; }
.rm-ed-grade.ath-redim.ath-redim-arrastando { transition: none; user-select: none; cursor: col-resize; }
.rm-ed-grade.ath-redim-fechada-esq > .rm-col-esq, .rm-ed-grade.ath-redim-fechada-dir > .rm-col-dir { visibility: hidden; overflow: hidden; pointer-events: none; }
.ath-redim-alca { position: absolute; top: 0; bottom: 0; width: 14px; z-index: 6; display: flex; align-items: center; justify-content: center; cursor: col-resize; touch-action: none; outline: none; }
.ath-redim-alca-esq { left: calc(var(--ath-col-esq, 310px) + var(--ath-gap, 12px) / 2 - 7px); }
.ath-redim-alca-dir { right: calc(var(--ath-col-dir, 330px) + var(--ath-gap, 12px) / 2 - 7px); }
.ath-redim-linha { position: absolute; top: 12px; bottom: 12px; left: 50%; width: 3px; margin-left: -1.5px; border-radius: 3px; background: transparent; transition: background .12s; }
.ath-redim-alca:hover .ath-redim-linha, .ath-redim-alca:focus-visible .ath-redim-linha, .ath-redim-arrastando .ath-redim-linha { background: #314F79; }
.ath-redim-alca:focus-visible { box-shadow: 0 0 0 2px rgba(49, 79, 121, .35); border-radius: 6px; }
.ath-redim-bt { position: relative; width: 18px; height: 40px; padding: 0; border: 1px solid #C8D7E6; border-radius: 9px; background: #fff; color: #314F79; font: 700 14px/1 var(--glx-font, sans-serif); cursor: pointer; opacity: 0; transition: opacity .12s; display: grid; place-items: center; box-shadow: 0 1px 4px rgba(15, 23, 42, .12); }
.ath-redim-alca:hover .ath-redim-bt, .ath-redim-alca:focus-within .ath-redim-bt, .ath-redim-fechada-esq .ath-redim-alca-esq .ath-redim-bt, .ath-redim-fechada-dir .ath-redim-alca-dir .ath-redim-bt { opacity: 1; }
.ath-redim-bt:hover { background: #EEF4FA; }
@media (hover: none) { .ath-redim-bt { opacity: 1; } }
/* Adaptação inteligente para tablets e telas menores (<= 1180px):
   O canvas (palco) ocupa 100% da área útil com altura total.
   As barras laterais NUNCA vão para cima nem empilham verticalmente:
   abrem como gavetas deslizantes (overlay drawers) sobre o canvas e recolhem com um toque. */
@media (max-width: 1180px) {
  .rm-ed-grade,
  .rm-editor .rm-ed-grade.ath-redim,
  .ath-estudio-full-shell .rm-ed-grade {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    position: relative !important;
    height: 100% !important;
    overflow: hidden !important;
  }

  .rm-col-prev {
    grid-column: 1 !important;
    grid-row: 1 !important;
    width: 100% !important;
    height: 100% !important;
    min-height: 0 !important;
    z-index: 1 !important;
  }

  .rm-col-esq {
    grid-column: 1 !important;
    grid-row: 1 !important;
    position: absolute !important;
    top: 0 !important;
    bottom: 0 !important;
    left: 0 !important;
    width: min(340px, 86vw) !important;
    max-width: 86vw !important;
    height: 100% !important;
    z-index: 50 !important;
    background: #fff !important;
    box-shadow: 4px 0 24px rgba(15, 23, 42, 0.18) !important;
    border-radius: 0 16px 16px 0 !important;
    transition: transform 0.22s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.22s ease !important;
    overflow-y: auto !important;
    padding: 12px 14px !important;
    box-sizing: border-box !important;
    visibility: visible !important;
    pointer-events: auto !important;
  }

  .rm-col-dir {
    grid-column: 1 !important;
    grid-row: 1 !important;
    position: absolute !important;
    top: 0 !important;
    bottom: 0 !important;
    right: 0 !important;
    width: min(340px, 86vw) !important;
    max-width: 86vw !important;
    height: 100% !important;
    z-index: 50 !important;
    background: #fff !important;
    box-shadow: -4px 0 24px rgba(15, 23, 42, 0.18) !important;
    border-radius: 16px 0 0 16px !important;
    transition: transform 0.22s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.22s ease !important;
    overflow-y: auto !important;
    padding: 12px 14px !important;
    box-sizing: border-box !important;
    visibility: visible !important;
    pointer-events: auto !important;
  }

  .rm-ed-grade.ath-redim-fechada-esq > .rm-col-esq,
  .rm-ed-grade.ath-redim-fechada-esq #rmColEsq,
  .rm-ed-grade.ath-redim-fechada-esq #athEstudioColEsq {
    transform: translateX(-105%) !important;
    visibility: hidden !important;
    pointer-events: none !important;
  }

  .rm-ed-grade.ath-redim-fechada-dir > .rm-col-dir,
  .rm-ed-grade.ath-redim-fechada-dir #athInspectorContainer,
  .rm-ed-grade.ath-redim-fechada-dir #athEstudioColDir {
    transform: translateX(105%) !important;
    visibility: hidden !important;
    pointer-events: none !important;
  }

  /* Alças de toque no tablet: sempre visíveis nas bordas */
  .ath-redim-alca {
    display: flex !important;
    z-index: 60 !important;
    position: absolute !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    height: auto !important;
    width: auto !important;
  }

  .ath-redim-alca-esq {
    left: 0 !important;
    transition: left 0.22s cubic-bezier(0.16, 1, 0.3, 1) !important;
  }
  .rm-ed-grade:not(.ath-redim-fechada-esq) .ath-redim-alca-esq {
    left: min(340px, 86vw) !important;
  }

  .ath-redim-alca-dir {
    right: 0 !important;
    transition: right 0.22s cubic-bezier(0.16, 1, 0.3, 1) !important;
  }
  .rm-ed-grade:not(.ath-redim-fechada-dir) .ath-redim-alca-dir {
    right: min(340px, 86vw) !important;
  }

  .ath-redim-linha {
    display: none !important;
  }

  .ath-redim-bt {
    opacity: 1 !important;
    width: 26px !important;
    height: 48px !important;
    box-shadow: 0 2px 10px rgba(15, 23, 42, 0.18) !important;
    background: #fff !important;
    border: 1px solid #C8D7E6 !important;
    color: #314F79 !important;
  }
  .ath-redim-alca-esq .ath-redim-bt {
    border-radius: 0 10px 10px 0 !important;
    border-left: 0 !important;
  }
  .ath-redim-alca-dir .ath-redim-bt {
    border-radius: 10px 0 0 10px !important;
    border-right: 0 !important;
  }

  /* Scrim transparente de fundo para fechar gaveta com toque fora */
  .ath-redim-scrim {
    display: block !important;
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    background: rgba(15, 23, 42, 0.25) !important;
    z-index: 45 !important;
    opacity: 0 !important;
    pointer-events: none !important;
    transition: opacity 0.2s ease !important;
  }
  .rm-ed-grade:not(.ath-redim-fechada-esq) .ath-redim-scrim,
  .rm-ed-grade:not(.ath-redim-fechada-dir) .ath-redim-scrim {
    opacity: 1 !important;
    pointer-events: auto !important;
  }
}
.rm-editor.ath-modo-revisao .rm-ed-grade.ath-redim { grid-template-columns: minmax(0, 1fr) !important; }
.rm-editor.ath-modo-revisao .ath-redim-alca { display: none; }

/* Réguas do documento (athenes_reguas_documento.js) */
.ath-palco-reguas { position: relative; flex: 1 1 0; min-height: 0; display: flex; flex-direction: column; }
.ath-palco-reguas > .rm-prev-palco { flex: 1 1 0; min-height: 0; margin: 20px 0 0 20px; }
.ath-regua-h { position: absolute; top: 0; left: 20px; height: 20px; z-index: 4; }
.ath-regua-v { position: absolute; top: 20px; left: 0; width: 20px; z-index: 4; }
.ath-regua-canto { position: absolute; top: 0; left: 0; width: 20px; height: 20px; background: #fff; border-right: 1px solid #C8D7E6; border-bottom: 1px solid #C8D7E6; z-index: 4; }
.ath-palco-reguas.sem-reguas > canvas, .ath-palco-reguas.sem-reguas > .ath-regua-canto { display: none; }
.ath-palco-reguas.sem-reguas > .rm-prev-palco { margin: 0; }
.rm-editor.ath-modo-revisao .ath-regua-h, .rm-editor.ath-modo-revisao .ath-regua-v, .rm-editor.ath-modo-revisao .ath-regua-canto { display: none; }
.rm-editor.ath-modo-revisao .ath-palco-reguas > .rm-prev-palco { margin: 0; }
ul.ath-lista-config[data-marcador="simbolo"] > li::before { content: attr(data-simbolo); }
ol.ath-lista-config > li[data-rotulo]::before { content: attr(data-rotulo) !important; }

/* Marcadores e numeração do estilo: modos, paleta de símbolos e formatos de sequência */
.ath-mk { display: flex; flex-direction: column; gap: 8px; }
.ath-mk-titulo { font: 800 11.5px var(--glx-font); text-transform: uppercase; letter-spacing: .05em; color: #475569; }
.ath-mk-modos { display: flex; gap: 3px; padding: 3px; background: #EEF2F6; border-radius: 10px; }
.ath-mk-modos button { flex: 1; border: 0; background: transparent; padding: 6px 6px; border-radius: 8px; font: 700 12px var(--glx-font); color: #64748B; cursor: pointer; }
.ath-mk-modos button.on { background: #fff; color: #314F79; box-shadow: 0 1px 3px rgba(15, 23, 42, .14); }
.ath-mk-painel[hidden] { display: none; }
.ath-mk-painel { display: flex; flex-direction: column; gap: 8px; }
.ath-mk-cats { display: flex; flex-wrap: wrap; gap: 4px; }
.ath-mk-cat { border: 1px solid #D5DDE8; background: #F8FAFC; color: #475569; border-radius: 999px; padding: 3px 9px; font: 700 11px var(--glx-font); cursor: pointer; transition: all .12s ease; }
.ath-mk-cat:hover { background: #EEF4FA; border-color: #B4C6DC; color: #314F79; }
.ath-mk-cat.on { background: #314F79; border-color: #314F79; color: #fff; }
.ath-mk-grade { display: grid; grid-template-columns: repeat(8, 1fr); gap: 4px; padding: 6px; background: #F8FAFC; border: 1px solid #E2E8F0; border-radius: 10px; max-height: 204px; overflow-y: auto; }
.ath-mk-grade-seq { grid-template-columns: repeat(4, 1fr); max-height: 196px; overflow-y: auto; }
.ath-mk-cel[hidden] { display: none !important; }
.ath-mk-cel { height: 32px; border: 1px solid transparent; border-radius: 8px; background: #fff; color: #1E293B; font: 600 15px/1 var(--glx-font, sans-serif); cursor: pointer; display: grid; place-items: center; padding: 0; }
.ath-mk-cel-seq { font-size: 12px; font-weight: 700; }
.ath-mk-cel:hover { background: #EEF4FA; border-color: #C8D7E6; }
.ath-mk-cel.on { background: #314F79; border-color: #314F79; color: #fff; }
.ath-mk-custom-row { display: flex; flex-direction: row !important; align-items: center; justify-content: space-between; gap: 8px !important; }
.ath-mk-custom-row .ath-input { width: 84px !important; text-align: center; font-weight: 700; }
.ath-mk-linha { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.ath-mk-campo { display: flex; flex-direction: column; gap: 3px; font: 700 11.5px var(--glx-font); color: #334155; }
.ath-mk-campo .ath-input, .ath-mk-campo .ath-select { height: 34px; width: 100%; box-sizing: border-box; }
.ath-mk-dica { color: #64748B; font-size: 11px; line-height: 1.4; }
.ath-fmt-icones .ath-fmt-txt { font: 800 12px var(--glx-font, sans-serif); letter-spacing: .02em; }
.ath-fmt-icones { display: inline-flex; flex-wrap: nowrap; gap: 4px; width: max-content; max-width: 100%; padding: 3px; }
.ath-fmt-icones .rm-ic-bt { flex: 0 0 34px; width: 34px; height: 34px; min-height: 34px; padding: 0; appearance: none; -webkit-appearance: none; }
/* modo de trabalho, réguas e grade ficam juntos, encostados à direita da barra (só o primeiro leva a margem automática) */
.rm-barra-blocos .ath-modo-wrap ~ .rm-ic-bt,
.rm-barra-blocos .ath-modo-wrap ~ .rm-ic-guia,
.rm-barra-blocos #rmRegua,
.rm-barra-blocos #rmGuia,
.rm-barra-blocos .rm-ic-guia {
  margin-left: 0 !important;
}

/* Barra de blocos do editor em UMA linha: o miolo (ícones de inserção) rola na horizontal, sem barra */
.rm-barra-blocos.ath-barra-uma-linha {
  flex-wrap: nowrap !important;
}
.rm-barra-blocos {
  flex-wrap: nowrap !important;
}
.ath-barra-rolagem {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  -ms-overflow-style: none;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-x;
  padding: 2px 0;
}
.ath-barra-rolagem::-webkit-scrollbar {
  display: none;
}
.ath-barra-rolagem { flex: 1 1 0; min-width: 0; display: flex; align-items: center; gap: 6px; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; -ms-overflow-style: none; -webkit-overflow-scrolling: touch; touch-action: pan-x; padding: 2px 0; }
.ath-barra-rolagem::-webkit-scrollbar { display: none; }
.ath-barra-rolagem > * { flex: none; }
.ath-barra-rolagem .rm-ic-bt[data-tip]::after { display: none; }
.rm-barra-blocos.ath-barra-uma-linha > .ath-modo-wrap { margin-left: 0 !important; }
/* barra de ferramentas do leitor também rola de lado em vez de quebrar */
#athEstudioBarraFlutuante { flex-wrap: nowrap; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
#athEstudioBarraFlutuante::-webkit-scrollbar { display: none; }
#athEstudioBarraFlutuante > * { flex: none; }
#athEstudioBarraFlutuante .rm-ic-bt[data-tip]::after { display: none; }

/* Barra de cima em tablets e telas menores: nada fica cortado (rótulos viram só ícone, título encolhe) */
@media (max-width: 1366px) {
  .ath-topo-shell { padding: 0 10px; gap: 8px; }
  .ath-topo-esq, .ath-topo-dir { gap: 6px; min-width: 0; }
  .ath-topo-esq { flex: 1 1 auto; }
  .ath-topo-dir { flex: none; }
  .ath-doc-titulo-topo { min-width: 0; width: auto; flex: 1 1 80px; max-width: 240px; text-overflow: ellipsis; }
  .ath-topo-esq > *:not(.ath-doc-titulo-topo) { flex: none; }
  .ath-selo-zotero { display: none !important; }
  .ath-topo-shell .rm-btn-menu-topo > span,
  .ath-topo-dir .glx-btn > span { display: none; }
  .ath-topo-shell .rm-btn-menu-topo, .ath-topo-dir .glx-btn { padding-left: 10px; padding-right: 10px; }
}

/* Suporte a Pinch-to-Zoom e Pan suave em tablets */
.rm-prev-palco, #athEstudioPalco, #rmPrevPalco {
  touch-action: pan-x pan-y;
  -webkit-overflow-scrolling: touch;
}

/* Modo Caneta Stylus / Samsung Notes */
.rm-barra-blocos .ath-btn-dedo-rola.ativo {
  background: #314F79 !important;
  color: #FFFFFF !important;
  border-color: #314F79 !important;
}

/* ─────────────────────────────────────────────────────────────────────────────
   Camada Visual de Marcação Retórica e Estrutura Científica (Editor-Only)
   ───────────────────────────────────────────────────────────────────────────── */

/* Botão no topo do editor */
.ath-btn-semantica-topo.on {
  background: #EEF4FA !important;
  color: #314F79 !important;
  border-color: #314F79 !important;
}
.ath-btn-semantica-topo.on svg {
  color: #314F79 !important;
}

/* Popover de Estrutura Científica */
.ath-popover-semantica {
  width: 340px;
  max-width: 95vw;
  padding: 12px;
  background: #FFFFFF;
  border-radius: 14px;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.16);
  border: 1px solid #C8D7E6;
  font: 600 12px var(--glx-font, system-ui);
}

.ath-sem-pop-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid #EEF2F6;
  margin-bottom: 8px;
}
.ath-sem-pop-titulo {
  font-size: 13px;
  font-weight: 800;
  color: #314F79;
}
.ath-sem-pop-sub {
  font-size: 10.5px;
  color: #64748B;
  margin-top: 1px;
}

/* Switch Toggle Global */
.ath-switch-label {
  position: relative;
  display: inline-block;
  width: 40px;
  height: 22px;
  flex: none;
  cursor: pointer;
}
.ath-switch-label input {
  opacity: 0;
  width: 0;
  height: 0;
}
.ath-switch-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background-color: #CBD5E1;
  transition: all .18s ease;
  border-radius: 999px;
  border: 1.5px solid #94A3B8;
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.1);
}
.ath-switch-slider:before {
  position: absolute;
  content: "";
  height: 14px;
  width: 14px;
  left: 2px;
  bottom: 2px;
  background-color: #FFFFFF;
  transition: all .18s ease;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}
.ath-switch-label input:checked + .ath-switch-slider {
  background-color: #314F79;
  border-color: #314F79;
  box-shadow: 0 0 0 2px rgba(49, 79, 121, 0.25), inset 0 1px 2px rgba(0,0,0,0.2);
}
.ath-switch-label input:checked + .ath-switch-slider:before {
  transform: translateX(18px);
}

.ath-sem-pop-botoes-topo {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-bottom: 8px;
}

.ath-sem-lista-tags {
  display: flex;
  flex-direction: column;
  gap: 3px;
  max-height: 260px;
  overflow-y: auto;
  padding-right: 2px;
}

.ath-sem-item-tag {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 8px;
  border-radius: 8px;
  background: #F8FAFC;
  border: 1px solid #E2E8F0;
  transition: background .12s ease;
}
.ath-sem-item-tag:hover {
  background: #F1F5F9;
}
.ath-sem-item-tag.pincel-on {
  border-color: #314F79;
  background: #EEF4FA;
}
.ath-bloco-uniao-selecionado {
  outline: 2px solid #314F79;
  outline-offset: 2px;
  background: #EEF4FA;
}
.ath-bloco-uniao-selecionado .ath-bloco-barra-rapida { pointer-events: none; }
.ath-cor-cromatica { display: grid; justify-items: center; gap: 10px; margin-top: 12px; padding: 12px; border: 1px solid #DCE6F0; border-radius: 12px; background: #F8FAFC; }
.ath-cor-cromatica-abas { display: flex; gap: 6px; }
.ath-cor-cromatica-abas button { border: 1px solid #C8D7E6; border-radius: 999px; background: #fff; color: #314F79; padding: 5px 14px; cursor: pointer; font: 700 11px var(--glx-font); }
.ath-cor-cromatica-abas button.ativo { color: #fff; background: #314F79; }
.ath-circulo-cromatico { position: relative; width: 156px; height: 156px; border-radius: 50%; cursor: crosshair; touch-action: none; background: radial-gradient(circle, #fff 0%, rgba(255,255,255,0) 75%), conic-gradient(red, #ff0, lime, cyan, blue, magenta, red); border: 2px solid #fff; box-shadow: 0 0 0 1px #C8D7E6, 0 4px 12px rgba(49,79,121,.16); }
.ath-circulo-indicador { position: absolute; width: 13px; height: 13px; border: 2px solid #fff; border-radius: 50%; box-shadow: 0 0 0 2px #314F79; transform: translate(-50%, -50%); pointer-events: none; }
.ath-cor-cromatica input[type="range"] { display: block; width: 170px; accent-color: #314F79; }

.ath-sem-amostra-cor {
  width: 22px;
  height: 22px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 800;
  border: 1px solid rgba(0, 0, 0, 0.08);
  flex: none;
}

.ath-sem-info-tag {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.ath-sem-tag-nome {
  font-size: 11.5px;
  font-weight: 700;
  color: #1F2733;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ath-sem-tag-sub {
  font-size: 10px;
  color: #64748B;
}

.ath-sem-acoes-tag {
  display: flex;
  align-items: center;
  gap: 3px;
  flex: none;
}
.ath-btn-acao-pincel {
  background: none;
  border: 1px solid #CBD5E1;
  border-radius: 6px;
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  cursor: pointer;
  color: #475569;
}
.ath-btn-acao-pincel.ativo {
  background: #314F79;
  color: #FFF;
  border-color: #314F79;
}
.ath-btn-acao-remover {
  background: none;
  border: none;
  color: #DC2626;
  font-weight: 800;
  cursor: pointer;
  padding: 0 4px;
}

.ath-sem-pop-footer {
  margin-top: 8px;
  padding-top: 6px;
  border-top: 1px solid #EEF2F6;
  font-size: 10px;
  color: #64748B;
  text-align: center;
}

/* Indicador de Modo Pincel Ativo */
.ath-indicador-pincel {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  background: #1E293B;
  color: #FFFFFF;
  padding: 8px 16px;
  border-radius: 999px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
  font: 700 12px var(--glx-font);
  display: flex;
  align-items: center;
  gap: 12px;
}

.ath-cursor-pincel-ativo [contenteditable="true"] {
  cursor: crosshair !important;
}

/* Badge Flutuante (Tooltip) ao passar o mouse */
.ath-badge-semantica-hover {
  position: fixed;
  z-index: 10000;
  background: rgba(15, 23, 42, 0.92);
  color: #FFFFFF;
  border-radius: 6px;
  padding: 3px 8px;
  font: 700 11px var(--glx-font, system-ui);
  display: flex;
  align-items: center;
  gap: 6px;
  pointer-events: auto;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
}
.ath-badge-semantica-hover .ath-badge-remover {
  background: none;
  border: none;
  color: #F87171;
  font-weight: 800;
  font-size: 11px;
  cursor: pointer;
  padding: 0 2px;
  line-height: 1;
}
.ath-badge-semantica-hover .ath-badge-remover:hover {
  color: #EF4444;
}

/* Modal Criar Marcador */
.ath-modal-criar-semantico {
  width: 420px;
}
.ath-form-cores-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 6px;
}
.ath-previa-marcador-wrap {
  margin-top: 12px;
  padding: 10px;
  background: #F8FAFC;
  border: 1px dashed #CBD5E1;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.ath-previa-marcador-lbl {
  font-size: 10.5px;
  color: #64748B;
  font-weight: 700;
  text-transform: uppercase;
}

/* Regra estrita de impressão */
@media print {
  .ath-badge-semantica-hover,
  .ath-indicador-pincel,
  .ath-popover-semantica {
    display: none !important;
  }
}
