/*
 * Diagnóstico de Pré-Onboarding — FS Finance
 * Tokens e linguagem visual da apresentação oficial do BPO Financeiro:
 * fundo claro prateado, kicker com traço, títulos Archivo em caixa alta, vidro, quadrados navy numerados.
 */

/* ── fontes servidas pelo próprio site (origem, versão e licença em fonts/LEIAME.txt) ──
 * Os mesmos arquivos variáveis que o Google Fonts entregava, só nos subconjuntos latin e latin-ext:
 * nenhuma requisição sai para terceiros (LGPD) e a CSP fica em font-src 'self'. O latin-ext só é
 * baixado se a página exibir um caractere da faixa dele. */
@font-face {
  font-family: 'Archivo';
  font-style: normal;
  font-weight: 600 900;
  font-stretch: 100%;
  font-display: swap;
  src: url('fonts/archivo-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Archivo';
  font-style: normal;
  font-weight: 600 900;
  font-stretch: 100%;
  font-display: swap;
  src: url('fonts/archivo-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url('fonts/inter-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url('fonts/inter-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  /* marca (apresentação) */
  --ink: #0a1f3a;
  --navy: #0a2a4a;
  --steel: #2d5f8a;
  --muted: #5f6f83;
  --muted-2: #8b97a8;
  --azul-escuro: #17334e;
  --azul-medio: #123b65;
  --azul-vivo: #0879c6;
  --bg: #ffffff;
  --bg2: #f4f7fb;
  --panel-2: #d7dee8;
  --line: rgba(10, 31, 58, .14);
  --line-2: rgba(10, 31, 58, .24);

  /* derivados */
  --borda-campo: rgba(10, 31, 58, .5);   /* >= 3:1 sobre branco (WCAG 1.4.11) */
  --borda-campo-hover: rgba(10, 31, 58, .7);
  --placeholder: #66768a;                /* 4.6:1 sobre branco */
  --steel-tint: rgba(45, 95, 138, .07);
  --steel-line: rgba(45, 95, 138, .24);
  --navy-dim: rgba(10, 42, 74, .10);
  --erro: #b42318;
  --erro-bg: #fef4f3;
  --erro-line: rgba(180, 35, 24, .32);

  --ff-title: 'Archivo', 'Arial', sans-serif;
  --ff-body: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;

  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 18px;
  --r-pill: 999px;

  --sombra-vidro: inset 0 1px 0 rgba(255, 255, 255, .86), 0 18px 42px rgba(10, 31, 58, .13);
  --sombra-leve: 0 1px 2px rgba(10, 31, 58, .06), 0 8px 20px rgba(10, 31, 58, .07);
  --sombra-quadrado: 0 6px 14px rgba(10, 42, 74, .22);
  --anel: 0 0 0 3px rgba(45, 95, 138, .26);
  --anel-erro: 0 0 0 3px rgba(180, 35, 24, .18);

  --ease-out: cubic-bezier(.23, 1, .32, 1);
  --t-rapido: 160ms;
  --t-medio: 220ms;

  --campo-h: 3rem;
  --lateral: 15.5rem;
  --vao: 3.5rem;
  --pad: 2.5rem;
}

/* ── base ─────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 1.5rem;
  scrollbar-color: rgba(10, 31, 58, .28) transparent;
  accent-color: var(--navy);
}

body {
  position: relative;
  margin: 0;
  min-height: 100vh;
  font-family: var(--ff-body);
  font-size: 1rem;
  line-height: 1.55;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  caret-color: var(--steel);
}

/* fundo prateado com brilho frio + linhas diagonais (igual ao deck) */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(900px 640px at 12% 4%, rgba(156, 169, 186, .20), transparent 62%),
    radial-gradient(760px 520px at 98% 18%, rgba(10, 42, 74, .13), transparent 64%),
    linear-gradient(135deg, #ffffff 0%, #ffffff 58%, #f1f4f8 100%);
}

body::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: .42;
  background-image: repeating-linear-gradient(125deg, rgba(10, 31, 58, .035) 0 1px, transparent 1px 120px);
}

::selection { background: var(--navy); color: #fff; }

img { max-width: 100%; height: auto; display: block; }

a {
  color: var(--steel);
  text-decoration-thickness: 1px;
  text-underline-offset: .2em;
}

a:focus-visible,
button:focus-visible,
[tabindex="-1"]:focus-visible {
  outline: 2px solid var(--steel);
  outline-offset: 3px;
  border-radius: 6px;
}

p { margin: 0; }

h1, h2, h3 {
  margin: 0;
  font-family: var(--ff-title);
  color: var(--ink);
  text-wrap: balance;
}

code {
  font-family: ui-monospace, 'Cascadia Code', Consolas, monospace;
  font-size: .875em;
  padding: .1em .4em;
  border-radius: 5px;
  background: rgba(10, 31, 58, .07);
  color: var(--ink);
}

[hidden] { display: none !important; }

.sr {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* antispam: campo-armadilha fora da tela. Não usa display:none, que muito robô reconhece e pula;
   quem usa teclado ou leitor de tela não chega nele (tabindex -1 e aria-hidden no HTML). */
.armadilha {
  position: absolute;
  left: -10000px;
  top: auto;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.ico {
  width: 1.125rem;
  height: 1.125rem;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.pular {
  position: absolute;
  left: 1rem;
  top: -4rem;
  z-index: 100;
  padding: .625rem 1rem;
  border-radius: var(--r-sm);
  background: var(--navy);
  color: #fff;
  font-weight: 600;
  text-decoration: none;
  transition: top var(--t-rapido) var(--ease-out);
}
.pular:focus { top: 1rem; }

.sem-js {
  position: relative;
  z-index: 2;
  max-width: 40rem;
  margin: 2rem auto;
  padding: 1rem 1.25rem;
  border-radius: var(--r-md);
  background: var(--erro-bg);
  border: 1px solid var(--erro-line);
}

/* logo como marca d'água clara no canto inferior direito */
.marca-dagua {
  position: fixed;
  right: -7rem;
  bottom: -5.75rem;
  z-index: 0;
  width: 30rem;
  height: 20.625rem;
  pointer-events: none;
  background: url('img/logo-fs-finance.png') no-repeat center / contain;
  opacity: .07;
  filter: grayscale(1) saturate(.35) contrast(1.08);
}

/* ── vidro, kicker, quadrados ─────────────────────────────────────────── */
.vidro {
  background: linear-gradient(160deg, rgba(10, 31, 58, .045), rgba(255, 255, 255, .62));
  border: 1px solid var(--line);
  box-shadow: var(--sombra-vidro);
}

.kicker {
  display: flex;
  align-items: center;
  gap: .625rem;
  margin: 0 0 .875rem;
  font-family: var(--ff-title);
  font-size: .75rem;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: .36em;
  text-transform: uppercase;
  color: var(--steel);
}
.kicker::after {
  content: '';
  flex: 0 0 1.875rem;
  height: 2px;
  background: var(--navy);
  opacity: .6;
}
.kicker .ico { width: 1.25rem; height: 1.25rem; stroke-width: 1.6; }
.kicker-sm { font-size: .6875rem; letter-spacing: .3em; margin-bottom: .75rem; }

.num-quadrado {
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  flex: none;
  border-radius: var(--r-sm);
  background: var(--navy);
  color: #fff;
  font-family: var(--ff-title);
  font-size: .9375rem;
  font-weight: 800;
  line-height: 1;
  box-shadow: var(--sombra-quadrado);
}
.num-quadrado .ico { width: 1rem; height: 1rem; stroke-width: 2; }

/* ── estrutura ────────────────────────────────────────────────────────── */
.casca {
  position: relative;
  z-index: 1;
  max-width: 84rem;
  margin: 0 auto;
  padding: var(--pad) var(--pad) 0;
}

.topo,
.corpo {
  display: grid;
  grid-template-columns: var(--lateral) minmax(0, 60rem);
  column-gap: var(--vao);
  align-items: start;
}

.topo { padding: 1rem 0 3.5rem; }

.topo-logo img { width: 10rem; }

.topo h1 {
  font-size: 2.75rem;
  font-weight: 800;
  line-height: 1.04;
  letter-spacing: -.01em;
  text-transform: uppercase;
}

.inteira { white-space: nowrap; }

.topo-sub {
  margin-top: .75rem;
  font-size: 1.0625rem;
  color: var(--muted);
}

.topo-intro {
  max-width: 64ch;
  margin-top: 1.25rem;
  font-size: 1.0625rem;
  line-height: 1.65;
}

.topo-fatos {
  display: flex;
  flex-wrap: wrap;
  gap: .625rem 1.75rem;
  margin: 1.75rem 0 0;
  padding: 0;
  list-style: none;
  font-size: .875rem;
  color: var(--muted);
}
.topo-fatos li { display: flex; align-items: center; gap: .5rem; }
.topo-fatos .ico { color: var(--steel); width: 1rem; height: 1rem; }
.req-mark { color: var(--steel); font-weight: 800; font-size: 1rem; line-height: 1; }

.principal { grid-column: 2; min-width: 0; }
.concluido .topo-intro,
.concluido .topo-fatos { display: none; }

/* ── índice lateral (desktop) / barra compacta (mobile) ───────────────── */
.indice {
  position: sticky;
  top: 1.5rem;
  z-index: 5;
}

.indice-atual { display: none; }

.indice-total { font-size: .9375rem; color: var(--muted); }
.indice-total strong {
  font-family: var(--ff-title);
  font-size: 1.75rem;
  font-weight: 800;
  line-height: 1;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.indice-trilha { display: none; }

.indice-lista {
  display: grid;
  gap: .125rem;
  margin: 1.25rem 0 0;
  padding: 0;
  list-style: none;
}

.indice-item {
  display: grid;
  grid-template-columns: 2rem minmax(0, 1fr) auto;
  align-items: center;
  column-gap: .75rem;
  padding: .5rem .625rem .5rem .5rem;
  border-radius: 10px;
  color: var(--ink);
  font-size: .9375rem;
  font-weight: 500;
  line-height: 1.3;
  text-decoration: none;
  transition: background-color var(--t-rapido) ease, box-shadow var(--t-rapido) ease;
}
.indice-item .num-quadrado {
  background: var(--panel-2);
  color: var(--navy);
  box-shadow: none;
  transition: background-color var(--t-rapido) ease, color var(--t-rapido) ease;
}
.indice-item[aria-current] {
  background: rgba(255, 255, 255, .88);
  box-shadow: var(--sombra-leve);
  font-weight: 600;
}
.indice-item[aria-current] .num-quadrado,
.indice-item.completo .num-quadrado {
  background: var(--navy);
  color: #fff;
  box-shadow: var(--sombra-quadrado);
}
.indice-cont {
  font-size: .8125rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.indice-item.completo .indice-cont { color: var(--steel); font-weight: 700; }
.indice-erros {
  grid-column: 2 / -1;
  margin-top: .125rem;
  font-size: .8125rem;
  font-weight: 600;
  color: var(--erro);
}

.indice-salvo {
  margin-top: 1.25rem;
  padding-left: .5rem;
  font-size: .8125rem;
  line-height: 1.45;
  color: var(--muted);
}

/* ── avisos no topo do formulário ─────────────────────────────────────── */
.aviso-rascunho {
  display: flex;
  align-items: flex-start;
  gap: .875rem;
  margin-bottom: 2rem;
  padding: 1rem 1rem 1rem 1.125rem;
  border-radius: var(--r-md);
  background: rgba(255, 255, 255, .9);
  border: 1px solid var(--steel-line);
  box-shadow: var(--sombra-leve);
}
.aviso-rascunho > .ico { margin-top: .15rem; color: var(--steel); }
.aviso-rascunho.confirmando { border-color: var(--erro-line); }
.aviso-rascunho.confirmando > .ico { color: var(--erro); }
.aviso-rascunho-texto { flex: 1; min-width: 0; font-size: .9375rem; line-height: 1.5; }
.aviso-rascunho-titulo { font-weight: 700; margin-bottom: .125rem; }
.aviso-rascunho-acoes { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }

.resumo-erros {
  margin-bottom: 2rem;
  padding: 1.25rem 1.5rem;
  border-radius: var(--r-md);
  background: var(--erro-bg);
  border: 1px solid var(--erro-line);
}
.resumo-erros:focus { outline: 2px solid var(--erro); outline-offset: 3px; }
.resumo-erros-titulo {
  font-weight: 700;
  color: var(--erro);
}
.resumo-erros ul {
  display: grid;
  gap: .375rem;
  margin: .75rem 0 0;
  padding-left: 1.125rem;
}
.resumo-erros li { font-size: .9375rem; line-height: 1.45; }
.resumo-erros li::marker { color: var(--erro); }
.resumo-erros a { color: var(--ink); text-decoration: none; }
.resumo-onde { font-weight: 600; text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: .2em; }
.resumo-erros a:hover .resumo-onde { text-decoration-thickness: 2px; }
.resumo-onde::after { content: ': '; font-weight: 400; }

/* ── blocos ───────────────────────────────────────────────────────────── */
.bloco { margin-top: 4.5rem; }
.bloco:first-child { margin-top: 0; }
.bloco:focus { outline: none; }

.bloco-cabeca { margin-bottom: 1.5rem; }
.bloco-cabeca h2 {
  font-size: 1.75rem;
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -.005em;
  text-transform: uppercase;
}
.bloco-cabeca .nota { margin-top: 1.125rem; }

.painel {
  display: grid;
  gap: 2rem;
  padding: 2.5rem 2.75rem;
  border-radius: var(--r-lg);
}
.painel > * { min-width: 0; }

.nota {
  display: flex;
  gap: .75rem;
  padding: 1rem 1.125rem;
  border-radius: var(--r-md);
  background: var(--steel-tint);
  border: 1px solid var(--steel-line);
  font-size: .9375rem;
  line-height: 1.62;
}
.nota > .ico { margin-top: .2rem; color: var(--steel); }
.painel .nota { border-color: transparent; }
.nota p { max-width: 74ch; }

/* ── perguntas ────────────────────────────────────────────────────────── */
fieldset { margin: 0; padding: 0; border: 0; min-width: 0; }
legend { padding: 0; max-width: 100%; }

.q { min-width: 0; }
.q > :where(* + *) { margin-top: .5rem; }

.q-rotulo {
  display: block;
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.4;
  color: var(--ink);
}
.q-rotulo + .q-ajuda { margin-top: .25rem; }
.req { color: var(--steel); font-weight: 800; }

.q-ajuda {
  font-size: .9375rem;
  line-height: 1.5;
  color: var(--muted);
}

.q-subrotulo {
  display: block;
  margin-bottom: .375rem;
  font-size: .875rem;
  font-weight: 500;
  color: var(--ink);
}

.tag {
  display: inline-block;
  margin-left: .25rem;
  padding: .1875rem .5625rem;
  border-radius: var(--r-pill);
  font-family: var(--ff-title);
  font-size: .625rem;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: .14em;
  text-transform: uppercase;
  vertical-align: .15em;
  white-space: nowrap;
}
.tag-obrigatorio {
  color: var(--navy);
  background: var(--navy-dim);
  border: 1px solid rgba(45, 95, 138, .3);
}
.tag-se-houver {
  color: var(--muted);
  background: rgba(255, 255, 255, .7);
  border: 1px solid var(--line-2);
}

/* campos */
.campo {
  display: block;
  width: 100%;
  min-height: var(--campo-h);
  margin: 0;
  padding: .6875rem .875rem;
  border: 1px solid var(--borda-campo);
  border-radius: var(--r-md);
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 1rem;
  line-height: 1.4;
  -webkit-appearance: none;
  appearance: none;
  transition: border-color var(--t-rapido) ease, box-shadow var(--t-rapido) ease;
}
.campo::placeholder { color: var(--placeholder); opacity: 1; }
.campo:focus {
  outline: 2px solid transparent;
  border-color: var(--steel);
  box-shadow: var(--anel);
}
.campo[aria-invalid="true"] { border-color: var(--erro); }
.campo[aria-invalid="true"]:focus { box-shadow: var(--anel-erro); }

.campo-textoLongo {
  min-height: 6.25rem;
  resize: none;
  overflow: hidden;
  line-height: 1.5;
}

.campo-data { font-variant-numeric: tabular-nums; }
.campo-data::-webkit-date-and-time-value { text-align: left; }
.campo-data::-webkit-calendar-picker-indicator { opacity: .6; cursor: pointer; }

.campo-inteiro,
.campo-moeda { font-variant-numeric: tabular-nums; }

.campo-cnpj { text-transform: uppercase; letter-spacing: .02em; }
.campo-cnpj::placeholder { text-transform: none; letter-spacing: 0; }

.moeda { position: relative; }
.moeda-prefixo {
  position: absolute;
  left: .875rem;
  top: 50%;
  transform: translateY(-50%);
  font-weight: 500;
  color: var(--muted);
  pointer-events: none;
}
.moeda .campo { padding-left: 2.625rem; }

/* larguras que sugerem o tamanho da resposta */
.q-texto > .campo,
.q-email > .campo { max-width: 36rem; }
.q-cnpj > .campo,
.q-telefone > .campo,
.q-inteiro > .campo,
.q-data > .campo,
.q-moeda > .moeda { max-width: 18rem; }
.grupo-grade .q > .campo,
.grupo-grade .q > .moeda { max-width: none; }

@media (hover: hover) and (pointer: fine) {
  .campo:hover:not(:focus) { border-color: var(--borda-campo-hover); }
}

/* numéricos em sequência: duas colunas, rótulos alinhados pela base (subgrid) */
.linha-curta {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 15rem), 1fr));
  column-gap: 2rem;
  row-gap: 0;
  max-width: 42rem;
  margin-top: -2rem;
}
.linha-curta > .q {
  display: grid;
  grid-row: span 3;
  grid-template-rows: subgrid;
  row-gap: 0;
  align-content: start;
}
.linha-curta > .q > * { margin-top: 0; }
.linha-curta > .q > .q-cabeca { align-self: end; padding: 2rem 0 .5rem; }
.linha-curta > .q > .erro { margin-top: .4375rem; }
.linha-curta .q > .campo,
.linha-curta .q > .moeda { max-width: none; }

/* chips (escolha única e múltipla) */
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  margin-top: .625rem;
}

.chip {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  min-height: 2.75rem;
  padding: .5rem 1rem .5rem .75rem;
  border: 1px solid var(--borda-campo);
  border-radius: var(--r-pill);
  background: #fff;
  color: var(--ink);
  font-size: .9375rem;
  font-weight: 500;
  line-height: 1.25;
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition: background-color var(--t-rapido) ease, border-color var(--t-rapido) ease,
    color var(--t-rapido) ease, transform var(--t-rapido) var(--ease-out);
}
.chip:active { transform: scale(.97); }

.chip-input {
  position: absolute;
  left: 1rem;
  top: 50%;
  width: 1px;
  height: 1px;
  margin: 0;
  opacity: 0;
  pointer-events: none;
}

.chip-marca {
  display: grid;
  place-items: center;
  width: 1.125rem;
  height: 1.125rem;
  flex: none;
  border: 1.5px solid var(--borda-campo);
  border-radius: 50%;
  background: #fff;
  color: var(--navy);
  transition: background-color var(--t-rapido) ease, border-color var(--t-rapido) ease;
}
.chips-multi .chip-marca { border-radius: 5px; }
.chip-marca .ico {
  width: .75rem;
  height: .75rem;
  stroke-width: 3.2;
  opacity: 0;
  transform: scale(.6);
  transition: opacity var(--t-rapido) ease, transform var(--t-rapido) var(--ease-out);
}

.chip:has(.chip-input:checked) {
  background: var(--navy);
  border-color: var(--navy);
  color: #fff;
}
.chip-input:checked + .chip-marca { border-color: #fff; }
.chip-input:checked + .chip-marca .ico { opacity: 1; transform: none; }
.chip:has(.chip-input:focus-visible) {
  outline: 2px solid var(--steel);
  outline-offset: 3px;
}
.com-erro > .chips .chip:not(:has(:checked)) { border-color: var(--erro); }

@media (hover: hover) and (pointer: fine) {
  .chip:hover { border-color: var(--steel); }
  .chip:has(.chip-input:checked):hover { background: var(--azul-medio); border-color: var(--azul-medio); }
}

/* campo condicional (Outro / detalhe) */
.cond {
  margin-top: 1rem;
  padding-left: 1rem;
  border-left: 1px solid var(--steel-line);
  opacity: 1;
  transform: none;
  transition: opacity var(--t-medio) var(--ease-out), transform var(--t-medio) var(--ease-out);
}
@starting-style {
  .cond { opacity: 0; }
}
@media (prefers-reduced-motion: no-preference) {
  @starting-style {
    .cond { opacity: 0; transform: translateY(-6px); }
  }
}
.cond .q-texto > .campo { max-width: 36rem; }

/* grupo (subcampos lado a lado) */
.grupo-grade {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 12rem), 1fr));
  gap: 1rem 1rem;
  margin-top: .625rem;
}
.grupo-grade:has(textarea) { grid-template-columns: minmax(9rem, 12rem) minmax(0, 1fr); }
.grupo-grade .q-rotulo {
  font-size: .875rem;
  font-weight: 500;
}

/* 3 meses */
.mensal-grade {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
  max-width: 44rem;
  margin-top: .625rem;
}

.q-aviso {
  max-width: 44rem;
  font-size: .875rem;
  line-height: 1.5;
  color: var(--steel);
  font-weight: 500;
}

/* erro inline */
.erro {
  display: flex;
  align-items: flex-start;
  gap: .375rem;
  font-size: .875rem;
  font-weight: 500;
  line-height: 1.45;
  color: var(--erro);
  white-space: pre-line;
}
.q > .erro { margin-top: .4375rem; }
.erro .ico { width: 1rem; height: 1rem; margin-top: .1em; stroke-width: 2; }

/* ── 4.1 repetidor ────────────────────────────────────────────────────── */
.q-rep {
  padding-top: 2rem;
  border-top: 1px solid var(--line);
}
.rep-titulo {
  font-size: 1.125rem;
  font-weight: 700;
  line-height: 1.3;
}
.q-rep > .nota { margin-top: .875rem; }

.rep {
  container-type: inline-size;
  margin-top: 1.5rem;
}

.rep-cabeca {
  display: none;
}

.rep-linhas { display: grid; gap: .75rem; }

/* celular / coluna estreita: cada título vira um cartão */
.rep-linha {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .875rem .75rem;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: rgba(255, 255, 255, .72);
  transition: opacity var(--t-medio) var(--ease-out);
}
@starting-style {
  .rep-linha { opacity: 0; }
}

.rep-id {
  grid-column: 1 / -1;
  grid-row: 1;
  display: flex;
  align-items: center;
  gap: .625rem;
  min-width: 0;
}
.rep-nome { font-weight: 600; font-size: .9375rem; white-space: nowrap; }
.rep-remover {
  grid-column: 2;
  grid-row: 1;
  justify-self: end;
}
.rep-celula { grid-column: 1 / -1; min-width: 0; }
.rep-rotulo {
  display: block;
  margin-bottom: .375rem;
  font-size: .875rem;
  font-weight: 500;
}
.rep-celula .erro { margin-top: .375rem; }

@container (min-width: 26rem) {
  .rep-celula[data-tipo="moeda"],
  .rep-celula[data-tipo="data"] { grid-column: auto; }
}

/* coluna larga: grade tipo tabela. Soma mínima das colunas (--rep-cols, app.js) = 47rem; 48rem dá folga */
@container (min-width: 48rem) {
  .rep-cabeca,
  .rep-linha {
    display: grid;
    grid-template-columns: var(--rep-cols);
    column-gap: .5rem;
  }
  .rep-cabeca {
    align-items: end;
    padding-bottom: .625rem;
    border-bottom: 1px solid var(--line);
    font-size: .8125rem;
    font-weight: 600;
    line-height: 1.3;
    color: var(--muted);
  }
  /* rótulo quebra na barra (<wbr>) ou, em último caso, dentro da palavra — nunca por cima do vizinho */
  .rep-cabeca span { min-width: 0; overflow-wrap: break-word; }
  .rep-linhas { gap: .5rem; padding-top: .75rem; }
  .rep-linha {
    align-items: start;
    row-gap: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: none;
  }
  .rep-id,
  .rep-remover,
  .rep-celula,
  .rep-celula[data-tipo] { grid-column: auto; grid-row: auto; }
  .rep-id { height: var(--campo-h); }
  .rep-remover { height: var(--campo-h); justify-self: stretch; }
  .rep-nome,
  .rep-rotulo {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }
}

.rep-acoes {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .75rem 1rem;
  margin-top: 1rem;
}
.rep-limite { font-size: .875rem; color: var(--muted); }
.rep-rodape { margin-top: .875rem; font-size: .875rem; color: var(--muted); }

/* ── Bloco 6: anexos ──────────────────────────────────────────────────── */
.anexos-info {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: .875rem 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--line);
  font-size: .875rem;
  line-height: 1.5;
  color: var(--muted);
}
.anexos-regras { flex: 1 1 22rem; }
.anexos-uso { flex: 0 1 15rem; min-width: 12rem; }
.anexos-uso strong { color: var(--ink); font-variant-numeric: tabular-nums; }
.anexos-info > .erro { flex-basis: 100%; }

/* pendência de anexo obrigatório: informa, não bloqueia (tom da .nota, nunca o vermelho de erro) */
.pendencias {
  display: flex;
  gap: .75rem;
  padding: 1rem 1.125rem;
  border-radius: var(--r-md);
  background: var(--steel-tint);
  font-size: .9375rem;
  line-height: 1.55;
  color: var(--ink);
}
.pendencias > .ico { margin-top: .2rem; color: var(--steel); }
.pendencias-texto { min-width: 0; }
.pendencias-texto > p { max-width: 64ch; }
.pendencias-titulo { font-weight: 600; }
.pendencias-lista {
  display: grid;
  gap: .25rem;
  margin: .5rem 0 .625rem;
  padding-left: 1.125rem;
}
.pendencias-lista li::marker { color: var(--steel); }
.pendencias-lista a { color: var(--ink); text-decoration-color: var(--steel-line); }
@media (hover: hover) and (pointer: fine) {
  .pendencias-lista a:hover { text-decoration-color: var(--steel); }
}

.trilha {
  height: 4px;
  margin-top: .375rem;
  border-radius: 4px;
  background: var(--panel-2);
  overflow: hidden;
}
.trilha span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--navy), var(--steel));
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 300ms var(--ease-out);
}

