:root {
  color-scheme: light;
  font-synthesis: none;
  --bg: #f5f5f7;
  --surface: rgba(255, 255, 255, .88);
  --surface-solid: #fff;
  --text: #1d1d1f;
  --muted: #6e6e73;
  --line: rgba(0, 0, 0, .09);
  --line-strong: rgba(0, 0, 0, .16);
  --accent: #0071e3;
  --accent-hover: #0077ed;
  --success: #16794d;
  --danger: #b42318;
  --navy: #001b4d;
  --light-blue: #eef5fc;
  --shadow: 0 24px 70px rgba(0, 0, 0, .10), 0 2px 8px rgba(0, 0, 0, .05);
  --radius-lg: 22px;
  --radius-md: 14px;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at 15% -10%, rgba(0, 153, 204, .14), transparent 34rem),
    radial-gradient(circle at 100% 10%, rgba(0, 221, 255, .10), transparent 30rem),
    var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  display: flex;
  flex-direction: column;
}

button, input { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
.wrap, .shell { width: min(1240px, calc(100% - 32px)); margin-inline: auto; }
.skip-link {
  position: fixed; top: -70px; left: 16px; z-index: 999;
  padding: 12px 16px; border-radius: 0 0 10px 10px;
  color: #fff; background: var(--navy); font-weight: 700; text-decoration: none;
}
.skip-link:focus { top: 0; }

.site-header {
  position: sticky; top: 0; z-index: 50;
  border-bottom: 1px solid rgba(0, 0, 0, .06);
  background: rgba(238, 250, 252, .8);
  backdrop-filter: saturate(180%) blur(20px);
}
.brand-row { min-height: 68px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.logo-box { width: min(380px, 64vw); height: 60px; display: flex; align-items: center; overflow: hidden; }
.logo { display: block; width: auto; max-width: 380px; height: auto; max-height: 52px; object-fit: contain; object-position: left center; }
.brand-ia { color: #0089a3; }
.product-chip {
  padding: 8px 13px; border: 1px solid var(--line);
  border-radius: 999px; color: var(--navy); background: rgba(255, 255, 255, .72);
  font-size: .78rem; font-weight: 750;
}
.logout-button {
  min-height: 38px; padding: 8px 13px; display: inline-flex; align-items: center; gap: 7px;
  border: 1px solid var(--line); border-radius: 999px; color: var(--navy);
  background: rgba(255, 255, 255, .72); cursor: pointer;
  font-size: .78rem; font-weight: 750;
}
.logout-button:hover { color: var(--accent); border-color: rgba(0,102,204,.34); background: #fff; }
.logout-button svg {
  width: 17px; height: 17px; fill: none; stroke: currentColor;
  stroke-width: 1.45; stroke-linecap: round; stroke-linejoin: round;
}
.header-right-group { display: flex; align-items: center; gap: 14px; }
.active-registry-office-topbar {
  display: flex; align-items: center; font-size: .72rem; font-weight: 400;
  color: var(--muted); white-space: nowrap; text-align: right;
}

main { flex: 1 0 auto; }
/* `place-items: center` deixava a coluna do grid em `auto`, e coluna `auto` se
   estica até o MAIOR conteúdo: as seis caixas do código pedem 6×56 mais folga,
   e o cartão nascia com 428px dentro de uma casca de 343 — a lateral direita
   saía fora da tela no celular, cortada. `minmax(0, 1fr)` prende a coluna à
   casca, e aí `width: 100%` do cartão volta a querer dizer o que diz. */
.login-shell {
  width: min(520px, calc(100% - 32px)); margin: auto; padding: 70px 0;
  display: grid; grid-template-columns: minmax(0, 1fr); align-content: center;
}
.login-card {
  width: 100%; padding: clamp(28px, 6vw, 44px); border: 1px solid var(--line);
  border-radius: 24px; background: rgba(255,255,255,.9);
  box-shadow: 0 24px 70px rgba(17,31,52,.1);
}
/* Três rem serviam a "Entrar" e estouravam com "Insira o código de
   verificação de e-mail", que é o título que o allauth manda de verdade e
   ocupava duas linhas gigantes antes de qualquer conteúdo. */
.login-card h1 { margin: 7px 0 12px; font-size: clamp(1.55rem, 5.2vw, 2.1rem); line-height: 1.15; letter-spacing: -.03em; text-wrap: balance; }
/* `anywhere` por causa do endereço de e-mail: "confirmamos para
   fulano@empresa-de-nome-comprido.com" é uma palavra só para o navegador, e
   ela furava o cartão pela direita. */
.login-intro { margin: 0 0 28px; color: var(--muted); line-height: 1.55; overflow-wrap: anywhere; }
/* O parágrafo que vem DEPOIS do formulário é rodapé, não introdução: "entre em
   contato se tiver problema" é nota de pé de página, e no corpo do texto ele
   competia com a ação da tela. */
.login-card form ~ .login-intro { margin: 16px 0 0; font-size: .72rem; line-height: 1.5; }
/* A fileira de ações do formulário de conta. `row-reverse` porque o allauth
   manda o botão principal primeiro e o nosso Cancelar depois: na tela o
   desistir fica à esquerda e o seguir adiante à direita, como no resto do
   sistema. `:has(> *)` para não abrir folga nas telas que não têm ação
   nenhuma. */
.conta-acoes { display: flex; gap: 10px; }
.conta-acoes:has(> *) { margin-top: 22px; }
.conta-acoes:has(> * + *) { flex-direction: row-reverse; justify-content: space-between; align-items: center; }
.conta-acoes > .button, .conta-acoes > .login-link { margin-top: 0; }
.conta-acoes:has(> * + *) > .button { width: auto; }
/* O allauth às vezes entrega os dois botões dentro de um grupo (`.ev-acoes`),
   como na tela do código: a fileira de fora vê UM filho e não inverte nada. A
   mesma regra vale para o grupo — desistir à esquerda, seguir à direita, em
   toda tela de conta. */
.conta-acoes > .ev-acoes { flex: 1; margin-top: 0; }
.conta-acoes > .ev-acoes:has(> * + *) { flex-direction: row-reverse; justify-content: space-between; }
/* `minmax(0, 1fr)` pelo mesmo motivo da `.login-shell`: coluna `auto` cresce
   até o maior conteúdo, e as seis caixas do código pediam 371px dentro de um
   campo de 302 — as duas últimas saíam pela direita do cartão. */
.login-field { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; }
.login-field + .login-field { margin-top: 20px; }
.login-field > span, .login-field label span { font-size: .78rem; font-weight: 750; }
.login-field label { display: block; }
/* O `select` é campo como os outros: sem isto ele nasce com a caixa nativa do
   sistema no meio de campos de 49px e raio 12, e a tela inteira perde o
   ritmo. */
.login-field input, .login-field select { min-height: 49px; font-size: .92rem; width: 100%; }
.login-field select { padding: 11px 13px; border: 1px solid var(--line); background: rgba(255,255,255,.94); color: var(--text); font-family: inherit }
.password-input-wrap { position: relative; }
.password-input-wrap input { padding-right: 46px; }
.password-toggle-button {
  position: absolute; top: 50%; right: 8px; transform: translateY(-50%);
  display: grid; place-items: center; width: 34px; height: 34px; padding: 0;
  border: none; background: transparent; color: var(--muted); cursor: pointer; border-radius: 8px;
}
.password-toggle-button:hover { color: var(--text); background: rgba(15,23,42,.06); }
.password-toggle-button svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.login-submit { width: 100%; margin-top: 16px; justify-content: center; }
/* Seis caixas de 56px com folga de 8px pedem 376px, e o cartão oferece 307 no
   celular: a última saía por baixo dos botões. `flex: 1 1 0` com `min-width: 0`
   as faz dividir o que há. */
.code-boxes { display: flex; gap: clamp(5px, 1.8vw, 9px); }
.code-boxes .code-box {
  flex: 1 1 0; width: auto; min-width: 0; min-height: 54px; max-width: 56px; padding: 0;
  text-align: center; text-transform: uppercase;
  font-size: clamp(1.1rem, 5vw, 1.4rem); font-weight: 800; letter-spacing: 0;
}
.auth-code-boxes .auth-code-box {
  width: 100%; min-height: 52px; max-width: 56px; padding: 0;
  text-align: center; text-transform: uppercase;
  font-size: 1.4rem; font-weight: 800; letter-spacing: 0;
}
.code-sent {
  margin: 0 0 22px; padding: 13px 14px; display: flex; align-items: flex-start; gap: 10px;
  border-radius: 13px; color: #205d3c; background: #edf8f2;
}
/* `flex: none` porque o "i" é um círculo e não um pedaço de texto: como item
   de flex ele encolhia junto com a caixa quando o e-mail era comprido, e o
   redondo virava um ovo. */
.code-sent > span { flex: none; width: 20px; height: 20px; display: grid; place-items: center; border-radius: 50%; color: #fff; background: #2f8a59; font-size: .7rem; }
.code-sent p { margin: 0; font-size: .78rem; line-height: 1.45; overflow-wrap: anywhere; }
.login-note { margin: 9px 0 0; color: var(--muted); font-size: .72rem; line-height: 1.5; }
.login-link { width: 100%; margin-top: 13px; border: 0; color: var(--accent); background: transparent; cursor: pointer; font-size: .78rem; font-weight: 700; }
/* Estava definida só no `produto.css`, que a tela de conta não carrega: os
   botões do allauth encostavam nas caixas do código sem folga nenhuma. Uma
   fileira de ações não é do produto nem da conta — é do design system. */
.ev-acoes { display: flex; flex-wrap: wrap; gap: 9px; justify-content: center; margin-top: 24px; }

/* A escolha entre duas coisas: fichas, e o alvo é a ficha inteira. */
/* Duas fichas lado a lado; no celular elas dividem a largura e continuam com
   48px de altura, que é o alvo mínimo da D-257. */
.escolha-linha { display: flex; gap: 10px; }
.login-field .escolha span { font-size: .85rem; font-weight: 600; }
/* `.login-field label { display: block }` tem a mesma força e vem antes: a
   ficha voltava a ser bloco e o texto caía debaixo do círculo. */
.login-field .escolha {
  flex: 1; display: flex; align-items: center; gap: 9px; min-height: 48px;
  padding: 0 13px; border: 1px solid var(--line); border-radius: 12px;
  background: #fff; cursor: pointer; font-size: .85rem;
}
.login-field .escolha:has(input:checked) { border-color: var(--accent); background: var(--light-blue); }
.login-field .escolha input { width: 18px; height: 18px; margin: 0; flex: none; accent-color: var(--accent); }

/* O medidor e as quatro regras, com os valores do desenho: barra de 4px com
   4px de folga, lista a 12px do campo com 6px entre linhas, texto em .75rem.
   Verde é #16794d e vermelho é #b42318, do design system. */
.senha-medida { margin-top: 11px }
.senha-barras { display: flex; gap: 4px }
.senha-barras i { height: 4px; flex: 1 1 0; border-radius: 2px; background: #e6e6ea; transition: background .15s ease }
.senha-nota { display: block; margin-top: 5px; font-size: .72rem; font-weight: 700; color: var(--muted) }

.senha-medida[data-forca="1"] .senha-barras i:nth-child(-n+1),
.senha-medida[data-forca="2"] .senha-barras i:nth-child(-n+2),
.senha-medida[data-forca="3"] .senha-barras i:nth-child(-n+3),
.senha-medida[data-forca="4"] .senha-barras i { background: currentColor }
.senha-medida[data-forca="1"] { color: #b42318 }
.senha-medida[data-forca="2"] { color: #b54708 }
.senha-medida[data-forca="3"], .senha-medida[data-forca="4"] { color: #16794d }
.senha-medida[data-forca] .senha-nota { color: currentColor }

/* A regra nasce cinza e acende verde. Vermelha só depois que a pessoa
   escreveu alguma coisa: um item vermelho num campo vazio acusa quem ainda
   não fez nada. */
.senha-regras { margin: 12px 0 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 6px }
.senha-regras li { display: flex; align-items: center; gap: 7px; font-size: .75rem; line-height: 1.35; color: var(--muted) }
.senha-regras svg { width: 13px; height: 13px; flex: none; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; opacity: .45 }
.senha-regras li.ok { color: #16794d }
.senha-regras li.ok svg { opacity: 1 }
.senha-regras li.falta { color: #b42318 }
.senha-regras li.falta svg { opacity: 1 }

.login-message { min-height: 21px; margin: 16px 0 0; font-size: .78rem; line-height: 1.45; text-align: center; }
.login-message.error { color: var(--danger); }
.app-shell { padding: 40px 0 64px; }
.page-heading { margin-bottom: 26px; display: flex; justify-content: flex-end; align-items: flex-end; gap: 24px; }
.eyebrow, .section-kicker {
  margin: 0; color: var(--accent); font-size: .72rem; font-weight: 800;
  letter-spacing: .14em; text-transform: uppercase;
}
.file-size { color: var(--muted); font-size: .74em; font-weight: 500; }
.page-heading h1 { margin: 5px 0 8px; font-size: clamp(2.4rem, 5vw, 4rem); line-height: .98; letter-spacing: -.055em; }
.lead { margin: 0; color: var(--muted); font-size: 1rem; line-height: 1.5; }
.batch-count {
  min-width: 142px; padding: 14px 18px; display: grid;
  border: 1px solid var(--line); border-radius: 18px; background: rgba(255, 255, 255, .72);
  box-shadow: 0 8px 28px rgba(0, 0, 0, .05);
}
.batch-count strong { font-size: 1.55rem; letter-spacing: -.04em; }
.batch-count span { color: var(--muted); font-size: .75rem; }
.module-tabs {
  position: static; width: 80%; max-width: 1080px; margin: 0 auto 34px; padding: 6px;
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px;
  border: 1px solid rgba(0, 0, 0, .08); border-radius: 20px;
  background: rgba(235, 235, 240, .82); box-shadow: 0 12px 34px rgba(0, 0, 0, .08);
  backdrop-filter: blur(20px);
}
.module-tab {
  min-height: 62px; display: grid; place-content: center; gap: 2px;
  border: 0; border-radius: 15px; background: transparent; color: var(--muted);
  font-weight: 760; cursor: pointer;
  transition: background .2s ease, color .2s ease, box-shadow .2s ease, transform .2s ease;
}
/* Item da barra é alvo, e não frase: o sublinhado o fazia parecer link
   de texto no meio de uma coluna de ícones. */
.module-tab { text-decoration: none; }
.module-tab:hover { color: var(--text); }
.module-tab.active, .module-tab[aria-selected="true"] {
  color: var(--text); background: rgba(255, 255, 255, .97);
  box-shadow: 0 5px 18px rgba(0, 0, 0, .1), inset 0 0 0 1px rgba(255, 255, 255, .75);
}
.module-tab:focus-visible { outline: 3px solid rgba(0, 102, 204, .26); outline-offset: 2px; }
.module-tab-kicker {
  color: var(--accent); font-size: .67rem; font-weight: 850;
  letter-spacing: .11em; text-transform: uppercase;
}
.tab-panel { animation: tab-panel-in .22s ease both; }
.tab-panel[hidden] { display: none !important; }
@keyframes tab-panel-in {
  from { opacity: 0; transform: translateY(7px); }
  to { opacity: 1; transform: none; }
}
.construction-card {
  min-height: 440px; padding: 52px; display: grid; place-items: center;
  align-content: center; text-align: center; border: 1px solid var(--line);
  border-radius: 26px; background: var(--surface);
  box-shadow: 0 24px 70px rgba(0, 0, 0, .08);
}
.construction-mark {
  width: 72px; height: 72px; margin-bottom: 22px; display: grid; place-items: center;
  border-radius: 22px; color: #fff; background: var(--navy);
  font-size: 1rem; font-weight: 850; letter-spacing: .08em;
}
.construction-card h2 { margin: 7px 0 10px; font-size: clamp(2.2rem, 6vw, 3.6rem); letter-spacing: -.05em; }
.construction-card > p:last-child { max-width: 510px; margin: 0; color: var(--muted); line-height: 1.55; }
.ia-topbar { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 18px; }
.ia-topbar p { margin: 0; color: var(--muted); }
.converter-flow { display: grid; gap: 18px; }
.flow-card { padding: 24px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); box-shadow: var(--shadow); }
.pipeline-dashboard-card .section-heading { align-items: flex-start; }
.pipeline-v2-panel { display:flex; gap:16px; align-items:center; justify-content:space-between; margin:16px 0; padding:14px 16px; border:1px solid var(--line); border-radius:var(--radius-md); background:var(--surface-subtle, #f8fafc); }
.pipeline-v2-panel h3 { margin:0 0 4px; }
.pipeline-v2-actions { display:flex; gap:12px; align-items:center; flex-wrap:wrap; }
.pipeline-funnel { display: grid; grid-template-columns: repeat(6, minmax(135px, 1fr)); gap: 10px; margin-top: 18px; }
.pipeline-stage-card { min-height: 96px; padding: 12px; display: grid; align-content: start; gap: 5px; border: 1px solid var(--line); border-radius: 12px; background: #fbfcfe; }
.pipeline-stage-card strong { color: var(--navy); font-size: .8rem; }
.pipeline-stage-card span, .pipeline-stage-card small { color: var(--muted); font-size: .7rem; line-height: 1.35; }
.pipeline-paid-note { grid-column: 1 / -1; margin: 2px 0 0; color: var(--muted); font-size: .73rem; }
.pipeline-builder { margin: 20px 0; padding: 18px; border: 1px solid var(--line); border-radius: 16px; background: linear-gradient(135deg, #fbfdff, #f7faff); }
.pipeline-builder-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.pipeline-step-label { margin: 18px 0 8px; color: var(--navy); font-size: .78rem; font-weight: 750; }
.pipeline-method-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.pipeline-method-card { min-height: 112px; padding: 14px; display: grid; align-content: start; gap: 7px; text-align: left; border: 1px solid var(--line); border-radius: 12px; background: #fff; color: var(--navy); cursor: pointer; }
.pipeline-method-card strong { font-size: .86rem; }
.pipeline-method-card span, .pipeline-method-card small { color: var(--muted); font-size: .75rem; line-height: 1.4; }
.pipeline-method-card.selected { border-color: var(--blue); box-shadow: 0 0 0 2px rgba(37,99,235,.12); }
.pipeline-method-card.disabled { opacity: .58; cursor: not-allowed; }
.pipeline-builder-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 16px; flex-wrap: wrap; }
.status-chip { display: inline-flex; align-items: center; min-height: 28px; padding: 5px 10px; border-radius: 999px; background: #eef2ff; color: #3730a3; font-size: .75rem; }
.status-chip.neutral { background: #eef2f6; color: var(--muted); }
.status-chip.danger { background: #fdecea; color: var(--danger); }
.icon-button-cell { display: flex; align-items: flex-start; gap: 4px; white-space: nowrap; }
.icon-button { width: 36px; height: 36px; padding: 0; display: grid; place-items: center; border-radius: 8px; position: relative; }
.icon-button svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.icon-button:disabled svg { opacity: .4; }
#aiPromptVersionsTable td:last-child,
#aiPromptVersionsTable th:last-child { width: 1%; white-space: nowrap; vertical-align: top; }
#aiPromptVersionsTable th[data-sort-direction] .fm-sort-icon { opacity: .9; }
#aiPromptVersionsTable th[data-sort-direction="desc"] .fm-sort-icon { transform: rotate(180deg); }
.batch-filter-select {
  min-height: 34px; padding: 5px 10px; border: 1px solid var(--line); border-radius: 8px;
  background: #fff; font-size: .76rem; font-weight: 600; color: var(--text); cursor: pointer;
}
.filter-toolbar-row {
  position: relative; display: flex; align-items: flex-end; gap: 16px; margin-bottom: 14px;
  flex-wrap: wrap; padding-left: 28px;
}
.filter-toolbar-icon {
  position: absolute; left: 0; top: 26px; width: 19px; height: 19px; color: var(--muted);
  fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}
.filter-field { display: flex; flex-direction: column; gap: 4px; }
.filter-field label { color: var(--muted); font-size: .72rem; font-weight: 700; }
.filter-toolbar-row .batch-filter-select { min-width: 170px; }
.filter-toolbar-row #aiSchemaFilterFamily { min-width: 0; width: 150px; text-overflow: ellipsis; }
.filter-toolbar-action { margin-left: auto; }
[data-tooltip] { position: relative; }
[data-tooltip]::after {
  content: attr(data-tooltip); position: absolute; bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%);
  background: var(--navy, #0f1b33); color: #fff; font-size: .68rem; font-weight: 600; white-space: nowrap;
  padding: 4px 8px; border-radius: 6px; opacity: 0; pointer-events: none; transition: opacity .12s ease; z-index: 20;
}
[data-tooltip]:hover::after, [data-tooltip]:focus-visible::after { opacity: 1; }
#promptVersionModal.modal, #schemaVersionModal.modal { width: min(720px, calc(100% - 28px)); }
#promptVersionModal .modal-card, #schemaVersionModal .modal-card { background: var(--surface); border-radius: 24px; max-height: 85vh; display: flex; flex-direction: column; }
#promptVersionModal .modal-body, #schemaVersionModal .modal-body { padding: 0 24px; overflow-y: auto; }
#promptVersionModal .modal-header, #schemaVersionModal .modal-header { padding: 20px 24px; }
#promptVersionModal .modal-actions, #schemaVersionModal .modal-actions { padding: 20px 24px; }
#schemaVersionModal textarea#aiNewSchemaJson { min-height: 220px; font-family: "SFMono-Regular", Consolas, monospace; font-size: .82rem; }
#aiSchemaVersionsTable td:last-child,
#aiSchemaVersionsTable th:last-child { width: 1%; white-space: nowrap; vertical-align: top; }
#aiSchemaVersionsTable th[data-sort-direction] .fm-sort-icon { opacity: .9; }
#aiSchemaVersionsTable th[data-sort-direction="desc"] .fm-sort-icon { transform: rotate(180deg); }
#aiNewPromptLivroEFamilyHelper { white-space: pre-line; display: block; }
.livro-e-family-legend { white-space: pre-line; margin-top: 4px; }
.pipeline-preflight-card { margin-top: 16px; padding: 16px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--light-blue); }
.pipeline-preflight-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 12px; flex-wrap: wrap; }
.toggle-field { display: flex; align-items: center; gap: 8px; min-height: 42px; color: var(--navy); font-size: .82rem; }
.review-workbench-card { overflow: hidden; }
.review-workbench-toolbar { display: flex; align-items: end; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.review-workbench-toolbar .field-group { min-width: min(100%, 390px); flex: 1 1 320px; }
.review-workbench-grid { display: grid; grid-template-columns: minmax(280px, .9fr) minmax(0, 1.35fr); gap: 18px; min-height: 420px; min-width: 0; }
.review-image-pane, .review-result-pane { min-width: 0; padding: 16px; border: 1px solid var(--line); border-radius: 14px; background: #fbfcfe; }
.review-image-frame { min-height: 330px; margin: 10px 0; display: grid; place-items: center; overflow: auto; border: 1px dashed var(--line-strong); border-radius: 10px; background: #f1f5f9; }
.review-image-frame img { display: block; max-width: 100%; max-height: 460px; object-fit: contain; }
.review-tabs { display: flex; gap: 4px; width: 100%; max-width: 100%; min-width: 0; overflow-x: auto; overscroll-behavior-x: contain; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.review-tab { flex: 0 0 auto; padding: 9px 11px; border: 0; border-bottom: 2px solid transparent; background: transparent; color: var(--muted); font-size: .77rem; cursor: pointer; }
.review-tab.active { border-bottom-color: var(--blue); color: var(--navy); font-weight: 750; }
.review-result-content { min-height: 300px; max-height: 480px; min-width: 0; padding: 16px 2px; overflow: auto; white-space: normal; color: var(--text); font-size: .84rem; line-height: 1.55; }
.review-tab-content h3 { margin: 0 0 12px; font-size: .94rem; }
.review-full-text { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.review-data-list { display: grid; grid-template-columns: minmax(130px, .55fr) minmax(0, 1fr); gap: 8px 14px; margin: 0; }
.review-data-list dt { color: var(--muted); font-weight: 700; overflow-wrap: anywhere; }
.review-data-list dd { margin: 0; overflow-wrap: anywhere; }
.pipeline-v2-review-panel { display: grid; gap: 12px; margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); }
.pipeline-v2-review-toolbar, .pipeline-v2-review-actions { display: flex; align-items: end; gap: 10px; flex-wrap: wrap; }
.pipeline-v2-review-toolbar .field-group { flex: 1 1 260px; }
.pipeline-v2-review-editor { display: grid; gap: 10px; }
.pipeline-v2-review-editor textarea { width: 100%; box-sizing: border-box; padding: 10px; border: 1px solid var(--line); border-radius: 9px; background: #fff; color: var(--text); font: inherit; resize: vertical; }
.pipeline-v2-review-packet { max-height: 280px; overflow: auto; padding: 12px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface-subtle, #f8fafc); }
.pipeline-v2-queue { display:grid; gap:8px; max-height:180px; overflow:auto; padding:10px; border:1px solid var(--line); border-radius:var(--radius-md); background:var(--surface-subtle, #f8fafc); }
.pipeline-v2-queue .button { text-align:left; }
.pipeline-v2-preview, .pipeline-v2-history { display:grid; gap:8px; padding:12px; border:1px solid var(--line); border-radius:var(--radius-md, 10px); background:var(--surface-subtle, #f8fafc); }
.pipeline-v2-preview h4, .pipeline-v2-history h4 { margin:0; color:var(--navy); font-size:.9rem; }
.pipeline-v2-preview:focus-visible { outline:2px solid var(--accent, #0071e3); outline-offset:2px; }
.pipeline-v2-preview p, .pipeline-v2-history ul { margin:0; }
.pipeline-v2-preview-list { display:grid; grid-template-columns:minmax(140px, .8fr) minmax(0, 1.2fr); gap:6px 12px; margin:0; }
.pipeline-v2-preview-list dt { font-weight:700; overflow-wrap:anywhere; }
.pipeline-v2-preview-list dd { margin:0; overflow-wrap:anywhere; }
.pipeline-v2-history ul { padding-left:18px; display:grid; gap:5px; }
.pipeline-v2-effects { display:grid; gap:10px; margin:0; padding:12px; border:1px solid var(--line); border-radius:10px; background:var(--surface-subtle, #f8fafc); }
.pipeline-v2-effects legend { padding:0 6px; font-weight:700; }
.pipeline-v2-effect { display:grid; grid-template-columns:minmax(150px,1.2fr) minmax(130px,.8fr) minmax(160px,1fr) auto; gap:8px; align-items:end; padding:10px; border:1px solid var(--line); border-radius:9px; background:#fff; }
.pipeline-v2-effect .field-group { margin:0; }
.pipeline-v2-effect .field-group label { font-size:.72rem; }
.pipeline-v2-effect input, .pipeline-v2-effect select { width:100%; min-height:40px; box-sizing:border-box; }
.pipeline-v2-effect-remove { white-space:nowrap; }
@media (max-width: 720px) { .pipeline-v2-effect { grid-template-columns:1fr; } .pipeline-v2-effect-remove { width:100%; } .pipeline-v2-preview-list { grid-template-columns:1fr; } }
.review-annotation-card { display: grid; gap: 5px; padding: 12px; margin: 8px 0; border: 1px solid #ead28a; border-radius: 10px; background: #fffaf0; }
.review-annotation-card.structured { border-color: #b9dfc7; background: #f1fbf4; }
.review-annotation-card small { color: var(--muted); }
.advance-button.button { display: flex; margin: 20px 0 0 auto; }
.form-grid { display: grid; gap: 16px; }
.three-columns { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.two-columns { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.ai-selection-row + .ai-selection-row { margin-top: 16px; }
.field-group select, .field-group input, .sample-file-select { width: 100%; margin-top: 7px; min-height: 44px; border: 1px solid var(--line); border-radius: 10px; padding: 9px 11px; background: #fff; color: var(--text); font: inherit; }
.sample-accordion-list { display: grid; gap: 12px; margin-top: 18px; }
.sample-accordion { overflow: hidden; border: 1px solid var(--line); border-radius: 14px; background: #fff; }
.sample-accordion[open] { border-color: rgba(0, 113, 227, .3); box-shadow: 0 8px 25px rgba(0, 0, 0, .05); }
.sample-accordion summary { padding: 15px 17px; display: flex; align-items: center; justify-content: space-between; gap: 12px; cursor: pointer; font-weight: 760; }
.sample-accordion summary::marker { color: var(--accent); }
.sample-accordion-body { padding: 0 17px 18px; border-top: 1px solid var(--line); }
.sample-badge { padding: 4px 9px; border-radius: 999px; font-size: .67rem; font-weight: 800; letter-spacing: .03em; text-transform: uppercase; }
.sample-badge.required { color: #8f241c; background: #fff0ee; border: 1px solid #f0b8b2; }
.sample-badge.optional { color: #24623f; background: #edf8f1; border: 1px solid #b9dfc7; }
.sample-saved-badge {
  display: inline-flex; align-items: center; justify-content: center;
  width: 20px; height: 20px; margin-left: 8px; border-radius: 50%;
  background: #1f8a4c; color: #fff; font-size: .7rem; font-weight: 800; line-height: 1;
}
.sample-editor { margin-top: 15px; }
.sample-transcription-status { color: var(--muted); font-size: .76rem; }
.sample-preview { margin-top: 15px; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); box-shadow: var(--shadow); }
.sample-preview-toolbar h2 { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sample-canvas-wrap img { width: 100%; height: 100%; display: block; pointer-events: none; }
.sample-preview-footer { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.sample-preview-footer > span:last-child { justify-self: end; text-align: right; }
.sample-form-grid { display: grid; grid-template-columns: 1fr; gap: 14px; }
.sample-form-grid .field-group { margin-top: 15px; }
.sample-form-grid textarea { width: 100%; min-height: 150px; overflow: hidden; resize: none; border: 2px solid var(--line); border-radius: 10px; padding: 11px; font: inherit; line-height: 1.45; }
.sample-corrected-transcription { border-color: #2f8a59 !important; background: #f7fcf9; }
.sample-corrected-transcription:focus { outline: none; box-shadow: 0 0 0 4px rgba(47,138,89,.12); }
.sample-split-container.split-view .sample-corrected-transcription {
  height: 320px;
  max-height: 60vh;
  overflow-y: auto;
  resize: vertical;
}
.sample-correction-wrap { position: relative; }
.sample-transcription-loading { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 9px; border-radius: 10px; color: var(--accent); background: rgba(247,252,249,.9); font-size: .78rem; font-weight: 750; }
.sample-transcription-loading[hidden] { display: none; }
.loading-spinner { width: 25px; height: 25px; border: 3px solid rgba(0,113,227,.22); border-top-color: var(--accent); border-radius: 50%; animation: spinner-rotation .8s linear infinite; }
.sample-transcribe-button { color: #fff; background: var(--accent); border-color: var(--accent); }
.sample-transcribe-button:hover:not(:disabled) { color: #fff; background: #005dbb; }
.sample-transcribe-button.is-loading .button-spinner { display: inline-block; }
.button-spinner { width: 16px; height: 16px; margin-right: 7px; display: none; vertical-align: -3px; border: 2px solid rgba(255,255,255,.45); border-top-color: #fff; border-radius: 50%; animation: spinner-rotation .8s linear infinite; }
.sample-call-details { margin-top: 7px; display: grid; gap: 3px; color: var(--muted); }
.sample-call-details small { display: block; font-size: .7rem; line-height: 1.45; overflow-wrap: anywhere; }
.sample-preview-tools { display: flex; align-items: center; gap: 8px; }
.sample-expand-button { width: 40px; height: 40px; border: 1px solid var(--line); border-radius: 50%; color: var(--text); background: #f0f0f2; cursor: pointer; font-size: 1.1rem; }
.sample-expand-button:disabled { opacity: .35; cursor: not-allowed; }
.sample-expand-button.is-active { color: #fff; background: var(--accent); border-color: var(--accent); }
.sample-canvas-wrap.zoom-click { cursor: zoom-in; }
.sample-canvas-wrap.zoom-click.is-point-zoomed { cursor: zoom-out; }
.sample-notes-field { grid-column: 1 / -1; }
.sample-save-row { margin-top: 14px; display: flex; justify-content: flex-end; }
.submission-row { display: grid; grid-template-columns: minmax(220px, .72fr) auto auto auto; gap: 12px; align-items: end; }
.sandbox-model-row { grid-template-columns: minmax(0, 1fr) auto; }
.sandbox-model-row { align-items: start; }
.sandbox-model-lock-slot {
  margin-top: 19px; display: grid; grid-template-rows: 19px 44px; gap: 7px;
  align-items: start;
}
.sandbox-model-lock-slot > span { display: block; }
.sandbox-model-lock-slot .icon-lock-button { margin: 0; align-self: start; }
.sample-editor .submission-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: end;
}
.sample-editor .submission-row .field-group { flex: 1 1 220px; min-width: 180px; }
.sample-editor .submission-row .button,
.sample-editor .submission-row .icon-lock-button { flex: 0 0 auto; }
.sample-model-selection-row { display: grid; grid-template-columns: minmax(260px, 1fr) auto; gap: 12px; align-items: end; }
.icon-lock-button { width: 44px; height: 44px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.icon-lock-button svg { width: 22px; fill: none; stroke: currentColor; stroke-width: 1.7; }
.icon-lock-button.unlocked { color: #237449; border-color: #8fc7a7; background: #f0faf4; }
.safe-mode-note { color: #725500; background: #fff8df; border: 1px solid #ead28a; border-radius: 10px; padding: 10px 12px; }
.batch-console { margin-top: 16px; min-height: 92px; padding: 15px; border: 1px solid var(--line); border-radius: 10px; background: #fff; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; }
.batch-console p { color: var(--muted); }
.ai-batch-log-panel { margin-top: 16px; }
.batch-call-details { margin-top: 10px; padding: 0 3px; }
.inner-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 18px; }
.inner-tab { padding: 12px 15px; border: 0; border-bottom: 3px solid transparent; background: transparent; color: var(--muted); }
.inner-tab.active { color: var(--text); border-bottom-color: var(--accent); }
.inner-tab .lock-glyph { width: 13px; height: 13px; vertical-align: -2px; fill: none; stroke: currentColor; stroke-width: 1.8; margin-left: 2px; }
.phase-tabs { flex-wrap: wrap; }
.phase-tab { display: inline-flex; align-items: center; gap: 8px; }
.phase-tab-badge {
  width: 22px; height: 22px; display: grid; place-items: center; flex: 0 0 auto;
  border-radius: 8px; color: #fff; background: var(--navy); font-weight: 800; font-size: .72rem;
}
/* Sub-abas A/B/C/D da Fase 3 (F3-F6): estilo botão/pílula, não sublinhado —
   diferente das abas de topo (.inner-tab usa border-bottom). */
.phase-subtabs { border-bottom: 0; gap: 8px; margin-bottom: 16px; }
.phase-subtab {
  border: 1px solid var(--line); border-bottom: 1px solid var(--line);
  border-radius: 10px; background: #fff; padding: 10px 14px;
}
.phase-subtab.active { background: var(--navy); color: #fff; border-color: var(--navy); }
.phase-subtab.active .phase-tab-badge { background: #fff; color: var(--navy); }
/* Badge de notificação estilo app (bolinha com contagem por fase, dentro da
   própria aba/sub-aba) — vermelho = ainda não executada/pendente, verde =
   já com sucesso registrado para o lote selecionado. */
.phase-tab-notif {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px;
  font-size: .65rem; font-weight: 800; color: #fff; line-height: 1; flex: 0 0 auto;
}
.phase-tab-notif.is-red { background: #b3261e; }
.phase-tab-notif.is-green { background: #1e8e3e; }
/* Aba/sub-aba com contagem zerada (ou depois da primeira zerada, em
   cascata): visível, porém não clicável. */
.phase-tab[disabled], .phase-subtab[disabled] {
  opacity: .45; cursor: not-allowed;
}
.responsive-table { overflow-x: auto; margin-top: 16px; }
.responsive-table table { width: 100%; border-collapse: collapse; }
.responsive-table th, .responsive-table td { padding: 12px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
.responsive-table td[colspan] { color: var(--muted); text-align: center; padding: 34px; }
.compact-datatable { border: 1px solid var(--line); border-radius: 10px; }
.compact-datatable table { min-width: 1380px; font-size: .71rem; }
.compact-datatable th { padding: 8px 9px; color: var(--muted); background: #f7f7f8; font-size: .67rem; text-transform: uppercase; letter-spacing: .025em; }
.compact-datatable td { max-width: 205px; padding: 7px 9px; vertical-align: top; white-space: normal; line-height: 1.35; }
.compact-datatable td span { display: block; }
.compact-datatable td .table-primary { color: var(--text); font-weight: 700; }
.compact-datatable td .table-secondary { margin-top: 2px; color: var(--muted); font-size: .66rem; }
.compact-datatable td .table-secondary.is-error { color: #b3261e; font-weight: 700; }
.compact-datatable td .table-link {
  background: none; border: none; padding: 0; margin: 0; cursor: pointer;
  color: var(--accent); text-decoration: underline; text-underline-offset: 2px;
  font: inherit; font-weight: 700; text-align: left;
}
.compact-datatable td .table-link:hover { color: var(--navy); }
.compact-datatable .button { min-height: 30px; padding: 5px 9px; font-size: .68rem; }
.compact-datatable td.table-actions { vertical-align: middle; }
.compact-datatable tfoot .table-totals-row td { border-top: 2px solid var(--line); border-bottom: none; background: #f7f7f8; font-weight: 700; color: var(--text); vertical-align: middle; }
.table-actions-inner { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.icon-detail-button {
  width: 30px; height: 30px; flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--muted); cursor: pointer;
}
.icon-detail-button:hover { color: var(--accent); border-color: var(--accent); }
.icon-detail-button svg { width: 16px; fill: none; stroke: currentColor; stroke-width: 1.9; }
#batchDetailFilesBody td.is-error { color: #b3261e; font-weight: 600; }
/* Card 2 "Resumo do lote" (tela nova "Visualização de resultados", Onda 4 Agente 2). */
.resultados-nova-summary-table-wrap table,
.resultados-nova-detail-table-wrap table { min-width: 0; width: 100%; table-layout: auto; }
.resultados-nova-phase-check-cell { width: 34px; text-align: center; }
.resultados-nova-phase-complete-icon {
  display: inline-flex; width: 20px; height: 20px; border-radius: 50%;
  background: var(--success); color: #fff; align-items: center; justify-content: center; flex: 0 0 auto;
  line-height: 0;
}
.resultados-nova-phase-complete-icon svg {
  display: block; width: 12px; height: 12px; margin: 0 auto; fill: none; stroke: currentColor;
  stroke-width: 3; stroke-linecap: round; stroke-linejoin: round;
}
.resultados-nova-summary-table-wrap { margin-top: 22px; }
#resultadosNovaSummaryCard { margin-top: 22px; }
.resultados-nova-phase-detail { margin-top: 18px; }
#cutBatchesPanel .compact-datatable table { min-width: 0; width: 100%; table-layout: auto; }
.batch-stage-cell { width: 1%; max-width: 110px; }
.batch-stage-progress-track { width: 90px; height: 6px; margin-bottom: 4px; overflow: hidden; border-radius: 99px; background: #dfdfe4; }
.batch-stage-progress-bar { width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--accent), #55a9fb); transition: width .25s ease; }
.batch-stage-progress-percent { display: block; margin-bottom: 4px; color: var(--muted); font-size: .66rem; font-weight: 700; }
.batch-stage-icon {
  display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px;
  margin-bottom: 4px;
}
.batch-stage-icon.is-success { color: var(--success); }
.batch-stage-icon.is-error { color: var(--danger); }
.batch-stage-icon svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.batch-stage-times { margin-top: 0; }
.batch-stage-retry-button {
  display: inline-flex; margin-top: 2px; padding: 4px 10px; border: 1px solid var(--line);
  border-radius: 999px; background: #fff; color: var(--text); font-size: .68rem; font-weight: 700; cursor: pointer;
}
.batch-stage-retry-button:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.batch-stage-retry-button:disabled { opacity: .5; cursor: not-allowed; }
.batch-stage-note { display: block; margin-top: 2px; color: var(--muted); font-size: .66rem; font-weight: 400; }
.batch-filter-row { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.batch-filter-label {
  display: flex; align-items: center; gap: 6px; margin-left: 10px; color: var(--muted); font-size: .74rem; font-weight: 700;
}
.batch-filter-label:first-child { margin-left: 0; }
.batch-filter-label svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
#cutBatchTypeFilter, #cutBatchStatusFilter {
  min-height: 34px; padding: 5px 10px; border: 1px solid var(--line); border-radius: 8px;
  background: #fff; font-size: .76rem; font-weight: 600; color: var(--text); cursor: pointer;
}
.batch-filter-refresh-button {
  display: inline-flex; align-items: center; justify-content: center; margin-left: auto;
  width: 34px; height: 34px; flex: none; border: 1px solid var(--line); border-radius: 8px;
  background: #fff; color: var(--text); cursor: pointer;
}
.batch-filter-refresh-button:hover { border-color: var(--accent); color: var(--accent); }
.batch-filter-refresh-button svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat-card { display: grid; gap: 8px; padding: 20px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); }
.stat-card span, .stat-card small, .empty-state-card > p { color: var(--muted); }
.stat-card strong { font-size: 1.8rem; letter-spacing: -.04em; }
.financial-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-top: 14px; }
.financial-by-type-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 14px; margin-top: 14px; }
.financial-card { display: grid; gap: 6px; padding: 16px 18px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); }
.financial-card span { color: var(--muted); font-size: .82rem; }
.financial-card small { color: var(--muted); }
.financial-card strong { font-size: 1.4rem; letter-spacing: -.03em; }
.financial-card-highlight { background: var(--accent-soft, #eef4ff); border-color: var(--accent, #2f6fed); }
.financial-value-primary { font-size: 2rem; color: var(--accent, #2f6fed); }
.financial-type-card { padding: 18px 20px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); display: grid; gap: 10px; }
.financial-type-card h3 { margin: 0; font-size: 1rem; }
.financial-type-card .financial-type-metrics { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.financial-type-card .financial-type-metric span { display: block; color: var(--muted); font-size: .76rem; }
.financial-type-card .financial-type-metric strong { display: block; font-size: 1.05rem; }
.financial-type-card .financial-type-metric strong.is-brl { color: var(--accent, #2f6fed); }
.empty-state-note { color: var(--muted); }
.filter-actions { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; margin-top: 18px; }
.sandbox-actions { justify-content: flex-end; margin-bottom: 26px; }
#sandboxViewport { grid-column: 2; }
.result-card { margin-top: 18px; }
.result-split-container.split-view { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.sample-split-container.split-view { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.result-text-panel { border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); padding: 18px; }
.result-text-panel textarea {
  width: 100%; min-height: 420px; border: 0; resize: vertical; font-family: inherit;
  font-size: .88rem; line-height: 1.55; background: transparent; color: var(--text);
}
.result-text-panel textarea:focus { outline: none; }
@media (max-width: 900px) {
  .result-split-container.split-view { grid-template-columns: 1fr; }
}
.result-preview { margin-top: 0; }
.metadata-grid { display: grid; grid-template-columns: max-content 1fr; gap: 7px 14px; padding: 14px; border: 1px solid var(--line); border-radius: 12px; }
.metadata-grid dt { color: var(--muted); }
.metadata-grid dd { margin: 0; overflow-wrap: anywhere; }
.result-text-tabs { margin-bottom: 12px; }
.result-summary-fields dt.summary-highlight,
.result-summary-fields dd.summary-highlight {
  background: #e6f6ea; font-weight: 700; padding: 4px 6px; margin: -4px -6px; border-radius: 6px;
}
.result-summary-fields { max-height: none; font-size: .84rem; }
.compact-data-card { font-size: .85rem; }
.compact-data-card .config-section-heading h3 { font-size: .92rem; }
.compact-data-card .metadata-grid { font-size: .82rem; padding: 11px; gap: 5px 12px; }
.compact-data-card .recursive-json { font-size: .78rem; }
.compact-data-card .recursive-json th, .compact-data-card .recursive-json td { padding: 7px 8px; }
.button.small { padding: 5px 10px; min-height: 30px; font-size: .72rem; margin-top: 12px; }
.recursive-json { margin-top: 18px; }
.recursive-json section { margin: 8px 0; }
.recursive-json h3 { margin: 12px 0 7px; font-size: 1rem; }
.recursive-json table { width: 100%; border-collapse: collapse; }
.recursive-json th, .recursive-json td { padding: 10px; border: 1px solid var(--line); text-align: left; vertical-align: top; overflow-wrap: anywhere; }
.recursive-json th { width: 28%; background: #f7f7f8; }
.recursive-json .full-text-value { white-space: pre-wrap; line-height: 1.55; }

.workspace-grid { display: grid; grid-template-columns: minmax(285px, .68fr) minmax(0, 1.55fr); gap: 22px; align-items: stretch; }
.settings-card, .preview-card, .execution-card {
  border: 1px solid var(--line); border-radius: var(--radius-lg);
  background: var(--surface); box-shadow: var(--shadow); backdrop-filter: blur(18px);
}
.settings-card { padding: 24px; }
.section-heading { display: flex; align-items: center; gap: 12px; }
.section-heading h2, .preview-card h2, .execution-card h2 { margin: 3px 0 0; font-size: 1.18rem; letter-spacing: -.02em; }
.step-number {
  width: 36px; height: 36px; display: grid; place-items: center; flex: 0 0 auto;
  border-radius: 12px; color: #fff; background: var(--navy); font-weight: 800;
}
.field-group { margin-top: 22px; }
.field-group > label, fieldset > legend { color: #3a3a3c; font-size: .82rem; font-weight: 750; }
.field-note { margin: 7px 2px 0; color: var(--muted); font-size: .76rem; line-height: 1.4; overflow-wrap: anywhere; }
.field-group.validation-error .file-drop-zone,
.field-group.validation-error .input-action input {
  border-color: rgba(180,35,24,.72);
  box-shadow: 0 0 0 1px rgba(180,35,24,.08);
}
.field-group.validation-error > label { color: var(--danger); }
/* `email`, `password` e `tel` entram nos mesmos dois seletores em que o
   `text` já estava, e não numa regra nova: a caixa é a mesma, e descrevê-la
   duas vezes seria duas verdades sobre o mesmo desenho. Eles faltavam porque
   até o M7.1 nenhuma tela tinha formulário de conta — nenhuma tela do console
   tem input desses três tipos, então nada do que já existia muda de aparência. */
/* `input:not([type])` junto com os outros: um `<input>` sem `type` É um campo
   de texto para o navegador, mas não casa com `input[type="text"]` — e cai
   para o desenho padrão do sistema, com borda de 2px em relevo e canto reto no
   meio de campos de raio 8. Aconteceu com o e-mail de Meus dados, e a próxima
   vez seria igual: o defeito não avisa, ele só fica feio. */
input:not([type]),
input[type="text"], input[type="number"],
input[type="email"], input[type="password"], input[type="tel"] {
  width: 100%; padding: 11px 13px; border: 1px solid var(--line-strong);
  border-radius: 12px; color: var(--text); background: rgba(255, 255, 255, .94);
  transition: border-color .18s, box-shadow .18s, background .18s;
}
input:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 4px rgba(0, 113, 227, .12); }
.input-action { position: relative; margin-top: 7px; display: flex; align-items: center; }
.input-action input { min-height: 44px; padding-right: 94px; }
.mini-button {
  position: absolute; z-index: 1; right: 5px; top: 50%; min-height: 34px; padding: 5px 10px;
  transform: translateY(-50%);
  border: 0; border-radius: 9px; color: var(--accent); background: var(--light-blue);
  cursor: pointer; font-size: .75rem; font-weight: 750;
}
.button {
  min-height: 42px; padding: 9px 17px; display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  border: 1px solid transparent; border-radius: 999px; cursor: pointer; white-space: nowrap; flex-shrink: 0;
  font-weight: 700; transition: background .18s, color .18s, border-color .18s, transform .18s, opacity .18s;
}
.button:hover:not(:disabled) { transform: translateY(-1px); }
.button:disabled { opacity: .48; cursor: not-allowed; }
.button.primary { color: #fff; background: var(--accent); }
.button.primary:hover:not(:disabled) { background: var(--accent-hover); }
.button.ghost { color: var(--text); border-color: var(--line); background: rgba(255, 255, 255, .9); }
.button.ghost:hover:not(:disabled) { border-color: var(--line-strong); background: #fff; }
.button.danger { color: #fff; background: var(--danger); }
.full-width { width: 100%; margin-top: 7px; }
.file-drop-zone {
  min-height: 176px; margin-top: 7px; padding: 20px;
  display: grid; place-items: center; border: 1.5px dashed rgba(0,113,227,.38);
  border-radius: 17px; color: var(--muted); background: rgba(255,255,255,.62);
  cursor: pointer; transition: border-color .2s, background .2s, transform .2s, box-shadow .2s;
}
.file-drop-zone:hover, .file-drop-zone:focus-visible, .file-drop-zone.dragover {
  border-color: var(--accent); background: var(--light-blue);
  box-shadow: 0 0 0 4px rgba(0,113,227,.08);
}
.file-drop-zone.dragover { transform: scale(1.008); }
.file-drop-zone.uploading { pointer-events: none; border-color: var(--accent); background: var(--light-blue); }
.drop-zone-normal, .drop-zone-feedback {
  width: 100%; display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 8px; text-align: center;
}
.drop-zone-normal strong, .drop-zone-feedback strong { color: var(--text); font-size: .92rem; }
.drop-zone-normal > span { font-size: .72rem; }
.drop-zone-icon {
  width: 36px; height: 36px; margin-bottom: 2px; fill: none; stroke: var(--accent);
  stroke-width: 1.35; stroke-linecap: round; stroke-linejoin: round;
}
.drop-zone-spinner {
  width: 30px; height: 30px; border: 3px solid rgba(0,113,227,.18);
  border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite;
}
.upload-progress-track {
  width: min(260px, 92%); height: 7px; overflow: hidden;
  border-radius: 99px; background: rgba(0,0,0,.1);
}
.upload-progress-track > span {
  width: 0; height: 100%; display: block; border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), #55a9fb); transition: width .15s linear;
}
.upload-progress-track.indeterminate > span {
  width: 38%; animation: upload-indeterminate 1.15s ease-in-out infinite;
}
.drop-zone-feedback small { color: var(--muted); font-size: .7rem; font-weight: 700; }
.sandbox-file-feedback {
  position: relative; width: 100%; display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 8px; text-align: center;
}
.sandbox-file-success-icon { width: 52px; height: 52px; display: block; color: #18864b; }
.sandbox-file-success-icon svg { display: block; width: 100%; height: 100%; }
.sandbox-file-feedback strong { color: #176b3d; font-size: .95rem; }
.sandbox-file-loaded-name {
  max-width: 100%; color: var(--text); font-size: .82rem; font-weight: 700;
  overflow-wrap: anywhere;
}
.sandbox-file-loaded-size { color: var(--muted); font-size: .72rem; font-weight: 700; }
.sandbox-remove-file-button {
  position: absolute; top: 0; right: 0; width: 32px; height: 32px; padding: 6px;
  display: grid; place-items: center; border: 1px solid rgba(180, 35, 24, .25);
  border-radius: 50%; color: var(--danger); background: #fff; cursor: pointer;
}
.sandbox-remove-file-button:hover { color: #fff; background: var(--danger); border-color: var(--danger); }
.sandbox-remove-file-button svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.ai-runtime-settings-card { padding: 0; overflow: hidden; }
.settings-access-control { display: flex; align-items: center; gap: 10px; max-width: 280px; }
.settings-access-status { color: var(--muted); font-size: .73rem; line-height: 1.35; }
.page-heading .page-heading-settings-access { justify-self: end; }
.page-heading .page-heading-model-access { justify-self: end; max-width: 360px; }
.page-heading .page-heading-pipeline-access { justify-self: end; max-width: 360px; }
.settings-inner-tabs { margin: 0 26px; border-bottom: 1px solid var(--line); }
.settings-inner-tabs .inner-tab { padding: 13px 4px; margin-right: 22px; }
.ai-settings-subpanel { min-width: 0; }
.ai-runtime-settings-card form { background: var(--surface-soft); }
.ai-runtime-settings-card fieldset { margin: 0; padding: 22px 26px 28px; border: 0; min-width: 0; }
.ai-runtime-settings-card .config-section { margin-bottom: 18px; }
.settings-inline-field { display: flex; align-items: stretch; gap: 8px; }
.settings-inline-field input { min-width: 0; flex: 1; }
.icon-refresh-button {
  width: 44px; min-width: 44px; display: grid; place-items: center; padding: 0;
  border: 1px solid var(--line); border-radius: 9px; color: var(--ink); background: #fff; cursor: pointer;
}
.icon-refresh-button:hover:not(:disabled) { color: var(--accent); border-color: var(--accent); background: #f7faff; }
.icon-refresh-button:disabled { cursor: not-allowed; opacity: .55; }
.icon-refresh-button svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.icon-refresh-button.is-loading svg { animation: spin .8s linear infinite; }
.ai-model-catalog-scrollbar-track { position: relative; height: 12px; margin: 16px 0 6px; background: #e6e9ef; border-radius: 8px; cursor: pointer; }
.ai-model-catalog-scrollbar-track[hidden] { display: none; }
.ai-model-catalog-scrollbar-thumb { position: absolute; top: 0; left: 0; height: 100%; min-width: 40px; background: var(--muted); border-radius: 8px; cursor: grab; touch-action: none; }
.ai-model-catalog-scrollbar-thumb:hover, .ai-model-catalog-scrollbar-thumb.is-dragging { background: var(--text); }
.ai-model-catalog-table-wrap {
  margin-top: 10px;
  max-width: 100%;
  overflow-x: scroll;
  scrollbar-width: auto;
  scrollbar-color: var(--muted) #e6e9ef;
  border: 1px solid var(--line);
  border-radius: 10px;
}
.ai-model-catalog-table-wrap::-webkit-scrollbar { height: 14px; }
.ai-model-catalog-table-wrap::-webkit-scrollbar-track { background: #e6e9ef; border-radius: 8px; }
.ai-model-catalog-table-wrap::-webkit-scrollbar-thumb { background: var(--muted); border-radius: 8px; border: 3px solid #e6e9ef; }
.ai-model-catalog-table-wrap::-webkit-scrollbar-thumb:hover { background: var(--text); }
.ai-model-catalog-table-wrap table { min-width: 1900px; border: none; }
.ai-model-catalog-table-wrap th, .ai-model-catalog-table-wrap td { padding: 8px 6px; font-size: .7rem; white-space: nowrap; vertical-align: top; }
.ai-model-catalog-table-wrap td:last-child { vertical-align: middle; }
.ai-model-catalog-table-wrap th .table-header-unit { display: block; margin-top: 3px; color: var(--muted); font-size: .62rem; font-weight: 500; line-height: 1.2; white-space: nowrap; }
.ai-model-catalog-table-wrap input, .ai-model-catalog-table-wrap select { width: 100%; min-width: 86px; padding: 7px 6px; font-size: .72rem; }
.ai-model-catalog-table-wrap select {
  border: 1px solid var(--line-strong); border-radius: 12px; color: var(--text);
  background: rgba(255, 255, 255, .94); cursor: pointer;
  transition: border-color .18s, box-shadow .18s, background .18s;
}
.ai-model-catalog-table-wrap select:focus {
  border-color: var(--accent); outline: none; box-shadow: 0 0 0 4px rgba(0, 113, 227, .12);
}
.ai-model-catalog-table-wrap td:first-child input { min-width: 170px; }
.ai-model-catalog-table-wrap td:nth-child(2) input { min-width: 140px; }
.ai-model-catalog-table-wrap td:nth-child(3) { text-align: center; }
.ai-model-catalog-table-wrap td:nth-child(3) input[type="checkbox"] { width: 18px; height: 18px; margin: 0 auto; }
.ai-model-catalog-table-wrap td:nth-child(5) select { min-width: 124px; }
.ai-model-catalog-row.is-dragging { opacity: .48; }
.ai-model-catalog-row.is-drag-over td { position: relative; background: rgba(0, 113, 227, .06); }
.ai-model-catalog-row.is-drag-over td::before, .ai-model-catalog-row.is-drag-over td::after { content: ""; position: absolute; left: 0; right: 0; height: 2px; background: var(--accent); pointer-events: none; }
.ai-model-catalog-row.is-drag-over td::before { top: 0; }
.ai-model-catalog-row.is-drag-over td::after { bottom: 0; }
.ai-model-order-cell { display: flex; align-items: flex-start; gap: 6px; min-width: 192px; }
.ai-model-order-cell .ai-model-drag-handle { margin-top: 7px; }
.ai-model-order-cell input { flex: 1 1 auto; min-width: 170px; }
.ai-model-drag-handle { flex: 0 0 auto; color: var(--muted); font-size: 1.15rem; line-height: 1; cursor: grab; user-select: none; }
.ai-model-catalog-table-wrap input[type="date"] {
  min-width: 132px; border: 1px solid var(--line-strong); border-radius: 12px;
  background: rgba(255, 255, 255, .94); color: var(--text);
  transition: border-color .18s, box-shadow .18s, background .18s;
}
.ai-model-catalog-table-wrap input[type="date"]:focus {
  border-color: var(--accent); outline: none; box-shadow: 0 0 0 4px rgba(0, 113, 227, .12);
}
.ai-model-updated-at-input { background: #f0f2f5; color: var(--muted); cursor: default; min-width: 130px; }
.ai-model-capabilities-cell { display: flex; flex-direction: column; gap: 3px; white-space: nowrap; min-width: 140px; }
.ai-model-capability-toggle { display: flex; align-items: center; gap: 5px; font-size: .68rem; color: var(--muted); cursor: pointer; }
.ai-model-capability-toggle input[type="checkbox"] { width: 13px; height: 13px; margin: 0; }
.ai-model-catalog-table-wrap .ai-model-action-cell { display: flex; flex-direction: column; gap: 5px; align-items: stretch; justify-content: flex-start; min-width: 84px; }
.ai-model-save-button, .ai-model-remove-button { width: 100%; white-space: nowrap; text-align: center; }
.ai-runtime-settings-card #aiAddModelButton { margin-top: 14px; }
.ai-phase-defaults-table-wrap {
  margin-top: 10px; max-width: 100%; overflow-x: auto;
  border: 1px solid var(--line); border-radius: 10px;
}
.ai-phase-defaults-table-wrap table { min-width: 1360px; border: none; }
.ai-phase-defaults-table-wrap th {
  padding: 8px 6px; font-size: .67rem; color: var(--muted); background: #f7f7f8;
  text-transform: uppercase; letter-spacing: .025em; white-space: nowrap; vertical-align: top;
}
.ai-phase-defaults-table-wrap td { padding: 8px 6px; font-size: .7rem; white-space: nowrap; vertical-align: top; }
.ai-phase-defaults-table-wrap input, .ai-phase-defaults-table-wrap select {
  width: 100%; min-width: 86px; padding: 7px 6px; font-size: .72rem;
  border: 1px solid var(--line-strong); border-radius: 12px; color: var(--text);
  background: rgba(255, 255, 255, .94); transition: border-color .18s, box-shadow .18s, background .18s;
}
.ai-phase-defaults-table-wrap input:focus, .ai-phase-defaults-table-wrap select:focus {
  border-color: var(--accent); outline: none; box-shadow: 0 0 0 4px rgba(0, 113, 227, .12);
}
.ai-phase-defaults-table-wrap td:nth-child(3) select { min-width: 170px; }
.ai-phase-defaults-table-wrap td:nth-child(4) select { min-width: 124px; }
.ai-phase-defaults-table-wrap td:nth-child(10) select,
.ai-phase-defaults-table-wrap td:nth-child(11) select { min-width: 180px; }
.ai-phase-defaults-table-wrap td:nth-child(12) { vertical-align: middle; }
.ai-phase-defaults-table-wrap td:last-child { vertical-align: middle; width: 1%; }
.ai-phase-defaults-table-wrap .button { min-height: 32px; padding: 6px 12px; font-size: .7rem; white-space: nowrap; }
.ai-authorized-users-table-wrap { margin-top: 10px; max-width: 100%; }
.ai-authorized-users-table-wrap table { min-width: 760px; }
.ai-authorized-users-table-wrap th, .ai-authorized-users-table-wrap td { padding: 9px 8px; font-size: .75rem; vertical-align: middle; }
.ai-authorized-users-table-wrap th:not(:first-child), .ai-authorized-users-table-wrap td:not(:first-child) { text-align: center; }
.ai-authorized-users-table-wrap .ai-user-email-input {
  width: min(100%, 290px); min-width: 210px; min-height: 44px; margin: 0;
  padding: 11px 13px; border: 1px solid var(--line-strong); border-radius: 12px;
  color: var(--text); background: rgba(255, 255, 255, .94);
  transition: border-color .18s, box-shadow .18s, background .18s;
}
.ai-authorized-users-table-wrap .ai-user-email-input:focus {
  border-color: var(--accent); outline: none; box-shadow: 0 0 0 4px rgba(0, 113, 227, .12);
}
.ai-authorized-users-table-wrap .ai-user-tipo-select {
  width: min(100%, 160px); min-width: 130px; min-height: 44px; margin: 0;
  padding: 11px 13px; border: 1px solid var(--line-strong); border-radius: 12px;
  color: var(--text); background: rgba(255, 255, 255, .94); font: inherit;
  transition: border-color .18s, box-shadow .18s, background .18s;
}
.ai-authorized-users-table-wrap .ai-user-tipo-select:focus {
  border-color: var(--accent); outline: none; box-shadow: 0 0 0 4px rgba(0, 113, 227, .12);
}
.ai-user-permission { display: inline-grid; place-items: center; min-width: 42px; min-height: 32px; }
.ai-user-permission input { width: 18px; height: 18px; accent-color: var(--accent); }
.ai-user-remove-button { min-width: 36px; padding: 5px 10px; font-size: 1.05rem; line-height: 1; display: inline-grid; place-items: center; }
.ai-user-remove-button svg { width: 16px; height: 16px; fill: none; stroke: var(--danger); stroke-width: 2.2; stroke-linecap: round; }
.ai-user-remove-button:disabled svg { stroke: var(--muted); }
.ai-runtime-settings-card #aiAddUserButton { margin-top: 14px; }
.ai-smtp-tls-toggle { align-self: end; min-height: 58px; }
.cloud-storage-security-note { margin-top: 18px; }
.config-accordion { overflow: hidden; margin-top: 22px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.config-accordion summary { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 14px 18px; cursor: pointer; list-style: none; }
.config-accordion summary::-webkit-details-marker { display: none; }
.config-accordion summary h3 { margin: 0; font-size: 1rem; }
.config-accordion summary::after { content: "+"; color: var(--muted); font-size: 1.2rem; line-height: 1; }
.config-accordion[open] summary::after { content: "−"; }
.config-accordion > .config-accordion-body { padding: 0 18px 18px; border-top: 1px solid var(--line); margin: 0; }
.config-accordion > .config-accordion-body .config-section-heading { margin-top: 16px; }
.schemas-accordion { display: grid; gap: 8px; margin-top: 14px; }
.schema-accordion { overflow: hidden; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.schema-accordion summary { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 13px 15px; cursor: pointer; list-style: none; }
.schema-accordion summary::-webkit-details-marker { display: none; }
.schema-accordion summary::after { content: "+"; color: var(--muted); font-size: 1.1rem; line-height: 1; }
.schema-accordion[open] summary::after { content: "−"; }
.schema-accordion-title { min-width: 0; font-weight: 700; overflow-wrap: anywhere; }
.schema-accordion-meta { flex: 0 0 auto; color: var(--muted); font-size: .72rem; }
.schema-accordion-body { padding: 0 15px 15px; border-top: 1px solid var(--line); }
.schema-accordion-type { display: block; margin: 10px 0 0; }
.schema-preview-text { width: 100%; min-height: 180px; max-height: 440px; margin-top: 10px; padding: 11px 12px; resize: vertical; overflow: auto; border: 1px solid var(--line); border-radius: 10px; background: #f8fafc; color: var(--text); font: .76rem/1.45 "SFMono-Regular", Consolas, monospace; }
.schema-accordion-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; margin-top: 10px; }
.schema-empty-state { padding: 4px 2px; }
.custom-schema-editor { margin-top: 18px; padding: 18px; border: 1px solid var(--line); border-radius: 14px; background: #fff; }
.custom-schema-editor h4 { margin: 0; font-size: .95rem; }
.custom-schema-editor textarea { width: 100%; min-height: 280px; max-height: 560px; margin-top: 7px; padding: 11px 13px; resize: vertical; overflow: auto; border: 1px solid var(--line-strong); border-radius: 12px; background: rgba(255,255,255,.94); color: var(--text); font: .8rem/1.5 "SFMono-Regular", Consolas, monospace; transition: border-color .18s, box-shadow .18s; }
.custom-schema-editor textarea:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 4px rgba(0, 113, 227, .12); }
.custom-schema-actions { justify-content: flex-end; margin-top: 14px; }
.settings-page-actions { display: flex; justify-content: flex-end; gap: 10px; padding: 16px 26px; border-top: 1px solid var(--line); background: #fff; }

@media (max-width: 700px) {
  .settings-access-control { max-width: none; }
  .page-heading .page-heading-settings-access { justify-self: start; }
  .page-heading .page-heading-model-access { justify-self: start; max-width: none; }
  .page-heading .page-heading-pipeline-access { justify-self: start; max-width: none; }
  .settings-inner-tabs { margin: 0 14px; }
  .ai-runtime-settings-card fieldset { padding: 18px 14px 22px; }
  .settings-page-actions { padding: 14px; }
}
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes upload-indeterminate {
  from { transform: translateX(-110%); }
  to { transform: translateX(290%); }
}

fieldset { margin: 22px 0 0; padding: 0; border: 0; }
fieldset > legend { margin-bottom: 8px; }
.toggle-row, .choice-card {
  min-height: 58px; display: flex; align-items: center; gap: 12px;
  border-top: 1px solid var(--line); cursor: pointer;
}
.toggle-row > span:last-child, .toggle-label > span:last-child, .choice-card > span:last-child { display: grid; gap: 3px; flex: 1; }
.toggle-row strong, .toggle-label strong, .choice-card strong { font-size: .83rem; }
.toggle-row small, .toggle-label small, .choice-card small { color: var(--muted); font-size: .72rem; font-weight: 450; }
.toggle-row input[type="checkbox"], .toggle-label input[type="checkbox"] { position: absolute; opacity: 0; pointer-events: none; }
.toggle {
  position: relative; width: 41px; height: 24px; flex: 0 0 auto;
  border-radius: 99px; background: #d2d2d7; transition: background .2s;
}
.toggle::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 20px; height: 20px;
  border-radius: 50%; background: #fff; box-shadow: 0 1px 4px rgba(0,0,0,.22); transition: transform .2s;
}
input[type="checkbox"]:checked + .toggle { background: var(--accent); }
input[type="checkbox"]:checked + .toggle::after { transform: translateX(17px); }
.contrast-row { justify-content: space-between; }
.toggle-label { display: flex; align-items: center; gap: 12px; flex: 1; cursor: pointer; }
.number-wrap {
  width: 69px; position: relative; flex: 0 0 auto;
}
.number-wrap input { padding: 8px 24px 8px 9px; text-align: right; }
.number-wrap > span { position: absolute; right: 9px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: .75rem; pointer-events: none; }
.choice-card { min-height: 72px; padding: 7px 0; }
.choice-card input { position: absolute; opacity: 0; }
.radio-mark {
  width: 19px; height: 19px; border: 1.5px solid #aaaab0; border-radius: 50%;
  box-shadow: inset 0 0 0 4px #fff; background: #fff;
}
.choice-card input:checked + .radio-mark { border-color: var(--accent); background: var(--accent); }
.choice-main { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.choice-title { display: inline-flex; align-items: center; gap: 4px; flex: none; }
.type-badge {
  display: inline-flex; align-items: center; min-height: 20px; padding: 3px 7px;
  border-radius: 999px; font-size: .61rem; font-weight: 800; line-height: 1;
}
.type-badge.birth { color: #175f9d; background: #e5f1fc; }
.type-badge.death { color: #4d4d52; background: #ececef; }
.type-badge.marriage { color: #64479b; background: #eee8fa; }

.preview-card { min-width: 0; overflow: hidden; display: flex; flex-direction: column; }
.numbering-controls { padding: 22px; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 18px; }
.numbering-controls fieldset { border: 0; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 10px; }
.numbering-controls legend { color: #3a3a3c; font-size: .82rem; font-weight: 750; padding: 0 0 4px; }
.book-prefix-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.choice-card.compact { min-height: 0; padding: 8px 0; }
.choice-card.compact > span:last-child { gap: 1px; }
.numbering-main-grid { display: flex; flex-wrap: wrap; align-items: start; gap: 28px; }
.numbering-main-col { display: flex; flex-direction: column; gap: 4px; }
.numbering-main-col-left { align-items: flex-start; }
.numbering-main-col-center { align-items: center; }
.numbering-main-col-center .field-inline { align-items: center; }
.numbering-main-col-center .field-inline input { text-align: center; }
.numbering-book-fields { display: flex; gap: 8px; align-items: end; }
.term-initial-controls { display: flex; align-items: end; gap: 8px; flex-wrap: wrap; }
.term-range-mismatch-row {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px; width: 100%; margin-top: 6px;
}
.term-range-mismatch-row .termo-range-mismatch { min-width: 0; }
.term-initial-controls .termo-range-update { margin: 0; white-space: nowrap; }
.field-hint { color: var(--muted); font-size: .68rem; font-weight: 600; }
.starting-side-field { gap: 6px; }
.starting-side-field legend { font-size: .7rem; padding: 0; line-height: 1.3; max-width: 90px; }
.starting-side-options { display: flex; flex-direction: column; gap: 3px; font-size: .74rem; font-weight: 600; color: #3a3a3c; }
.starting-side-options label { display: flex; align-items: center; gap: 5px; cursor: pointer; }
.starting-side-options input { width: 13px; height: 13px; margin: 0; }
.field-inline { display: flex; flex-direction: column; gap: 4px; font-size: .78rem; font-weight: 600; color: #3a3a3c; }
.field-inline input, .field-inline select { min-height: 40px; border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; text-align: left; width: 96px; background: #fff; }
#customPrefixInput { width: 64px; text-align: center; text-transform: lowercase; }
#bookNumberInput { width: 120px; background: #fff; }
.range-row { display: flex; gap: 12px; }
.letters-row { display: flex; flex-wrap: wrap; gap: 10px; }
.letters-row .field-inline input { width: 68px; text-align: center; }
.number-badge {
  position: absolute; transform: translate(-50%, -50%); display: flex; flex-direction: column;
  align-items: center; gap: 1px; z-index: 5; pointer-events: none;
}
.badge-part {
  pointer-events: auto; cursor: text; color: var(--accent); background: rgba(255,255,255,.88);
  font-size: .72rem; font-weight: 700; padding: 1px 5px; border-radius: 4px; white-space: nowrap;
}
.badge-part.edited { color: var(--danger); }
.badge-skip { color: var(--muted); font-weight: 600; cursor: default; }
.badge-nome-confirmed { display: inline-flex; align-items: center; gap: 3px; color: var(--success); }
.badge-nome-check { width: 11px; height: 11px; flex: none; fill: none; stroke: var(--success); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.result-number-badge.is-transcribed .badge-part { color: var(--success); }
.result-number-badge {
  position: absolute; left: 50%; top: 8px; transform: translateX(-50%);
  display: flex; flex-direction: row; align-items: center; gap: 4px; z-index: 5; pointer-events: none;
}
.result-number-badge .badge-part { pointer-events: none; cursor: default; }
.generated-canvas-wrap .result-number-badge { max-width: calc(100% - 16px); flex-wrap: wrap; justify-content: center; }
.generated-canvas-column {
  display: flex; flex-direction: column; align-items: center; gap: 10px;
}
.generated-canvas-column > .result-number-badge {
  position: static; transform: none; max-width: 100%; flex-wrap: wrap; justify-content: center;
}
.badge-edit-input {
  width: 64px; font-size: .72rem; font-weight: 700; text-align: center; padding: 1px 3px;
  border: 1px solid var(--accent); border-radius: 4px; background: #fff; cursor: text;
}
.badge-edit-wrapper {
  pointer-events: auto; display: inline-flex; align-items: center; gap: 2px; cursor: default;
}
.badge-discard-button {
  width: 18px; height: 18px; flex: none; display: grid; place-items: center; padding: 0;
  border: 1px solid var(--danger); border-radius: 50%; background: #fff; color: var(--danger);
  font-size: .78rem; font-weight: 700; line-height: 1; cursor: pointer;
}
.badge-discard-button:hover { background: var(--danger); color: #fff; }
.badge-skip-user { cursor: pointer; }
.badge-skip-user:hover { text-decoration: underline; }
.preview-toolbar { min-height: 77px; padding: 18px 22px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.preview-toolbar h2 { max-width: min(46vw, 540px); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.zoom-controls { padding: 3px; display: flex; align-items: center; gap: 2px; border: 1px solid var(--line); border-radius: 999px; background: #f0f0f2; }
.zoom-controls button {
  width: 32px; height: 32px; border: 0; border-radius: 50%; color: var(--text); background: transparent; cursor: pointer; font-size: 1rem;
}
.zoom-controls button:hover:not(:disabled) { background: #fff; }
.zoom-controls button:disabled { opacity: .35; cursor: not-allowed; }
.zoom-controls output { min-width: 48px; color: var(--muted); text-align: center; font-size: .72rem; font-weight: 700; }
.fullscreen-toggle-button {
  width: 38px; height: 38px; flex: none; display: grid; place-items: center;
  border: 1px solid var(--line); border-radius: 50%; color: var(--text); background: #f0f0f2; cursor: pointer;
}
.fullscreen-toggle-button:hover { background: #fff; }
.fullscreen-toggle-button svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.badge-visibility-toggle-button {
  width: 38px; height: 38px; flex: none; display: grid; place-items: center;
  border: 1px solid var(--line); border-radius: 50%; color: var(--text); background: #f0f0f2; cursor: pointer;
}
.badge-visibility-toggle-button:hover { background: #fff; }
.badge-visibility-toggle-button.is-active { color: var(--accent); border-color: var(--accent); }
.badge-visibility-toggle-button svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
#previewViewerBody.is-fullscreen {
  position: fixed; inset: 0; z-index: 1000; background: #fff;
  display: flex; flex-direction: column;
}
#previewViewerBody.is-fullscreen .preview-stage-shell { flex: 1; min-height: 0; }
#previewViewerBody.is-fullscreen .preview-viewport { height: 100%; }
#previewViewerBody.hide-badges .number-badge { display: none; }
#generatedViewer.hide-badges .result-number-badge { display: none; }
#generatedViewer.is-fullscreen {
  position: fixed; inset: 0; z-index: 1000; background: #fff;
  display: flex; flex-direction: column; overflow: auto;
}
#generatedViewer.is-fullscreen .generated-stage-shell { flex: 1; min-height: 0; }
#generatedViewer.is-fullscreen .generated-viewport { height: 100%; }
.preview-stage-shell { min-height: 515px; position: relative; display: grid; grid-template-columns: 48px minmax(0, 1fr) 48px; align-items: center; background: #e8e8eb; }
.preview-viewport {
  width: 100%; height: 495px; overflow: auto; position: relative;
  display: grid; place-items: center; border: 1px solid rgba(0,0,0,.1);
  background-color: #d7d7da;
  background-image: linear-gradient(45deg, #ceced2 25%, transparent 25%), linear-gradient(-45deg, #ceced2 25%, transparent 25%), linear-gradient(45deg, transparent 75%, #ceced2 75%), linear-gradient(-45deg, transparent 75%, #ceced2 75%);
  background-size: 22px 22px; background-position: 0 0, 0 11px, 11px -11px, -11px 0;
}
.empty-preview { max-width: 350px; padding: 30px; text-align: center; color: var(--muted); }
.empty-preview strong { display: block; margin-bottom: 7px; color: #444448; font-size: .95rem; }
.empty-preview p { margin: 0; font-size: .78rem; line-height: 1.5; }
.empty-icon { width: 54px; height: 54px; margin: 0 auto 14px; display: grid; place-items: center; border-radius: 17px; color: #fff; background: var(--navy); font-size: 1.7rem; }
.canvas-wrap { position: relative; flex: none; transform-origin: center center; box-shadow: 0 16px 44px rgba(0, 0, 0, .24); user-select: none; }
.canvas-wrap.zoom-click { cursor: zoom-in; }
.canvas-wrap.zoom-click.is-point-zoomed { cursor: zoom-out; }
.canvas-wrap img { width: 100%; height: 100%; display: block; pointer-events: none; }
.guide { position: absolute; z-index: 3; background: var(--accent); box-shadow: 0 0 0 .5px rgba(255,255,255,.8), 0 1px 4px rgba(0,67,140,.42); touch-action: none; }
.guide::before { content: ""; position: absolute; }
.guide span {
  position: absolute; padding: 4px 7px; border-radius: 7px; color: #fff; background: var(--accent);
  font-size: .62rem; font-weight: 750; white-space: nowrap; pointer-events: none;
}
.guide.vertical { top: 0; bottom: 0; width: 2px; cursor: ew-resize; transform: translateX(-1px); }
.guide.vertical::before { top: 0; bottom: 0; left: -9px; right: -9px; }
.guide.vertical span {
  top: 8px; left: auto; right: 6px; writing-mode: vertical-rl; text-orientation: mixed; transform: rotate(180deg);
}
.guide.horizontal { height: 2px; cursor: ns-resize; transform: translateY(-1px); }
.guide.horizontal::before { top: -9px; bottom: -9px; left: 0; right: 0; }
.guide.horizontal span { top: 7px; left: 50%; transform: translateX(-50%); }
.guide.specific { background: var(--danger); box-shadow: 0 0 0 .5px rgba(255,255,255,.86), 0 1px 4px rgba(120,20,14,.4); }
.guide.specific span { background: var(--danger); }
.guide.horizontal.left { left: 0; }
.guide.horizontal.right { right: 0; }
.cut-line {
  position: absolute; height: 2px; z-index: 4; background: #e08a1e; cursor: ns-resize;
  transform: translateY(-1px); touch-action: none;
  box-shadow: 0 0 0 .5px rgba(255,255,255,.86), 0 1px 4px rgba(150,80,0,.4);
}
.cut-line::before { content: ""; position: absolute; top: -9px; bottom: -9px; left: 0; right: 0; }
.nav-button {
  width: 38px; height: 38px; margin: auto; display: grid; place-items: center;
  border: 1px solid var(--line); border-radius: 50%; color: var(--text); background: rgba(255,255,255,.88);
  box-shadow: 0 5px 14px rgba(0,0,0,.12); cursor: pointer; font-size: 1.7rem; line-height: 1;
}
.nav-button:disabled { opacity: .3; cursor: not-allowed; }
.nav-button-stack { display: flex; flex-direction: column; align-items: center; gap: 6px; margin: auto; }
.nav-button-fast {
  width: 30px; height: 24px; display: grid; place-items: center;
  border: 1px solid var(--line); border-radius: 8px; color: var(--text); background: rgba(255,255,255,.88);
  box-shadow: 0 3px 8px rgba(0,0,0,.1); cursor: pointer; font-size: 1rem; line-height: 1;
}
.nav-button-fast:disabled { opacity: .3; cursor: not-allowed; }
.preview-footer {
  min-height: 51px; padding: 12px 22px;
  display: grid; grid-template-columns: minmax(0,1fr) auto minmax(0,1fr);
  align-items: center; gap: 16px; color: var(--muted); font-size: .75rem;
}
.preview-footer span { display: flex; align-items: center; gap: 7px; }
.preview-footer > span:last-child { justify-self: end; text-align: right; }
.preview-position-group { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.specific-guide-option {
  display: inline-flex; grid-auto-flow: column; align-items: center; gap: 5px;
  color: var(--muted); cursor: pointer; font-size: .62rem; font-weight: 600;
  letter-spacing: .01em;
}
.specific-guide-option input { width: 13px; height: 13px; margin: 0; accent-color: var(--danger); }
.specific-guide-option:has(input:checked) { color: var(--danger); }
.specific-guide-option:has(input:disabled) { opacity: .45; cursor: not-allowed; }
.guide-swatch { width: 18px; height: 2px; display: inline-block; border-radius: 99px; background: var(--accent); }
.guide-swatch.specific { background: var(--danger); }
.preview-actions {
  min-height: 70px; padding: 13px 22px; border-top: 1px solid var(--line);
  display: flex; align-items: center; justify-content: flex-end; gap: 16px;
}
.preview-primary-actions { display: flex; align-items: center; justify-content: flex-end; gap: 9px; }
.image-delete-link {
  padding: 6px 0; display: inline-flex; align-items: center; gap: 5px;
  border: 0; color: var(--danger); background: transparent; cursor: pointer;
  font-size: .72rem; font-weight: 700;
}
.image-delete-link:hover:not(:disabled) { text-decoration: underline; text-underline-offset: 3px; }
.image-delete-link:disabled { opacity: .38; cursor: not-allowed; }
.image-delete-link svg {
  width: 15px; height: 15px; fill: none; stroke: currentColor;
  stroke-width: 1.45; stroke-linecap: round;
}

.execution-card { margin-top: 22px; padding: 24px; }
#gcpUploadCard { margin-top: 22px; }
.execution-header { display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.action-buttons { display: flex; align-items: center; gap: 9px; }
.action-buttons .button { flex: 0 1 auto; }
#openFolderButton { margin-left: auto; }
.progress-area {
  margin-top: 22px; padding: 13px 15px; border: 1px solid var(--line);
  border-radius: 14px; background: #fff;
}
.progress-title { display: block; margin-bottom: 6px; color: var(--text); font-size: .8rem; font-weight: 700; }
.progress-copy { margin-bottom: 8px; display: flex; justify-content: space-between; gap: 14px; color: var(--muted); font-size: .8rem; }
.progress-copy strong { color: var(--text); }
.progress-track { height: 9px; overflow: hidden; border-radius: 99px; background: #dfdfe4; }
.progress-bar { width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--accent), #55a9fb); transition: width .28s ease; }
.progress-bar.success { background: var(--success); }
.progress-bar.failed { background: var(--danger); }
.cloud-upload-section {
  margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line);
}
.cloud-upload-panel {
  margin-top: 14px; padding: 13px 15px; border: 1px solid rgba(0,113,227,.18);
  border-radius: 14px; background: var(--light-blue);
}
.cloud-upload-copy { display: flex; align-items: center; justify-content: space-between; gap: 15px; }
.cloud-upload-copy > div { min-width: 0; display: grid; gap: 2px; }
.cloud-upload-copy strong { color: var(--text); font-size: .8rem; }
.cloud-upload-copy span { overflow: hidden; color: var(--muted); font-size: .72rem; text-overflow: ellipsis; white-space: nowrap; }
.cloud-upload-track { height: 7px; margin-top: 9px; overflow: hidden; border-radius: 99px; background: rgba(0,113,227,.13); }
.cloud-upload-track > span { display: block; width: 0; height: 100%; border-radius: inherit; background: var(--accent); transition: width .25s ease; }
.cloud-upload-track.success > span { background: var(--success); }
.cloud-upload-track.failed > span { background: var(--danger); }
#gcpUploadButton { margin-top: 13px; }
.modal-note { color: var(--muted); font-size: .75rem; }
.confirmation-checkbox {
  display: flex; align-items: flex-start; gap: 10px; margin: 14px 0;
  padding: 12px; border: 1px solid var(--line); border-radius: 10px; cursor: pointer;
}
.confirmation-checkbox[hidden] { display: none; }
.confirmation-checkbox input { margin-top: 2px; accent-color: var(--accent); }
.confirmation-checkbox span { display: grid; gap: 3px; }
.confirmation-checkbox strong { font-size: .83rem; }
.confirmation-checkbox small { color: var(--muted); font-size: .72rem; font-weight: 450; }
.console-visibility-option {
  margin-top: 12px; display: inline-flex; align-items: center; gap: 6px;
  color: var(--muted); cursor: pointer; font-size: .64rem; font-weight: 650;
}
.console-visibility-option input { width: 13px; height: 13px; margin: 0; accent-color: var(--accent); }
.log-panel {
  margin-top: 12px; overflow: hidden; border: 1px solid rgba(0,0,0,.14);
  border-radius: 15px; background: #fff; color: var(--text);
}
.log-header {
  min-height: 42px; padding: 8px 13px; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between;
  color: var(--text); background: #fff; font-size: .72rem;
}
.log-header > span { display: flex; align-items: center; gap: 8px; }
.log-header i { width: 8px; height: 8px; border-radius: 50%; background: #48c78e; box-shadow: 0 0 0 3px rgba(72,199,142,.13); }
.logs { height: 125px; padding: 10px 13px; overflow: auto; color: var(--text); background: #fff; font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; font-size: .72rem; line-height: 1.55; }
.logs p { margin: 0 0 3px; }
.logs p::before { content: "› "; color: #66b4ff; }
.logs .muted-log { color: #888890; }
.logs .muted-log::before { content: ""; }
.logs .log-error-line { color: #b3261e; font-weight: 600; }

.generated-viewer {
  margin-top: 20px; overflow: hidden; border: 1px solid var(--line);
  border-radius: 18px; background: rgba(255,255,255,.74);
}
.generated-toolbar {
  min-height: 78px; padding: 16px 18px; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.generated-toolbar h3 { margin: 3px 0 2px; color: var(--muted); font-size: .77rem; font-weight: 650; letter-spacing: 0; }
.generated-toolbar h2 {
  max-width: min(55vw, 650px); margin: 0; overflow: hidden;
  color: var(--text); font-size: 1.18rem; letter-spacing: -.02em; text-overflow: ellipsis; white-space: nowrap;
}
.generated-group-option {
  margin: 7px 0 8px; display: inline-flex; align-items: center; gap: 6px;
  color: var(--muted); cursor: pointer; font-size: .68rem; font-weight: 650;
}
.generated-group-option input { width: 14px; height: 14px; margin: 0; accent-color: var(--accent); }
.generated-stage-shell {
  min-height: 585px; display: grid; grid-template-columns: 48px minmax(0,1fr) 48px;
  align-items: center; background: #e8e8eb;
}
.generated-viewport { height: 565px; }
.generated-canvas-wrap img { width: 100%; height: 100%; display: block; pointer-events: none; }
.generated-group-wrap {
  width: calc(100% - 24px); height: calc(100% - 24px); padding: 0;
  display: grid; grid-template-rows: auto minmax(0,1fr); gap: 9px;
  flex: none; background: transparent; transform-origin: center;
}
.generated-group-wrap.zoom-click { cursor: zoom-in; }
.generated-group-wrap.zoom-click.is-point-zoomed { cursor: zoom-out; }
.generated-group-wrap > h2 {
  margin: 0; overflow: hidden; color: var(--text); text-align: center;
  font-size: 1.05rem; letter-spacing: -.02em; text-overflow: ellipsis; white-space: nowrap;
}
.generated-group-grid {
  min-height: 0; display: grid; grid-template-columns: repeat(2, minmax(0,1fr));
  grid-template-rows: repeat(2, minmax(0,1fr)); gap: 10px 12px;
}
.generated-group-grid.two-files { grid-template-rows: minmax(0,1fr); }
.generated-group-item {
  min-width: 0; min-height: 0; margin: 0; display: flex; position: relative;
  flex-direction: column; align-items: center; gap: 4px;
}
.generated-group-item.bottom { flex-direction: column-reverse; }
.generated-group-image-wrap {
  position: relative; width: 100%; min-height: 0; flex: 1; display: flex;
}
.generated-group-image-wrap img {
  width: 100%; min-height: 0; flex: 1; object-fit: contain;
}
.generated-group-image-wrap .result-number-badge {
  max-width: calc(100% - 8px); flex-wrap: wrap; justify-content: center;
  gap: 2px; top: 2px;
}
.generated-group-image-wrap .result-number-badge .badge-part {
  font-size: .56rem; padding: 0 3px;
}
.generated-group-item figcaption {
  max-width: 100%; flex: none; overflow: hidden; color: var(--muted);
  font-size: .64rem; font-weight: 700; text-overflow: ellipsis; white-space: nowrap;
}
.generated-group-item figcaption strong,
.generated-group-item figcaption span { display: block; text-align: center; }
.generated-group-item figcaption strong { color: var(--text); font-size: .68rem; }
.generated-group-item figcaption span { margin-top: 1px; font-size: .59rem; font-weight: 600; }
.generated-footer {
  display: flex; align-items: center; justify-content: space-between;
  background: rgba(255,255,255,.72);
}

.modal { width: min(520px, calc(100% - 28px)); padding: 0; border: 0; border-radius: 24px; background: transparent; box-shadow: 0 35px 90px rgba(0,0,0,.32); }
.modal::backdrop { background: rgba(0, 15, 38, .6); backdrop-filter: blur(5px); }
.modal-card { padding: 28px; border-radius: 24px; background: #fff; }
.wide-modal { width: min(860px, calc(100vw - 48px)); max-height: calc(100vh - 48px); overflow: auto; }
.fullscreen-modal {
  inset: 0; width: 100vw; max-width: none; height: 100vh; height: 100dvh;
  max-height: none; margin: 0; border-radius: 0; box-shadow: none;
}
body.modal-open { overflow: hidden; }
.fullscreen-modal-card {
  width: 100%; height: 100%; padding: 0; border-radius: 0; overflow: hidden;
  display: grid; grid-template-rows: auto minmax(0, 1fr) auto;
}
.fullscreen-modal-header {
  padding: 22px clamp(22px, 4vw, 56px); border-bottom: 1px solid var(--line);
  background: linear-gradient(135deg, #fff 0%, #f4f8ff 100%);
}
.fullscreen-modal-header .section-kicker { margin: 0 0 5px; }
.fullscreen-modal-header h2 { margin: 0 0 5px; font-size: clamp(1.35rem, 2vw, 1.8rem); }
.fullscreen-modal-content {
  min-height: 0; overflow: auto; padding: 26px clamp(22px, 4vw, 56px) 42px;
  display: grid; gap: 18px; align-content: start; background: var(--surface-soft);
}
.config-section {
  padding: 22px; border: 1px solid var(--line); border-radius: 18px;
  background: #fff; box-shadow: 0 8px 24px rgba(16, 42, 74, .05);
}
.config-section + .config-section { margin-top: 20px; }
.registry-office-active-card {
  background: var(--light-blue); border-color: rgba(0, 113, 227, .18);
}
.registry-office-active-card #registryOfficeActivateButton { margin-top: 16px; }

.registry-office-modal-card {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 0;
  overflow: hidden;
}
.registry-office-modal-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.registry-office-modal-body .config-section { margin-top: 0; }
.registry-office-modal-card .modal-actions {
  flex-shrink: 0;
  align-items: center;
  margin-top: 0;
  padding: 16px 20px;
  border-top: 1px solid var(--line);
  background: #fff;
}

.registry-office-cadastro-card {
  background: var(--light-blue); border-color: rgba(0, 113, 227, .18);
}
.registry-office-cadastro-heading {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 16px;
}
.registry-office-active-toggle { margin: 0; flex-shrink: 0; }

.registry-office-name-row { grid-template-columns: 1fr 160px; }
.registry-office-city-row { grid-template-columns: 1fr 160px; margin-top: 12px; }

#registryOfficialAddButton { margin-top: 12px; }
#registryOfficeNewButton { margin-top: 16px; }

.registry-officials-table-wrap input[type="date"] {
  width: 100%; padding: 11px 13px; border: 1px solid var(--line-strong);
  border-radius: 12px; color: var(--text); background: rgba(255, 255, 255, .94);
  transition: border-color .18s, box-shadow .18s, background .18s;
}
.registry-officials-table-wrap input[type="date"]:focus {
  border-color: var(--accent); outline: none; box-shadow: 0 0 0 4px rgba(0, 113, 227, .12);
}

.registry-office-users-list { display: flex; flex-direction: column; gap: 2px; }
.registry-office-users-group-heading {
  margin: 14px 0 6px; font-size: .72rem; font-weight: 700; letter-spacing: .04em;
  text-transform: uppercase; color: var(--muted);
}
.registry-office-users-group-heading:first-child { margin-top: 0; }
.registry-office-user-item {
  display: flex; align-items: center; gap: 10px; min-height: 40px;
  padding: 6px 10px; border-radius: 10px; font-size: .86rem; color: var(--text);
  cursor: pointer; transition: background .15s;
}
.registry-office-user-item:hover { background: var(--surface-soft); }
.registry-office-user-item input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--accent); flex-shrink: 0; margin: 0; }
.registry-office-user-item.locked { color: var(--muted); cursor: default; }
.registry-office-user-item.locked:hover { background: none; }
.registry-office-user-item.locked input[type="checkbox"] { accent-color: var(--muted); cursor: default; }

.toggle-switch-field {
  display: flex; align-items: center; gap: 10px; min-height: 42px;
  color: var(--navy); font-size: .82rem; cursor: pointer;
}
.toggle-switch { position: relative; display: inline-block; width: 42px; height: 24px; flex-shrink: 0; }
.toggle-switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; z-index: 1; }
.toggle-switch-track {
  position: absolute; inset: 0; background: rgba(0, 15, 38, .18); border-radius: 999px;
  transition: background .18s;
}
.toggle-switch-track::before {
  content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px;
  background: #fff; border-radius: 50%; box-shadow: 0 1px 3px rgba(0,0,0,.25);
  transition: transform .18s;
}
.toggle-switch input:checked + .toggle-switch-track { background: var(--accent, #0071e3); }
.toggle-switch input:checked + .toggle-switch-track::before { transform: translateX(18px); }
.toggle-switch input:focus-visible + .toggle-switch-track { outline: 2px solid var(--accent, #0071e3); outline-offset: 2px; }
.config-section-heading { margin-bottom: 16px; }
.config-section-heading h3 { margin: 0 0 5px; font-size: 1rem; }
.config-section-heading p { font-size: .78rem; }
.config-editor-section { display: grid; gap: 14px; }
.config-editor-section textarea { min-height: 140px; line-height: 1.5; }
.config-editor-section .code-editor {
  min-height: 360px; resize: vertical; font-family: "Cascadia Code", Consolas, monospace;
  font-size: .78rem; tab-size: 2;
}
.fullscreen-modal-actions {
  margin: 0; padding: 16px clamp(22px, 4vw, 56px); border-top: 1px solid var(--line);
  background: #fff; box-shadow: 0 -10px 28px rgba(16, 42, 74, .07);
}
.batch-detail-dialog.wide-modal {
  width: min(1180px, calc(100vw - 48px));
  height: min(660px, calc(100vh - 48px));
  overflow: hidden;
}
.batch-detail-modal-card {
  display: flex; flex-direction: column; height: 100%; max-height: 100%;
  padding: 0; border-radius: 24px; overflow: hidden; font-size: .92rem;
}
.batch-detail-modal-header {
  padding: 14px 22px; border-bottom: 1px solid var(--line);
  background: linear-gradient(135deg, #fff 0%, #f4f8ff 100%); flex: none;
}
.batch-detail-modal-header h2 { margin: 0 0 3px; font-size: clamp(1.05rem, 1.8vw, 1.25rem); }
.batch-detail-columns {
  min-height: 0; flex: 1; overflow: hidden; padding: 14px 22px;
  display: grid; grid-template-columns: minmax(210px, 280px) minmax(0, 1fr); gap: 14px;
  align-items: stretch; background: var(--surface-soft);
}
.batch-detail-columns .config-section { padding: 14px; }
.batch-detail-columns .config-section-heading { margin-bottom: 8px; }
.batch-detail-columns .config-section-heading h3 { font-size: .88rem; }
.batch-detail-summary-col { min-height: 0; overflow-y: auto; }
.batch-detail-files-col { min-height: 0; display: flex; flex-direction: column; }
.batch-detail-files-table { flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; max-height: none; margin-top: 0; }
.batch-detail-files-table table { min-width: 0; width: 100%; table-layout: fixed; font-size: .72rem; }
.batch-detail-files-table td, .batch-detail-files-table th { white-space: normal; overflow-wrap: break-word; padding: 5px 8px; }
.batch-detail-files-table th:first-child, .batch-detail-files-table td:first-child { width: 55%; }
.batch-detail-summary-col .metadata-grid {
  display: block; padding: 0; border: none; gap: 0;
}
.batch-detail-summary-col .metadata-grid dt {
  font-size: .64rem; text-transform: uppercase; letter-spacing: .02em; margin-top: 7px;
}
.batch-detail-summary-col .metadata-grid dt:first-child { margin-top: 0; }
.batch-detail-summary-col .metadata-grid dd { font-size: .82rem; font-weight: 600; }
.batch-detail-modal-actions {
  margin: 0; padding: 10px 22px; border-top: 1px solid var(--line); background: #fff;
}
.pipeline-results-dialog.wide-modal {
  height: auto; max-height: calc(100vh - 48px); overflow: hidden;
}
.pipeline-results-dialog .batch-detail-modal-card { max-height: calc(100vh - 48px); overflow-y: auto; }
.pipeline-results-dialog .field-group { padding: 10px 22px 0; }
.pipeline-results-dialog #pipelineResultsStatus { padding: 0 22px; }
.pipeline-result-identity { margin: 0 22px 10px; padding: 10px 14px; }
.pipeline-results-dialog .flow-card { margin: 0 22px 14px; }
.pipeline-result-split {
  display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, .9fr); gap: 14px;
  align-items: stretch;
}
.pipeline-result-image-col .preview-stage-shell { min-height: 0; }
/* Badge fora da imagem — na área quadriculada do viewport, acima da
   caixa da imagem, não sobreposto ao conteúdo do registro. */
.pipeline-result-canvas-column { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.pipeline-result-badge-static { position: static; transform: none; left: auto; top: auto; }
/* height:100% no textarea conta 100% da caixa de conteúdo do <aside>
   inteiro — inclusive o espaço já ocupado pelo heading "Texto integral"
   acima dele —, então o textarea sempre estourava o card por baixo. Como
   flex column, o textarea (flex:1) preenche só o espaço realmente
   sobrando, com padding-bottom do próprio <aside> respeitado e rolagem
   interna nativa do textarea quando o texto não cabe. */
.pipeline-result-text-col { display: flex; flex-direction: column; min-height: 0; }
.pipeline-result-text-col textarea {
  width: 100%; flex: 1; min-height: 300px; resize: vertical; font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: .82rem; padding: 10px; border: 1px solid var(--line); border-radius: 12px;
}
.pipeline-raw-json { max-height: 320px; white-space: pre-wrap; overflow-wrap: anywhere; }
@media (max-width: 760px) {
  .pipeline-result-split { grid-template-columns: 1fr; }
}
/* Expandir para tela cheia: como o viewer vive dentro de um <dialog> (já no
   top layer do navegador), basta crescer o próprio diálogo em vez de
   reparentar o elemento para <body> (o truque usado pelos visualizadores
   fora de modal) — reparentar aqui ficaria atrás do backdrop do modal. */
.pipeline-results-dialog.pipeline-results-fullscreen.wide-modal {
  width: calc(100vw - 24px); height: calc(100vh - 24px); max-height: calc(100vh - 24px);
}
.pipeline-results-dialog.pipeline-results-fullscreen .batch-detail-modal-card { max-height: calc(100vh - 24px); }
.pipeline-results-dialog.pipeline-results-fullscreen #pipelineResultRecordSelectGroup,
.pipeline-results-dialog.pipeline-results-fullscreen .pipeline-result-identity,
.pipeline-results-dialog.pipeline-results-fullscreen .pipeline-result-text-col,
.pipeline-results-dialog.pipeline-results-fullscreen #pipelineResultDataCard {
  display: none;
}
.pipeline-results-dialog.pipeline-results-fullscreen .pipeline-result-split { grid-template-columns: 1fr; height: calc(100vh - 170px); }
.pipeline-results-dialog.pipeline-results-fullscreen .pipeline-result-image-col { height: 100%; display: flex; flex-direction: column; }
.pipeline-results-dialog.pipeline-results-fullscreen .preview-stage-shell { flex: 1; min-height: 0; }
.pipeline-results-dialog.pipeline-results-fullscreen .preview-viewport { height: 100%; }
@media (max-width: 760px) {
  .batch-detail-dialog.wide-modal {
    inset: 0; width: 100vw; max-width: none; height: 100vh; height: 100dvh;
    max-height: none; margin: 0; border-radius: 0; box-shadow: none;
  }
  .batch-detail-modal-card { border-radius: 0; }
  .batch-detail-columns {
    grid-template-columns: 1fr; overflow-y: auto; overflow-x: hidden;
  }
  .batch-detail-summary-col { position: static; overflow: visible; }
  .batch-detail-files-col { overflow: visible; }
  .batch-detail-files-table { overflow: visible; flex: none; }
}
.obs-cell-text.clamped {
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical;
  overflow: hidden;
}
.obs-expand-button {
  display: inline-block; margin-top: 3px; background: none; border: none; padding: 0;
  color: var(--accent); font-size: .68rem; font-weight: 700; cursor: pointer;
  text-decoration: underline; text-underline-offset: 2px;
}
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.two-columns { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.field-group textarea, .config-editor-section textarea {
  width: 100%; margin-top: 7px; padding: 10px 11px; resize: vertical;
  border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--text); font: inherit;
}
.inline-catalog { display: grid; grid-template-columns: minmax(120px, .5fr) minmax(220px, 1.5fr) auto; gap: 10px; align-items: end; border: 1px solid var(--line); border-radius: 14px; padding: 14px; }
.inline-catalog legend { padding: 0 6px; font-weight: 700; }
.candidate-list { display: grid; gap: 8px; margin: 16px 0; }
.candidate-list label { display: block; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
@media (max-width: 720px) { .two-columns, .inline-catalog { grid-template-columns: 1fr; } }
.modal-icon { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 14px; font-size: 1.25rem; font-weight: 850; }
.modal-icon.warning { color: #8a5b08; background: #fff2d8; }
.modal-icon.success { color: var(--success); background: #eaf7f0; }
.modal-icon.danger { color: var(--danger); background: #fff0ef; }
.modal h2 { margin: 18px 0 8px; font-size: 1.35rem; letter-spacing: -.025em; }
.modal p { margin: 0; color: var(--muted); line-height: 1.55; }
.modal details { margin-top: 14px; color: var(--muted); font-size: .78rem; }
.modal ul { max-height: 110px; overflow: auto; }
.modal-actions { margin-top: 24px; display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 9px; }
.toast-region { position: fixed; right: 22px; bottom: 22px; z-index: 1200; display: grid; gap: 9px; }
.toast {
  width: min(390px, calc(100vw - 44px)); padding: 14px 16px; border: 1px solid var(--line);
  border-radius: 14px; color: var(--text); background: rgba(255,255,255,.96);
  box-shadow: 0 18px 50px rgba(0,0,0,.2); animation: toast-in .25s ease both; font-size: .83rem; line-height: 1.4;
}
.toast.success { border-color: rgba(22,121,77,.25); }
.toast.error { border-color: rgba(180,35,24,.3); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }
@keyframes spinner-rotation { to { transform: rotate(360deg); } }

.file-manager-layout { display: grid; grid-template-columns: minmax(190px, .72fr) minmax(0, 2.55fr); align-items: start; gap: 12px; margin-top: 4px; }
.file-manager-tree { padding: 10px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); box-shadow: var(--shadow); }
.file-manager-tree-list { margin: 0; padding: 0; list-style: none; display: grid; gap: 4px; }
.fm-type-group { border-bottom: 1px solid var(--line); padding-bottom: 6px; }
.fm-type-group:last-child { border-bottom: 0; padding-bottom: 0; }
.fm-type-group > details > summary { list-style: none; }
.fm-type-group > details > summary::-webkit-details-marker { display: none; }
.fm-type-header {
  display: flex; align-items: center; gap: 6px; padding: 7px 5px; border-radius: 8px;
  color: var(--text); font-weight: 700; font-size: .85rem; cursor: pointer;
}
.fm-type-header:hover { background: #f0f0f2; }
.fm-type-header .icon-folder { flex: none; width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.6; color: var(--accent); }
.fm-type-header .fm-chevron { margin-left: auto; width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.8; color: var(--muted); transition: transform .15s ease; }
.fm-type-group details[open] .fm-chevron { transform: rotate(90deg); }
.fm-book-list { list-style: none; margin: 2px 0 4px 22px; padding: 0; display: grid; gap: 1px; }
.fm-book-item {
  width: 100%; display: flex; align-items: center; gap: 5px; padding: 6px; border: 0; border-radius: 7px;
  background: transparent; color: var(--muted); font-size: .78rem; cursor: pointer; text-align: left;
}
.fm-book-item:hover { background: #f0f0f2; color: var(--text); }
.fm-book-item.active { background: var(--light-blue); color: var(--accent); font-weight: 700; }
.fm-book-item .fm-count { margin-left: auto; color: var(--muted); font-size: .68rem; }
.fm-mini-stats { margin-left: auto; display: flex; align-items: center; gap: 1px; }
.fm-mini-stats .fm-mini-cell {
  display: inline-block; min-width: 16px; border: 0; text-align: right; font-size: .68rem;
  font-weight: 700; color: var(--success);
}
.fm-mini-stats .fm-mini-cell.fm-mini-check { width: 16px; text-align: center; }
.fm-mini-stats .fm-mini-cell.fm-mini-check .fm-check-icon { margin: 0; }
.fm-mini-separator { color: var(--muted); font-size: .68rem; }
.fm-empty-note { margin: 2px 0 4px 27px; color: var(--muted); font-size: .72rem; }
.fm-new-folder-button {
  margin: 4px 0 4px 27px; display: inline-flex; align-items: center; gap: 5px; padding: 6px 10px;
  border: 1px dashed var(--line-strong); border-radius: 8px; background: transparent; color: var(--accent);
  font-size: .74rem; font-weight: 700; cursor: pointer;
}
.fm-new-folder-button:hover { background: var(--light-blue); }
.fm-new-folder-button svg { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 2; }

.file-manager-table-col { min-width: 0; }
.file-manager-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; flex-wrap: wrap; }
.file-manager-toolbar h2 { margin: 0; font-size: 1.05rem; }
.book-registry-toolbar-actions { display: flex; align-items: center; justify-content: flex-end; gap: 10px; min-width: 0; flex-wrap: wrap; }
.book-registry-toolbar-actions .expected-data-import-group { gap: 8px; }
.book-registry-ranges-editor {
  width: 100%; min-height: 44px; margin-top: 7px; padding: 4px 8px;
  display: flex; align-items: center; flex-wrap: wrap; gap: 5px;
  border: 1px solid var(--line-strong); border-radius: 8px; background: #fff;
}
.book-registry-ranges-editor:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(37, 99, 235, .14); }
.book-registry-ranges-chips { display: inline-flex; align-items: center; flex-wrap: wrap; gap: 5px; }
.book-registry-ranges-editor input#bookRegistryRangesInput {
  width: auto; min-width: 92px; min-height: 32px; margin: 0; padding: 3px 2px;
  flex: 1 1 110px; border: 0; border-radius: 0; box-shadow: none; outline: 0;
}
.book-registry-ranges-editor input#bookRegistryRangesInput:focus { box-shadow: none; }
.book-registry-range-chip {
  display: inline-flex; align-items: center; gap: 4px; padding: 3px 4px 3px 7px;
  border: 1px solid rgba(37, 99, 235, .18); border-radius: 6px;
  color: #1d4ed8; background: var(--light-blue); font-size: .76rem; font-weight: 650;
}
.book-registry-range-remove {
  width: 18px; height: 18px; padding: 0; display: grid; place-items: center;
  border: 0; border-radius: 4px; color: inherit; background: transparent; cursor: pointer;
  font: inherit; font-size: 1rem; line-height: 1;
}
.book-registry-range-remove:hover { background: rgba(37, 99, 235, .12); }
#fileManagerDeleteButton svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.7; }
.file-manager-table-wrap .fm-col-check { width: 34px; }
.fm-row-checkbox, #fileManagerSelectAll {
  appearance: none; -webkit-appearance: none; margin: 0; vertical-align: middle;
  width: 18px; height: 18px; border: 1.6px solid var(--line-strong); border-radius: 5px;
  background: #fff; cursor: pointer; transition: background .15s, border-color .15s;
}
.fm-row-checkbox:hover:not(:disabled), #fileManagerSelectAll:hover:not(:disabled) { border-color: var(--success); }
.fm-row-checkbox:checked, #fileManagerSelectAll:checked {
  background-color: var(--success); border-color: var(--success);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'/%3E%3C/svg%3E");
  background-size: 13px 13px; background-repeat: no-repeat; background-position: center;
}
.fm-row-checkbox:indeterminate, #fileManagerSelectAll:indeterminate {
  background-color: var(--success); border-color: var(--success);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3' stroke-linecap='round'%3E%3Cline x1='5' y1='12' x2='19' y2='12'/%3E%3C/svg%3E");
  background-size: 13px 13px; background-repeat: no-repeat; background-position: center;
}
.fm-row-checkbox:disabled, #fileManagerSelectAll:disabled { opacity: .4; cursor: not-allowed; }
.fm-th-sort {
  display: inline-flex; align-items: center; gap: 4px; border: 0; background: transparent; padding: 0;
  font: inherit; color: inherit; text-transform: inherit; letter-spacing: inherit; cursor: pointer;
}
.fm-sort-icon { width: 10px; height: 10px; fill: none; stroke: currentColor; stroke-width: 2; opacity: .3; }
.file-manager-table-wrap th[data-sort-direction] .fm-sort-icon { opacity: .9; }
.file-manager-table-wrap th[data-sort-direction="desc"] .fm-sort-icon { transform: rotate(180deg); }
.fm-file-link { border: 0; padding: 0; background: none; color: var(--accent); font-weight: 700; cursor: pointer; text-align: left; }
.fm-file-link:hover { text-decoration: underline; }
.fm-check-icon { width: 16px; height: 16px; display: block; margin: 0 auto; }
.fm-check-icon circle { fill: var(--success); stroke: none; }
.fm-check-icon path { fill: none; stroke: #fff; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.fm-col-transcribed, td.fm-col-transcribed { text-align: center; vertical-align: middle; }
.file-manager-table-wrap th.fm-col-transcribed { padding-inline: 5px; }
.file-manager-table-wrap th.fm-col-transcribed .fm-th-sort { width: 100%; justify-content: center; }
.fm-transcription-button { display: inline-grid; place-items: center; width: 28px; height: 28px; padding: 0; border: 0; border-radius: 7px; background: transparent; cursor: pointer; }
.fm-transcription-button:hover { background: #edf8f1; }
.fm-transcription-button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.file-manager-table-wrap { margin-top: 0; }
.file-manager-table-wrap table { min-width: 720px; font-size: .69rem; table-layout: fixed; }
.file-manager-table-wrap th { padding: 6px 5px; white-space: normal; }
.file-manager-table-wrap td { padding: 6px 5px; }
.file-manager-table-wrap th:nth-child(1), .file-manager-table-wrap td:nth-child(1) { width: 30px; }
.file-manager-table-wrap th:nth-child(2), .file-manager-table-wrap td:nth-child(2) { width: 31%; }
.file-manager-table-wrap th:nth-child(3), .file-manager-table-wrap td:nth-child(3) { width: 76px; }
.file-manager-table-wrap th:nth-child(4), .file-manager-table-wrap td:nth-child(4) { width: 76px; }
.file-manager-table-wrap th:nth-child(5), .file-manager-table-wrap td:nth-child(5), .file-manager-table-wrap th:nth-child(6), .file-manager-table-wrap td:nth-child(6) { width: 116px; }
.file-manager-image-card .preview-viewport { height: min(70vh, 760px); min-height: 520px; }
.file-manager-transcription-card { width: min(760px, 94vw); }
.file-manager-transcription-text { width: 100%; min-height: 360px; resize: vertical; line-height: 1.5; }
.fm-context-menu {
  position: fixed; z-index: 1000; min-width: 160px; padding: 4px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow-lg, var(--shadow));
}
.fm-context-menu-item {
  display: block; width: 100%; text-align: left; padding: 8px 10px; border: 0; border-radius: 6px;
  background: transparent; color: var(--danger); font-size: .8rem; font-weight: 600; cursor: pointer;
}
.fm-context-menu-item:hover { background: #f0f0f2; }
.file-manager-image-card { padding: 0; overflow: hidden; }
.file-manager-image-card .modal-note { padding: 12px 22px; margin: 0; }

.site-footer { flex: none; margin-top: auto; border-top: 1px solid var(--line); background: rgba(255,255,255,.72); }
.footer-bottom { min-height: 70px; display: flex; align-items: center; justify-content: space-between; gap: 22px; color: var(--muted); font-size: .78rem; line-height: 1.45; }
.footer-bottom span:last-child { text-align: right; }

/* Mobile navigation: keep the Feather sidebar as an off-canvas menu instead
   of reverting to the legacy horizontal tab bar. */
.mobile-nav-toggle { display: none; }

@media (max-width: 800px) {
  html, body { max-width: 100%; overflow-x: hidden; }
  body.mobile-nav-open { overflow: hidden; }
  .site-header { z-index: 90; }
  .brand-row {
    width: calc(100% - 20px);
    min-height: 60px;
    gap: 8px;
  }
  .mobile-nav-toggle {
    width: 40px;
    height: 40px;
    flex: 0 0 40px;
    display: grid;
    place-items: center;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: 10px;
    color: var(--navy);
    background: #fff;
    cursor: pointer;
  }
  .mobile-nav-toggle:hover,
  .mobile-nav-toggle[aria-expanded="true"] { color: var(--accent); border-color: rgba(37, 99, 235, .3); }
  .mobile-nav-toggle svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
  .logo-box { min-width: 0; width: auto; height: 50px; flex: 1 1 auto; }
  .logo { width: auto; max-width: 100%; max-height: 40px; }
  .logout-button {
    width: 40px;
    height: 40px;
    min-height: 40px;
    flex: 0 0 40px;
    justify-content: center;
    padding: 0;
    border-radius: 10px;
  }
  .logout-button span { display: none; }
  .logout-button svg { width: 19px; height: 19px; }
  .active-registry-office-topbar { display: none; }

  .app-shell {
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 18px 10px 42px;
    display: block;
  }
  .app-content, .tab-panel, .converter-flow, .workspace-grid, .flow-card { min-width: 0; max-width: 100%; }
  .module-sidebar {
    position: fixed;
    inset: 60px auto 0 0;
    z-index: 100;
    width: min(84vw, 282px);
    height: calc(100vh - 60px);
    padding: 16px 12px 24px;
    overflow-y: auto;
    border: 0;
    border-right: 1px solid var(--line);
    border-radius: 0;
    background: #fff;
    box-shadow: 14px 0 36px rgba(15, 23, 42, .14);
    transform: translateX(-105%);
    transition: transform .22s ease;
  }
  .module-sidebar.mobile-open { width: min(84vw, 282px); transform: translateX(0); }
  .module-sidebar-toggle { display: none; }
  .module-tabs { width: 100%; margin: 0; display: flex; flex-direction: column; gap: 6px; }
  .module-tab,
  .module-sidebar.is-expanded .module-tab {
    min-height: 48px;
    width: 100%;
    justify-content: flex-start;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 9px;
    color: var(--text);
    font-size: .86rem;
    font-weight: 650;
    text-align: left;
  }
  .module-tab-glyph { display: block; width: 21px; height: 21px; flex: 0 0 21px; }
  .module-tab-kicker { display: none !important; }
  .module-sidebar.is-expanded .module-tab::after { content: none; }
  .module-tab:hover { color: var(--text); background: #f8fafc; }
  .module-tab.active, .module-tab[aria-selected="true"] { color: var(--accent); background: var(--light-blue); box-shadow: none; }
  body.mobile-nav-open::after {
    content: "";
    position: fixed;
    inset: 60px 0 0;
    z-index: 80;
    background: rgba(15, 23, 42, .24);
  }
  .page-heading { grid-template-columns: minmax(0, 1fr); gap: 10px; align-items: start; }
  .page-heading .batch-count { grid-column: 1; justify-self: center; }
  .page-heading .page-heading-settings-access,
  .page-heading .page-heading-model-access,
  .page-heading .page-heading-pipeline-access { grid-column: 1; justify-self: start; }
  .submission-row { grid-template-columns: minmax(0, 1fr); }
  .submission-row .button,
  .submission-row .icon-lock-button { width: 100%; }
  .responsive-table { max-width: 100%; overflow-x: auto; }
  img, canvas, video { max-width: 100%; }
}

@media (max-width: 420px) {
  .brand-row { gap: 6px; }
  .mobile-nav-toggle, .logout-button { width: 38px; flex-basis: 38px; }
  .logo { max-height: 36px; }
  .app-shell { padding-inline: 8px; }
  .flow-card { padding: 16px; }
}

/* Sandbox second-stage classification */
.sandbox-classification-card.is-disabled { opacity: .62; }
.sandbox-classification-card fieldset { margin: 0; padding: 0; border: 0; min-width: 0; }
.sandbox-classification-card fieldset:disabled { cursor: not-allowed; }
.sandbox-classification-card legend { margin: 16px 0 10px; padding: 0; color: var(--muted); font-size: .78rem; font-weight: 750; }
.sandbox-source-options { display: flex; flex-wrap: wrap; gap: 8px; }
.sandbox-source-options label { display: inline-flex; align-items: center; gap: 7px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--text); font-size: .78rem; }
.sandbox-source-options input[type="radio"] {
  appearance: auto; width: 18px; min-width: 18px; height: 18px; min-height: 18px; flex: 0 0 18px;
  margin: 0; padding: 0; border: 0; border-radius: 50%; background: transparent;
  box-shadow: none; accent-color: var(--accent);
}
.sandbox-source-options label small { color: var(--muted); font-size: .68rem; }
.sandbox-source-options label:has(input:checked) { border-color: rgba(37, 99, 235, .36); background: var(--light-blue); color: var(--accent); }
.sandbox-free-text-group textarea { min-height: 180px; border-radius: 10px; }
.sandbox-schema-select-group { margin-top: 16px; }
.sandbox-schema-options { display: flex; flex-wrap: wrap; gap: 8px; }
.sandbox-schema-options label { display: inline-flex; align-items: center; gap: 6px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--text); font-size: .78rem; }
.sandbox-schema-options label:has(input:checked) { border-color: rgba(37, 99, 235, .36); background: var(--light-blue); color: var(--accent); }
.sandbox-schema-toggle { display: flex; align-items: center; gap: 7px; margin-top: 14px; color: var(--text); font-size: .8rem; font-weight: 650; cursor: pointer; }
.sandbox-schema-preview { width: 100%; min-height: 220px; max-height: 340px; margin-top: 10px; padding: 11px 12px; resize: vertical; overflow: auto; border: 1px solid var(--line); border-radius: 10px; background: #f8fafc; color: var(--text); font: .75rem/1.45 "Cascadia Code", Consolas, monospace; }
.sandbox-classification-result { overflow: hidden; }
.sandbox-classification-result .recursive-json { max-height: 520px; overflow: auto; }
.sandbox-classification-result .sample-call-details { margin-top: 14px; }
@media (max-width: 800px) {
  .sandbox-schema-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sandbox-schema-options label { min-width: 0; }
}

/* Keep navigation controls above the preview canvas and touch-friendly in
   every viewer (fatiador, arquivos gerados, resultados and sandbox). */
.nav-button-stack,
.nav-button,
.nav-button-fast,
.sample-previous-button,
.sample-next-button { position: relative; z-index: 6; pointer-events: auto; touch-action: manipulation; }

/* Result/file viewer controls must wrap as a unit on narrow screens. */
@media (max-width: 800px) {
  .preview-card, .generated-viewer, .result-preview, .sample-preview { min-width: 0; max-width: 100%; }
  .preview-toolbar, .generated-toolbar { flex-wrap: wrap; align-items: flex-start; gap: 10px; }
  .preview-toolbar > .section-heading,
  .generated-toolbar > div:first-child,
  .sample-preview-toolbar > div:first-child { min-width: 0; flex: 1 1 160px; }
  .preview-toolbar h2, .generated-toolbar h2, .sample-preview-toolbar h2 { max-width: 100%; }
  .preview-toolbar > .zoom-controls,
  .preview-toolbar > .fullscreen-toggle-button,
  .generated-toolbar > .zoom-controls { flex: 0 0 auto; }
  .sample-preview-tools { min-width: 0; max-width: 100%; flex: 1 1 100%; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
  .sample-preview-tools .zoom-controls { flex: 0 0 auto; }
  .result-preview .preview-toolbar { gap: 8px; }
  .result-preview .sample-preview-tools { width: 100%; }
  .preview-footer { grid-template-columns: 1fr; gap: 8px; padding: 10px 14px; }
  .preview-footer > span:last-child { justify-self: start; text-align: left; }
  .preview-position-group { gap: 8px; }
  .preview-actions { min-height: 0; padding: 11px 14px; flex-wrap: wrap; }
  .preview-primary-actions { width: 100%; justify-content: flex-end; flex-wrap: wrap; }
  .generated-footer { flex-wrap: wrap; gap: 8px; padding: 10px 14px; }
}

/* Result/file viewer controls must wrap as a unit on narrow screens. */
@media (max-width: 800px) {
  .preview-card, .generated-viewer, .result-preview, .sample-preview { min-width: 0; max-width: 100%; }
  .preview-toolbar, .generated-toolbar { flex-wrap: wrap; align-items: flex-start; gap: 10px; }
  .preview-toolbar > .section-heading,
  .generated-toolbar > div:first-child,
  .sample-preview-toolbar > div:first-child { min-width: 0; flex: 1 1 160px; }
  .preview-toolbar h2, .generated-toolbar h2, .sample-preview-toolbar h2 { max-width: 100%; }
  .preview-toolbar > .zoom-controls,
  .preview-toolbar > .fullscreen-toggle-button,
  .generated-toolbar > .zoom-controls { flex: 0 0 auto; }
  .sample-preview-tools { min-width: 0; max-width: 100%; flex: 1 1 100%; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
  .sample-preview-tools .zoom-controls { flex: 0 0 auto; }
  .result-preview .preview-toolbar { gap: 8px; }
  .result-preview .sample-preview-tools { width: 100%; }
  .preview-footer { grid-template-columns: 1fr; gap: 8px; padding: 10px 14px; }
  .preview-footer > span:last-child { justify-self: start; text-align: left; }
  .preview-position-group { gap: 8px; }
  .preview-actions { min-height: 0; padding: 11px 14px; flex-wrap: wrap; }
  .preview-primary-actions { width: 100%; justify-content: flex-end; flex-wrap: wrap; }
  .generated-footer { flex-wrap: wrap; gap: 8px; padding: 10px 14px; }
}

@media (max-width: 960px) {
  .workspace-grid { grid-template-columns: 1fr; }
  .file-manager-layout { grid-template-columns: 1fr; }
  .preview-stage-shell { min-height: 470px; }
  .preview-viewport { height: 450px; }
  .three-columns, .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .submission-row { grid-template-columns: minmax(0, 1fr) auto auto; }
  .submission-row .button.primary { grid-column: 1 / -1; }
}
@media (max-width: 640px) {
  .wrap, .shell { width: min(100% - 20px, 1240px); }
  .logo-box { width: min(270px, 63vw); }
  .logo { max-width: 270px; max-height: 42px; }
  .product-chip { display: none; }
  .app-shell { padding: 28px 0 46px; }
  .page-heading { align-items: flex-end; }
  .page-heading .lead { display: none; }
  .batch-count { min-width: 104px; padding: 10px 12px; }
  .module-tabs { width: 100%; margin-bottom: 22px; }
  .module-tab { min-height: 56px; padding-inline: 5px; font-size: .7rem; }
  .module-tabs { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .module-tab-kicker { font-size: .54rem; letter-spacing: .06em; }
  .construction-card { min-height: 360px; padding: 30px 22px; }
  .three-columns, .two-columns, .sample-form-grid, .stats-grid { grid-template-columns: 1fr; }
  .sample-notes-field { grid-column: auto; }
  .ia-topbar { align-items: flex-start; flex-direction: column; }
  .settings-card, .execution-card { padding: 18px; }
  .preview-toolbar { padding: 15px; align-items: flex-start; }
  .preview-toolbar h2 { max-width: 48vw; }
  .zoom-controls output { display: none; }
  .preview-stage-shell { min-height: 395px; grid-template-columns: 37px minmax(0,1fr) 37px; }
  .preview-viewport { height: 375px; }
  .nav-button { width: 31px; height: 31px; }
  .preview-footer { padding: 12px 15px; }
  .preview-actions { padding: 12px 15px; }
  .preview-primary-actions { margin-left: auto; }
  .preview-footer > span:last-child { display: none; }
  .execution-header { align-items: flex-start; flex-direction: column; }
  .action-buttons { width: 100%; }
  .action-buttons .button { flex: 0 1 50%; padding-inline: 11px; }
  .generated-toolbar { padding: 14px; align-items: flex-start; }
  .generated-toolbar h2 { max-width: 48vw; }
  .generated-stage-shell { min-height: 505px; grid-template-columns: 37px minmax(0,1fr) 37px; }
  .generated-viewport { height: 485px; }
  .footer-bottom { min-height: 0; padding: 18px 0; flex-direction: column; align-items: flex-start; gap: 7px; }
  .footer-bottom span:last-child { text-align: left; }
}

/* Radix-inspired clean surface: low-contrast gray canvas, compact radii and quiet elevation. */
:root {
  --bg: #fcfcfd;
  --surface: #ffffff;
  --surface-solid: #ffffff;
  --text: #1f2329;
  --muted: #697386;
  --line: #e4e7ec;
  --line-strong: #cfd5df;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --navy: #0f172a;
  --light-blue: #eff6ff;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 8px 24px rgba(16, 24, 40, .06);
  --shadow-lg: 0 1px 3px rgba(16, 24, 40, .06), 0 16px 38px rgba(16, 24, 40, .08);
  --radius-lg: 12px;
  --radius-md: 8px;
}

body {
  background: var(--bg);
}

.site-header {
  border-bottom-color: var(--line);
  background: #ffffff;
  backdrop-filter: none;
}

.logout-button {
  border-radius: 8px;
  color: var(--text);
  background: #fff;
  box-shadow: 0 1px 2px rgba(16, 24, 40, .04);
}

.logout-button:hover {
  color: var(--accent);
  border-color: #b7c8ee;
  background: #fff;
}

.app-shell { padding: 32px 0 46px; }

.module-tabs {
  width: min(100%, 1080px);
  padding: 5px;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #ffffff;
  box-shadow: 0 1px 2px rgba(16, 24, 40, .04);
  backdrop-filter: none;
}

.module-tab {
  min-height: 56px;
  border-radius: 8px;
}

.module-tab.active, .module-tab[aria-selected="true"] {
  color: var(--text);
  background: #f8fbff;
  box-shadow: inset 0 0 0 1px rgba(37, 99, 235, .14), 0 1px 2px rgba(16, 24, 40, .05);
}

.module-tab:focus-visible { outline: 2px solid rgba(37, 99, 235, .35); outline-offset: 2px; }

.batch-count {
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 1px 3px rgba(16, 24, 40, .06);
}

.settings-card, .preview-card, .execution-card,
.flow-card, .construction-card, .sample-accordion {
  border-color: var(--line);
  border-radius: 12px;
  background: #fff;
  box-shadow: var(--shadow);
  backdrop-filter: none;
}

.settings-card { padding: 20px; }
.step-number { border-radius: 8px; }
.field-group { margin-top: 19px; }
.field-group > label, fieldset > legend { color: #344054; }

/* O `select` da tela de conta entra aqui junto com os campos de texto: ele
   estava com raio 12 enquanto os vizinhos tinham 8, e numa coluna de treze
   campos a diferença lê-se como defeito. Um número só, e é este. */
input:not([type]),
input[type="text"], input[type="number"],
input[type="email"], input[type="password"], input[type="tel"],
.login-field select,
.field-group select, .field-group input, .sample-file-select,
.field-inline input, .field-inline select {
  border-color: var(--line-strong);
  border-radius: 8px;
  background: #fff;
}

input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(37, 99, 235, .14); }

.button {
  min-height: 40px;
  border-radius: 8px;
  font-weight: 650;
  box-shadow: none;
}

.button:hover:not(:disabled) { transform: none; }
.button.primary { background: var(--accent); }
.button.primary:hover:not(:disabled) { background: var(--accent-hover); }
.button.ghost { border-color: var(--line); background: #fff; }
.button.ghost:hover:not(:disabled) { border-color: var(--line-strong); background: #f9fafb; }

.file-drop-zone {
  border-radius: 10px;
  background: #fbfcfe;
}

.file-drop-zone:hover, .file-drop-zone:focus-visible, .file-drop-zone.dragover {
  background: var(--light-blue);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .10);
}

.preview-toolbar {
  min-height: 64px;
  padding: 14px 18px;
}

.zoom-controls {
  border-radius: 8px;
  background: #f4f5f7;
}

.zoom-controls button { border-radius: 6px; }
.zoom-controls button:hover:not(:disabled) { background: #fff; }

.fullscreen-toggle-button {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: #f4f5f7;
}

.preview-stage-shell { background: #eef0f3; }
.preview-actions { min-height: 58px; padding: 11px 18px; }

.site-footer {
  border-top-color: var(--line);
  background: rgba(255, 255, 255, .96);
}

.footer-bottom {
  min-height: 36px;
  padding: 8px 0;
  color: #7b8494;
  font-size: .72rem;
}

@media (max-width: 640px) {
  .footer-bottom { min-height: 36px; padding: 8px 0; gap: 4px; }
}

/* Compact module navigation: icon rail by default, labels on demand. */
.app-shell {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

.app-content { min-width: 0; }

.module-sidebar {
  position: sticky;
  top: 84px;
  z-index: 40;
  width: 56px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 1px 3px rgba(16, 24, 40, .06), 0 10px 24px rgba(16, 24, 40, .05);
  transition: width .2s ease;
}

.module-sidebar.is-expanded { width: 214px; }

.module-sidebar-toggle {
  width: 42px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 8px;
  color: var(--muted);
  background: transparent;
}

.module-sidebar-toggle:hover { color: var(--accent); background: var(--light-blue); }
.module-sidebar-toggle-glyph { display: block; width: 20px; height: 20px; line-height: 1; transition: transform .2s ease; }
.module-sidebar-toggle-glyph svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.module-sidebar.is-expanded .module-sidebar-toggle-glyph { transform: rotate(180deg); }

.module-tabs {
  width: 100%;
  max-width: none;
  margin: 8px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.module-tab {
  min-height: 44px;
  width: 100%;
  padding: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border-radius: 8px;
  color: var(--muted);
  font-size: 0;
  text-align: left;
}

.module-tab::before {
  display: none;
}

.module-tab { color: transparent; }
.module-tab-icon { width: 24px; height: 24px; flex: 0 0 24px; display: grid; place-items: center; color: var(--muted); }
.module-tab-icon svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.module-tab:hover { color: transparent; background: #f8fafc; }
.module-tab:hover .module-tab-icon { color: var(--text); }
.module-tab.active, .module-tab[aria-selected="true"] { color: transparent; background: var(--light-blue); box-shadow: inset 0 0 0 1px rgba(37, 99, 235, .12); }
.module-tab.active .module-tab-icon, .module-tab[aria-selected="true"] .module-tab-icon { color: var(--accent); }
.module-tab-copy { display: none; }
.module-tab-kicker { display: none !important; }
.module-sidebar.is-expanded .module-tab { justify-content: flex-start; font-size: 0; }
.module-sidebar.is-expanded .module-tab::after { content: attr(data-label); overflow: hidden; color: var(--text); font-size: .78rem; font-weight: 650; text-overflow: ellipsis; white-space: nowrap; }


@media (max-width: 800px) {
  .app-shell { grid-template-columns: 1fr; gap: 14px; }
  .module-sidebar { position: static; width: 100%; }
  .module-sidebar-toggle { display: none; }
  .module-tabs { flex-direction: row; margin-top: 0; gap: 4px; }
  .module-tab { min-height: 54px; justify-content: center; color: var(--text); font-size: .7rem; text-align: center; }
  .module-tab-icon, .module-tab::after { display: none; }
  .module-tab-kicker { display: block !important; font-size: .54rem; }
}

/* Full-height module sidebar: Feather line icons collapsed by default, labels on demand. */
.app-shell {
  width: auto;
  max-width: none;
  margin: 0;
  padding: 32px 32px 46px 96px;
  display: block;
}
.app-content { min-width: 0; }
.module-sidebar {
  position: fixed;
  inset: 68px auto 0 0;
  z-index: 45;
  width: 64px;
  padding: 14px 10px;
  overflow: hidden;
  border: 0;
  border-right: 1px solid var(--line);
  border-radius: 0;
  background: rgba(255,255,255,.98);
  box-shadow: 5px 0 20px rgba(16,24,40,.04);
  transition: width .2s ease;
}
.module-sidebar.is-expanded { width: 236px; }
/* O recuo do conteúdo acompanha a barra PRESA, e só ela.
   A barra é `position: fixed` — ela não empurra nada, ela cobre. O recuo de
   96px foi calculado para o trilho fechado (64 + 32 de folga) e nunca
   acompanhou os 236 do aberto: com a barra presa, 140px da tela ficavam
   embaixo dela, e numa tabela isso come a primeira coluna inteira.
   Presa e não aberta: a barra também abre ao passar o mouse, e nesse estado ela
   é passageira — empurrar o conteúdo a cada passada faria a página pular sob o
   cursor. Quem abriu por engano não deveria ver a tela inteira andar.
   `min-width` porque abaixo de 800px a barra vira gaveta e a conta é outra. */
@media (min-width: 801px) {
  .app-shell { transition: padding-left .2s ease; }
  body.barra-presa .app-shell { padding-left: 268px; }
}
.module-sidebar-toggle { width: 42px; margin: 0 auto 14px; }
.module-tabs { margin-top: 0; gap: 2px; }
.module-tab {
  min-height: 46px;
  padding: 9px 10px;
  justify-content: center;
  gap: 11px;
  border-radius: 8px;
  color: var(--muted);
  font-size: 0;
  white-space: nowrap;
}
.module-tab-glyph {
  width: 21px;
  height: 21px;
  flex: 0 0 21px;
  color: currentColor;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.3;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.module-tab:hover { color: var(--text); background: #f8fafc; }
.module-tab.active, .module-tab[aria-selected="true"] { color: var(--accent); background: var(--light-blue); box-shadow: none; }
.module-tab-kicker { display: none !important; }
.module-sidebar:not(.is-expanded) .module-tab { gap: 0; }
.module-sidebar.is-expanded .module-tab { justify-content: flex-start; font-size: .8rem; font-weight: 650; }
.module-sidebar.is-expanded .module-tab { gap: 11px; }
.module-sidebar.is-expanded .module-tab::after { content: none; }

/* Breadcrumbs discretos, persistentes no topo das telas. */
.page-heading {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  margin-bottom: 18px;
}
.page-breadcrumbs {
  display: inline-flex;
  align-items: center;
  justify-self: start;
  grid-row: 1;
  gap: 8px;
  color: var(--muted);
  font-size: .75rem;
  line-height: 1;
}
.page-breadcrumbs strong { color: var(--text); font-weight: 650; }
.breadcrumb-separator { color: #b8bec8; }

/* Indicador de lote compacto: acompanha o breadcrumb sem criar uma faixa vazia. */
.page-heading .batch-count {
  min-width: 0;
  padding: 0;
  display: inline-flex;
  align-items: baseline;
  grid-column: 3;
  grid-row: 1;
  justify-self: end;
  gap: 5px;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  white-space: nowrap;
}
.page-heading .batch-count strong { color: var(--text); font-size: .82rem; letter-spacing: 0; }
.page-heading .batch-count span { color: var(--muted); font-size: .75rem; }
.page-heading .batch-count.batch-count-with-model-lock { grid-column: 2; justify-self: center; }
.page-heading .page-heading-settings-access,
.page-heading .page-heading-model-access,
.page-heading .page-heading-pipeline-access {
  grid-column: 3;
  grid-row: 1;
  justify-self: end;
}
@media (max-width: 800px) {
  .page-heading { grid-template-columns: 1fr; gap: 10px; }
  .page-heading .batch-count { grid-column: 1; grid-row: auto; justify-self: end; }
  .page-heading .batch-count.batch-count-with-model-lock { grid-column: 1; justify-self: center; }
  .page-heading .page-heading-settings-access,
  .page-heading .page-heading-model-access,
  .page-heading .page-heading-pipeline-access { grid-column: 1; grid-row: auto; justify-self: start; }
}

/* Each navigation item is now a first-class screen; legacy inner tab bars stay hidden. */
#tabPanelConversor > .inner-tabs,
#tabPanelResultados > .inner-tabs { display: none; }
#tabPanelEstatisticas > .inner-tabs { display: flex; }
#statsReprocessTab { display: none; }
#tabPanelEstatisticas.is-reprocess-screen > .inner-tabs { display: none; }

@media (max-width: 800px) {
  .app-shell { width: min(100% - 20px, 1240px); margin-inline: auto; padding: 28px 0 46px; }
  .module-sidebar { position: static; inset: auto; width: 100%; padding: 6px; border: 1px solid var(--line); border-radius: 12px; box-shadow: none; }
  .module-sidebar.is-expanded { width: 100%; }
  .module-sidebar-toggle { display: none; }
  .module-tabs { flex-direction: row; gap: 4px; }
  .module-tab { min-height: 54px; justify-content: center; color: var(--text); font-size: .7rem; text-align: center; }
  .module-tab-glyph { display: none; }
  .module-tab-kicker { display: block !important; font-size: .54rem; }
}

/* ============================================================
   Dados esperados de livro
   ============================================================ */

.modal-fullscreen {
  max-width: none;
  width: 96vw;
  height: 92vh;
  max-height: none;
  padding: 0;
  overflow: hidden;
}

.expected-data-card {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 0;
  gap: 0;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--color-border);
  flex-shrink: 0;
}

.modal-header h2 {
  margin: 0;
  font-size: 1rem;
}

.expected-data-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 0;
  flex: 1;
  overflow: hidden;
}

.expected-data-sidebar {
  overflow-y: auto;
  border-right: 1px solid var(--color-border);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.expected-data-sidebar h3 {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-muted);
  margin: 12px 0 6px;
}

.expected-data-sidebar h3:first-child { margin-top: 0; }
.expected-data-sidebar .field-group:first-child { margin-top: 0; }

.expected-data-main {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 16px;
  gap: 12px;
}

.expected-data-toolbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  flex-shrink: 0;
}

.expected-data-import-group {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 10px;
}

.expected-data-actions-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.icon-close-button {
  width: 34px;
  height: 34px;
  flex: none;
  display: grid;
  place-items: center;
  border: none;
  border-radius: 50%;
  color: var(--text);
  background: transparent;
  cursor: pointer;
}
.icon-close-button:hover { background: #f0f0f2; }
.icon-close-button svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }

.expected-terms-table-wrap {
  flex: 1;
  overflow-y: auto;
}

.expected-terms-table-wrap table {
  width: 100%;
}
#bookRegistryTermsTable { table-layout: fixed; }
#bookRegistryTermsTable th:nth-child(1),
#bookRegistryTermsTable td:nth-child(1) { width: 92px; }
#bookRegistryTermsTable th:nth-child(2),
#bookRegistryTermsTable td:nth-child(2) { width: 128px; }

.editable-cell {
  cursor: text;
  min-height: 1.4em;
  padding: 3px 6px;
  border-radius: 2px;
}

.editable-cell:focus {
  outline: 2px solid var(--color-accent);
  background: var(--color-bg-secondary);
}

.term-range-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.term-range-row input[type="number"] {
  width: 80px;
  padding: 4px 6px;
  font-size: 0.82rem;
}

.term-range-remove {
  background: none;
  border: none;
  color: var(--color-muted);
  cursor: pointer;
  padding: 2px 4px;
  font-size: 1rem;
  line-height: 1;
}

.term-range-remove:hover { color: var(--color-danger); }

.badge-nomes {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
}

.badge-nome {
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.badge-nome.selectable { cursor: pointer; }

.badge-nome.selected {
  background: #ffe066;
  color: var(--accent);
}

.termo-range-mismatch {
  font-size: 0.72rem;
  color: var(--color-muted);
  display: block;
  margin: 0;
}

.termo-range-update { background: #fff; }
.termo-range-apply { font-size: 0.72rem; }

.small-link {
  font-size: 0.8rem;
  color: var(--color-accent);
  text-decoration: underline;
  cursor: pointer;
}

.ext3-panel { display: grid; gap: 16px; }
.ext3-summary-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.ext3-warning { margin: 0; padding: 12px 14px; border: 1px solid #f5c26b; border-radius: 9px; background: #fff8e8; color: #713f12; }
.ext3-flow-steps { display: flex; flex-wrap: wrap; gap: 8px 22px; margin: 12px 0 0; padding-left: 20px; color: var(--color-muted); }
.ext3-books-list, .ext3-record-list, .ext3-phase-controls { display: grid; gap: 8px; }
.ext3-book-group { border: 1px solid var(--color-border); border-radius: 9px; padding: 8px 12px; background: #fff; }
.ext3-book-group summary { cursor: pointer; font-weight: 700; }
.ext3-record-list { margin-top: 8px; }
.ext3-record-row, .ext3-phase-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto auto; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid var(--color-border); }
.ext3-record-label { display: flex; align-items: center; gap: 8px; min-width: 0; }
.ext3-phase-row { grid-template-columns: 110px minmax(0, 1fr) auto auto; }
.compact-button { padding: 6px 9px; font-size: .76rem; }
.ext3-cost-summary { overflow-x: auto; }
.ext3-cost-table { width: 100%; border-collapse: collapse; }
.ext3-cost-table th, .ext3-cost-table td { padding: 8px; border-bottom: 1px solid var(--color-border); text-align: left; }
.ext3-cost-table th { color: var(--color-muted); font-size: .78rem; }

@media (max-width: 900px) {
  .pipeline-method-grid, .pipeline-builder-grid { grid-template-columns: 1fr; }
  .review-workbench-grid { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .pipeline-funnel { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pipeline-dashboard-card, .pipeline-builder, .pipeline-review-workbench,
  .review-workbench-grid, .review-result-pane, .review-image-pane { min-width: 0; max-width: 100%; }
  .pipeline-builder-footer { align-items: stretch; flex-direction: column; }
  .pipeline-builder-footer .button { width: 100%; }
  .pipeline-method-card { min-height: 0; }
  .review-image-frame { min-height: 220px; }
  .review-result-content { max-height: none; }
  .review-data-list { grid-template-columns: 1fr; gap: 4px; }
  .review-data-list dd { margin-bottom: 8px; }
  .compact-datatable { max-width: 100%; overflow-x: auto; }
}

@media (max-width: 900px) {
  .ext3-summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ext3-phase-row { grid-template-columns: 1fr 1fr; }
  .ext3-phase-row .field-note { grid-column: 1 / -1; }
}

@media (max-width: 640px) {
  .expected-data-layout { grid-template-columns: 1fr; }
  .expected-data-sidebar { border-right: none; border-bottom: 1px solid var(--color-border); max-height: 240px; }
}

/* Final mobile navigation overrides (kept last so legacy responsive rules
   cannot turn the Feather sidebar back into horizontal tabs). */
@media (max-width: 800px) {
  .app-shell { width: 100%; max-width: none; margin: 0; padding: 18px 10px 42px; display: block; }
  .app-content, .tab-panel, .converter-flow, .workspace-grid, .flow-card { min-width: 0; max-width: 100%; }
  .module-sidebar {
    position: fixed;
    inset: 60px auto 0 0;
    z-index: 100;
    width: min(84vw, 282px);
    height: calc(100vh - 60px);
    padding: 16px 12px 24px;
    overflow-y: auto;
    border: 0;
    border-right: 1px solid var(--line);
    border-radius: 0;
    background: #fff;
    box-shadow: 14px 0 36px rgba(15, 23, 42, .14);
    transform: translateX(-105%);
    transition: transform .22s ease;
  }
  .module-sidebar.mobile-open { width: min(84vw, 282px); transform: translateX(0); }
  .module-sidebar-toggle { display: none; }
  .module-tabs { width: 100%; margin: 0; display: flex; flex-direction: column; gap: 6px; }
  .module-tab, .module-sidebar.is-expanded .module-tab {
    min-height: 48px;
    width: 100%;
    justify-content: flex-start;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 9px;
    color: var(--text);
    font-size: .86rem;
    font-weight: 650;
    text-align: left;
  }
  .module-tab-glyph { display: block; width: 21px; height: 21px; flex: 0 0 21px; }
  .module-tab-kicker { display: none !important; }
  .module-sidebar.is-expanded .module-tab::after { content: none; }
  .module-tab:hover { color: var(--text); background: #f8fafc; }
  .module-tab.active, .module-tab[aria-selected="true"] { color: var(--accent); background: var(--light-blue); box-shadow: none; }
  body.mobile-nav-open::after { content: ""; position: fixed; inset: 60px 0 0; z-index: 80; pointer-events: none; background: rgba(15, 23, 42, .24); }
  .page-heading { grid-template-columns: minmax(0, 1fr); gap: 10px; align-items: start; }
  .page-heading .batch-count { grid-column: 1; justify-self: center; }
  .page-heading .page-heading-settings-access,
  .page-heading .page-heading-model-access,
  .page-heading .page-heading-pipeline-access { grid-column: 1; justify-self: start; }
  .submission-row { grid-template-columns: minmax(0, 1fr); }
  .submission-row .button, .submission-row .icon-lock-button { width: 100%; }
  .responsive-table { max-width: 100%; overflow-x: auto; }
  img, canvas, video { max-width: 100%; }
}

@media (max-width: 420px) {
  .brand-row { gap: 6px; }
  .mobile-nav-toggle, .logout-button { width: 38px; flex-basis: 38px; }
  .logo { max-height: 36px; }
  .app-shell { padding-inline: 8px; }
  .flow-card { padding: 16px; }
}

/* ==== BEGIN F7B PHASE EXECUTION (sprint f5-f7) ==== */
.f7b-phase-execution-card { display: flex; flex-direction: column; gap: 18px; margin-top: 18px; }
.f7b-selection-row { display: flex; flex-direction: column; gap: 10px; padding: 14px; border: 1px solid var(--line); border-radius: var(--radius-md, 10px); background: #fafbfc; }
.f7b-scope-toggle { display: flex; gap: 10px; flex-wrap: wrap; }
.f7b-scope-toggle .pipeline-method-card { flex: 1 1 220px; }
.f7b-selection-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.f7b-chain-row { display: flex; gap: 10px; flex-wrap: wrap; }
.f7b-chain-node { flex: 1 1 160px; display: flex; flex-direction: column; gap: 6px; padding: 12px; border: 1px solid var(--line); border-radius: var(--radius-md, 10px); background: var(--surface); }
.f7b-chain-node-readonly { background: #fdecea11; opacity: .92; }
.f7b-preflight-panel, .f7b-progress-panel { display: flex; flex-direction: column; gap: 12px; padding: 14px; border: 1px solid var(--line); border-radius: var(--radius-md, 10px); }
.f7b-preflight-grid dt { font-size: .72rem; color: var(--muted); }
.f7b-anomalies ul { margin: 4px 0 0; padding-left: 18px; }
.f7b-preflight-actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }
.f7b-progress-bar { width: 100%; height: 10px; border-radius: 999px; background: #eef2f6; overflow: hidden; }
.f7b-progress-bar-fill { height: 100%; background: var(--blue, #2563eb); transition: width .2s ease; }
.f7b-items-section table td, .f7b-items-section table th { vertical-align: top; }
.f7b-item-wire-canonical { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.f7b-item-wire-canonical pre { margin: 0; max-height: 140px; overflow: auto; font-size: .72rem; background: #f8fafc; padding: 6px; border-radius: 6px; }
.f7b-canonical-blocked-note { color: var(--danger); font-size: .74rem; }
.f7b-import-section { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.f7b-blocked-list { margin: 0; padding-left: 18px; }
.f7b-authority-footer { border-top: 1px dashed var(--line); padding-top: 10px; }
/* ==== END F7B PHASE EXECUTION ==== */

/* ==== Card 3 "Resultados" (Onda 4 Agente 3/4) — fileira de fases F1-F6 e
   painel de conteúdo por fase. O visualizador de imagem em si reaproveita
   as classes genéricas já usadas por #pipelineResultsDialog (result-split-
   container, pipeline-result-*, preview-viewport, zoom-controls etc.), só a
   fileira de fases e o conteúdo por fase precisam de CSS próprio. */
.resultados-nova-phase-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0; }
.resultados-nova-phase-pill {
  display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface); color: var(--text); cursor: pointer;
  font-size: .8rem; font-weight: 600;
}
.resultados-nova-phase-pill svg { width: 15px; height: 15px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.resultados-nova-phase-pill.is-done { background: #eaf7f0; border-color: #bfe6cf; color: var(--success); }
.resultados-nova-phase-pill.is-required { background: #fff3e6; border-color: #f5c98c; color: #b45309; }
.resultados-nova-phase-pill.is-pending { background: #fffbe6; border-color: #f0e2a3; color: #92720c; }
.resultados-nova-phase-pill.is-active { box-shadow: 0 0 0 2px rgba(37,99,235,.28); }
.resultados-nova-phase-pill:hover { filter: brightness(.97); }
#resultadosNovaImageCol.is-fullscreen {
  position: fixed; inset: 0; z-index: 1000; background: #fff;
  display: flex; flex-direction: column;
}
#resultadosNovaImageCol.is-fullscreen .preview-stage-shell { flex: 1; min-height: 0; }
#resultadosNovaImageCol.is-fullscreen .preview-viewport { height: 100%; }
.resultados-nova-phase-section { margin-bottom: 18px; }
.resultados-nova-phase-section:last-child { margin-bottom: 0; }
.resultados-nova-content-tabs { margin-bottom: 14px; }
.resultados-nova-content-tabs .inner-tab { padding: 8px 12px; font-size: .82rem; }
.resultados-nova-phase-section textarea {
  width: 100%; min-height: 260px; resize: vertical; font-family: inherit;
  font-size: .88rem; line-height: 1.55; padding: 10px; border: 1px solid var(--line); border-radius: 12px;
  background: transparent; color: var(--text);
}
.resultados-nova-phase-placeholder { color: var(--muted); font-style: italic; padding: 14px; border: 1px dashed var(--line); border-radius: 12px; }
.resultados-nova-raw-json {
  max-height: 320px; max-width: 100%; overflow: auto; box-sizing: border-box;
  white-space: pre-wrap; word-break: break-word; overflow-wrap: anywhere;
  border: 1px solid var(--line); border-radius: 12px; padding: 10px; margin: 0;
}
.resultados-nova-phase-section, #resultadosNovaPhaseContent, #resultadosNovaSplit > * { min-width: 0; }
.resultados-nova-phase-section .recursive-json { max-width: 100%; overflow-x: auto; }
.resultados-nova-image-col-wrap { display: flex; flex-direction: column; min-width: 0; }
.resultados-nova-image-col-wrap > .sample-call-details { margin-top: 10px; }

/* O DDI e o número, do desenho: 9px entre os dois, o alvo com 49px de altura
   e 11px de folga lateral, bandeira redonda de 21px. */
.ddi-par { display: flex; gap: 9px }
.ddi-alvo {
  position: relative; display: flex; align-items: center; gap: 7px; flex: none;
  min-height: 49px; padding: 0 11px; border: 1px solid var(--line);
  border-radius: 12px; background: rgba(255,255,255,.94); cursor: pointer;
  font-size: .92rem;
}
/* O `<select>` de verdade fica por cima, invisível: quem clica em qualquer
   ponto do alvo abre a lista do sistema — no celular, a roda; no computador, a
   busca por digitação que o navegador já tem. Desenhar a nossa lista seria
   refazer pior o que o aparelho faz melhor. */
.ddi-alvo select {
  position: absolute; inset: 0; width: 100%; height: 100%;
  opacity: 0; border: 0; cursor: pointer; font-size: 16px;
}
.ddi-par input { flex: 1 1 auto; min-width: 0 }
/* A ajuda embaixo do campo. A força extra é contra `.login-field > span`, que
   é o RÓTULO — .78rem e peso 750 — e vem antes: sem ela, a frase de ajuda saía
   com o mesmo peso do rótulo e as duas competiam. */
.login-field > span.login-nota { font-size: .72rem; font-weight: 400; color: var(--muted) }

/* O quadrado do ícone: 42px, raio 11px, fundo azul claro. É o que separa uma
   tela da outra num conjunto em que todas são um cartão com campos. */
.conta-icone {
  width: 42px; height: 42px; border-radius: 11px; display: grid; place-items: center;
  background: var(--light-blue); margin-bottom: 16px;
}
.conta-icone svg { width: 20px; height: 20px; fill: none; stroke: var(--accent); stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round }
.conta-icone.aviso { background: #fef3c7 }
.conta-icone.aviso svg { stroke: #b45309 }