.q-arquivos .q-rotulo { line-height: 1.5; }

.soltar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .5rem 1rem;
  margin-top: .625rem;
  padding: .625rem;
  border: 1px dashed rgba(10, 31, 58, .34);
  border-radius: var(--r-md);
  background: rgba(255, 255, 255, .5);
  transition: border-color var(--t-rapido) ease, background-color var(--t-rapido) ease;
}
.soltar.arrastando {
  border-style: solid;
  border-color: var(--steel);
  background: var(--steel-tint);
}
.soltar-dica { font-size: .875rem; color: var(--muted); }
.com-erro > .soltar { border-color: var(--erro); }
@media (hover: none) { .soltar-dica { display: none; } }

.arquivos {
  display: grid;
  gap: .375rem;
  margin: .5rem 0 0;
  padding: 0;
  list-style: none;
}
.arquivo {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  align-items: center;
  gap: .625rem;
  min-height: 2.75rem;
  padding: .125rem .125rem .125rem .75rem; /* o botão de remover já tem 44px */
  border-radius: 10px;
  background: #fff;
  border: 1px solid var(--line);
  font-size: .9375rem;
}
.arquivo > .ico { color: var(--steel); }
.arquivo-nome { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.arquivo-tam { font-size: .8125rem; color: var(--muted); font-variant-numeric: tabular-nums; }

/* ── botões ───────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  min-height: 2.75rem;
  padding: .625rem 1.125rem;
  border: 1px solid transparent;
  border-radius: var(--r-md);
  font-family: var(--ff-body);
  font-size: .9375rem;
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background-color var(--t-rapido) ease, border-color var(--t-rapido) ease,
    color var(--t-rapido) ease, box-shadow var(--t-rapido) ease, transform var(--t-rapido) var(--ease-out);
}
.btn:active:not(:disabled):not([aria-disabled="true"]) { transform: scale(.97); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.btn-pri {
  min-height: 3.5rem;
  padding: 1rem 1.75rem;
  background: linear-gradient(180deg, var(--azul-medio), var(--navy));
  color: #fff;
  font-family: var(--ff-title);
  font-size: .875rem;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  white-space: nowrap;
  box-shadow: 0 10px 24px rgba(10, 42, 74, .26), inset 0 1px 0 rgba(255, 255, 255, .14);
}
.btn-pri[aria-disabled="true"] { cursor: progress; }

.btn-sec {
  background: #fff;
  border-color: var(--borda-campo);
  color: var(--ink);
}
.btn-sec .ico { color: var(--steel); }

.btn-perigo {
  background: var(--erro);
  color: #fff;
}

/* alvos de toque: 44px (2.75rem) também nos botões compactos */
.btn-sm { min-height: 2.75rem; padding: .4375rem .875rem; font-size: .875rem; }

.btn-icone {
  display: inline-grid;
  place-items: center;
  width: 2.75rem;
  height: 2.75rem;
  flex: none;
  padding: 0;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background-color var(--t-rapido) ease, color var(--t-rapido) ease, transform var(--t-rapido) var(--ease-out);
}
.btn-icone:active { transform: scale(.94); }

@media (hover: hover) and (pointer: fine) {
  .btn-pri:hover:not([aria-disabled="true"]) { background: linear-gradient(180deg, #17497a, var(--azul-medio)); }
  .btn-sec:hover:not(:disabled) { border-color: var(--steel); color: var(--navy); }
  .btn-perigo:hover { background: #912018; }
  .btn-icone:hover { background: var(--navy-dim); color: var(--ink); }
}

.spinner {
  display: none;
  width: 1rem;
  height: 1rem;
  border: 2px solid rgba(255, 255, 255, .35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: girar 700ms linear infinite;
}
.btn.enviando .spinner { display: inline-block; }
@keyframes girar { to { transform: rotate(360deg); } }

/* ── envio e estados ──────────────────────────────────────────────────── */
.envio { margin-top: 4.5rem; }

.envio-painel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem 2.5rem;
  padding: 1.75rem 2rem 1.75rem 2.25rem;
  border-radius: var(--r-lg);
}
.envio-texto h2 {
  font-size: 1.25rem;
  font-weight: 800;
  line-height: 1.2;
  text-transform: uppercase;
}
.envio-texto > p {
  max-width: 52ch;
  margin-top: .375rem;
  font-size: .9375rem;
  color: var(--muted);
}
/* dentro do painel de envio a pendência vira seção do próprio painel (sem caixa dentro de caixa) */
.envio-texto .pendencias {
  margin-top: 1rem;
  padding: 1rem 0 0;
  border-top: 1px solid var(--line);
  border-radius: 0;
  background: none;
}

.envio-status:not(:empty) { margin-top: 1rem; }

.aviso-status {
  display: flex;
  gap: .75rem;
  padding: 1rem 1.25rem;
  border-radius: var(--r-md);
  font-size: .9375rem;
  line-height: 1.55;
  transition: opacity var(--t-medio) var(--ease-out);
}
@starting-style {
  .aviso-status { opacity: 0; }
}
.aviso-status > .ico { margin-top: .15rem; }
.aviso-status-texto { display: grid; gap: .25rem; min-width: 0; }
.aviso-status-texto .btn { justify-self: start; margin-top: .5rem; }
.aviso-status-titulo { font-weight: 700; }
.aviso-erro { background: var(--erro-bg); border: 1px solid var(--erro-line); }
.aviso-erro > .ico { color: var(--erro); }
.aviso-local { background: rgba(255, 255, 255, .92); border: 1px solid var(--steel-line); }
.aviso-local > .ico { color: var(--steel); }
.aviso-local a { overflow-wrap: anywhere; }

/* sucesso */
.sucesso {
  padding: 3rem 3rem 2.75rem;
  border-radius: var(--r-lg);
  opacity: 1;
  transform: none;
  transition: opacity 320ms var(--ease-out), transform 320ms var(--ease-out);
}
@starting-style {
  .sucesso { opacity: 0; }
}
@media (prefers-reduced-motion: no-preference) {
  @starting-style {
    .sucesso { opacity: 0; transform: translateY(8px); }
  }
}
.sucesso-selo {
  display: grid;
  place-items: center;
  width: 3.5rem;
  height: 3.5rem;
  margin-bottom: 1.5rem;
  border-radius: 14px;
  background: var(--navy);
  color: #fff;
  box-shadow: 0 12px 26px rgba(10, 42, 74, .28);
}
.sucesso-selo .ico { width: 1.75rem; height: 1.75rem; stroke-width: 2.25; }
.sucesso h2 {
  font-size: 2.125rem;
  font-weight: 800;
  line-height: 1.08;
  text-transform: uppercase;
}
.sucesso-texto { max-width: 56ch; margin-top: 1rem; font-size: 1.0625rem; line-height: 1.6; }
.protocolo {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .5rem 1rem;
  margin-top: 1.75rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--line);
}
.protocolo-rotulo {
  font-family: var(--ff-title);
  font-size: .6875rem;
  font-weight: 700;
  letter-spacing: .24em;
  text-transform: uppercase;
  color: var(--steel);
}
.protocolo-id {
  font-size: 1.375rem;
  font-weight: 700;
  overflow-wrap: anywhere;
}
.sucesso-nota { margin-top: 1rem; font-size: .9375rem; color: var(--muted); }

/* ── rodapé e barra de progresso ──────────────────────────────────────── */
.rodape {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: .75rem 2rem;
  margin-top: 5rem;
  padding: 1.5rem 0 2.75rem;
  border-top: 1px solid var(--line);
  font-size: .8125rem;
  color: var(--muted);
}
.rodape-lema {
  font-family: var(--ff-title);
  font-size: .6875rem;
  font-weight: 700;
  letter-spacing: .24em;
  text-transform: uppercase;
}

.barra-progresso {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  height: 4px;
  pointer-events: none;
}
.barra-progresso span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #0a2a4a, #2d5f8a, #aeb8c6);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 450ms var(--ease-out);
}
.concluido .barra-progresso { display: none; }

/* ── vidro com desfoque só onde há GPU de sobra ───────────────────────── */
@media (min-width: 48rem) {
  .vidro {
    -webkit-backdrop-filter: blur(9px) saturate(115%);
    backdrop-filter: blur(9px) saturate(115%);
  }
}

/* ── até 1120px: coluna única, barra compacta de progresso no topo ────── */
@media (max-width: 69.99rem) {
  :root { --pad: 2rem; }

  html { scroll-padding-top: 5rem; }

  .topo,
  .corpo { grid-template-columns: minmax(0, 1fr); }
  .principal { grid-column: auto; }
  .corpo { max-width: 60rem; }
  .topo { padding-top: 0; }
  .topo-logo { margin-bottom: 1.75rem; }
  .topo-logo img { width: 7.5rem; }

  .indice {
    top: 0;
    z-index: 20;
    display: block;
    margin: 0 calc(var(--pad) * -1) 2rem;
    padding: .75rem var(--pad);
    background: rgba(255, 255, 255, .9);
    -webkit-backdrop-filter: blur(10px) saturate(120%);
    backdrop-filter: blur(10px) saturate(120%);
    border-bottom: 1px solid var(--line);
  }
  .indice nav,
  .indice-salvo,
  .indice .kicker-sm { display: none; }
  .indice-cabeca {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
  }
  .indice-atual {
    display: block;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-family: var(--ff-title);
    font-size: .75rem;
    font-weight: 700;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: var(--steel);
  }
  .indice-total { flex: none; font-size: .8125rem; white-space: nowrap; }
  .indice-total strong { font-size: 1rem; }
  .indice-trilha {
    display: block;
    position: absolute;
    left: calc(var(--pad) * -1);
    right: calc(var(--pad) * -1);
    bottom: calc(-.75rem - 1px);
    height: 3px;
  }
  .indice-trilha span {
    display: block;
    height: 100%;
    background: linear-gradient(90deg, #0a2a4a, #2d5f8a, #aeb8c6);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 450ms var(--ease-out);
  }
  .barra-progresso { display: none; }
}

@media (max-width: 40rem) {
  :root { --pad: 1rem; }

  .casca { padding-top: 1.5rem; }
  .topo { padding-bottom: 2.25rem; }
  .topo-logo { margin-bottom: 1.25rem; }
  .topo-logo img { width: 6rem; }
  .topo h1 { font-size: 1.75rem; line-height: 1.08; }
  .topo-sub,
  .topo-intro { font-size: 1rem; }
  .topo-fatos { flex-direction: column; gap: .5rem; }

  .kicker { letter-spacing: .28em; }
  .indice-total-rotulo { display: none; }

  .bloco { margin-top: 3.25rem; }
  .bloco-cabeca h2 { font-size: 1.375rem; }
  .painel { gap: 1.75rem; padding: 1.375rem 1.125rem; border-radius: 14px; }
  .vidro { background: linear-gradient(160deg, rgba(10, 31, 58, .04), rgba(255, 255, 255, .86)); }
  .nota,
  .pendencias { padding: .875rem 1rem; }
  .mensal-grade { grid-template-columns: minmax(0, 1fr); }
  .grupo-grade:has(textarea) { grid-template-columns: minmax(0, 1fr); }

  .aviso-rascunho { flex-wrap: wrap; }
  .aviso-rascunho-texto { flex-basis: calc(100% - 2.5rem); }
  .aviso-rascunho-acoes { width: 100%; padding-left: 2rem; }
  .resumo-erros { padding: 1rem 1.125rem; }

  .envio { margin-top: 3.25rem; }
  .envio-painel { flex-direction: column; align-items: stretch; padding: 1.375rem 1.125rem; }
  .btn-pri { width: 100%; }

  .sucesso { padding: 2rem 1.25rem; }
  .sucesso h2 { font-size: 1.625rem; }

  .rodape { flex-direction: column; align-items: flex-start; margin-top: 3.5rem; }

  .marca-dagua { width: 17rem; height: 11.7rem; right: -4.5rem; bottom: -3.25rem; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .chip:active,
  .btn:active,
  .btn-icone:active { transform: none; }
  .barra-progresso span,
  .indice-trilha span,
  .trilha span { transition: none; }
}

@media (forced-colors: active) {
  .chip:has(.chip-input:checked) { outline: 2px solid CanvasText; }
  .num-quadrado { border: 1px solid CanvasText; }
}
