/* ==========================================================================
   Calculadora de Rescisao Trabalhista — Ferramenta Brasil
   Fluxo de um passo por vez, com o total somando a cada resposta.

   Regras herdadas da ORDEM-003 (acessibilidade AA) que NAO podem regredir:
     - nenhum texto abaixo de 15px
     - nenhum alvo de toque abaixo de 44x44
     - contraste de texto >= 4,5:1 e de borda/foco >= 3:1
     - anel de foco visivel em todo interativo
     - sem rolagem horizontal ate 195px de largura (zoom de 200%)
   Todos os valores de cor abaixo foram medidos, nao estimados.
   ========================================================================== */

:root {
  --ink: #101d24;        /* 16,24:1 sobre --paper */
  --muted: #55635e;      /*  5,96:1 sobre --paper */
  --linha: #79968d;      /*  3,20:1 no branco, 3,03:1 no --paper */
  --linha-fraca: #dde5e1;/* separador decorativo, nao e contorno de controle */
  --paper: #f7f9f8;
  --surface: #ffffff;
  --brand: #0a6b5c;      /*  6,07:1 sobre --paper */
  --brand-dark: #085447; /*  8,38:1 sobre --paper — cor do anel de foco */
  --sobre-brand: #c2e8de;/*  4,86:1 sobre --brand */
  --delta-bg: #7ee0c4;
  --erro-bg: #fdecea;
  --erro-ink: #8a1f11;   /*  8,04:1 sobre --erro-bg */
  --raio: 12px;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }

/* O atributo hidden e aplicado pelo navegador como display:none, mas
   qualquer regra de classe com display explicito o vence. Sem isto, o
   texto de espera continuava desenhado por baixo do valor da faixa.   */
[hidden] { display: none !important; }

html { font-size: 100%; -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--paper);
}

svg { display: block; flex-shrink: 0; }

a { color: var(--brand-dark); text-underline-offset: 2px; }

/* --- Foco: um so anel, em todo interativo ------------------------------- */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
summary:focus-visible,
[tabindex]:focus-visible {
  outline: 3px solid var(--brand-dark);
  outline-offset: 2px;
  border-radius: 4px;
}

/* --- Sem JavaScript ------------------------------------------------------
   O CSP proibe <script> e <style> inline, entao o truque classico da classe
   "no-js" no <html> nao serve aqui. A logica e invertida: o que depende de JS
   nasce escondido e o proprio app.js revela ao rodar. Sem JS, o visitante ve
   a explicacao do <noscript> em vez de um formulario morto.               */
html:not(.tem-js) .exige-js { display: none; }

.sem-js {
  margin-top: 20px;
  padding: 18px 20px;
  background: #fff4e8;
  border-left: 4px solid var(--linha);
  border-radius: 0 var(--raio) var(--raio) 0;
}
.sem-js strong { display: block; font-size: 18px; margin-bottom: 8px; }
.sem-js p { margin: 0 0 10px; font-size: 16px; line-height: 1.5; color: var(--muted); }
.sem-js p:last-child { margin-bottom: 0; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

/* --- Topo ---------------------------------------------------------------- */
.topo {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px 12px;
  flex-wrap: wrap;
  padding: 12px 22px;
  max-width: 720px;
  margin: 0 auto;
}

.marca {
  font-size: 15px;   /* piso da ORDEM-003; nao baixar */
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--brand);
}

.refazer {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  padding: 0 4px;
  border: none;
  background: none;
  font: inherit;
  font-size: 16px;
  color: var(--muted);
  cursor: pointer;
}

main { max-width: 720px; margin: 0 auto; padding: 0 22px 48px; }

/* O H1 carrega a frase de busca; a pergunta do passo e o titulo visual. */
.titulo-seo {
  margin: 4px 0 16px;
  font-size: 17px;
  line-height: 1.35;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0;
}

/* --- Progresso ----------------------------------------------------------- */
.progresso { display: flex; flex-direction: column; gap: 10px; }
.progresso-texto { font-size: 15px; color: var(--muted); }

.barras {
  display: flex;
  gap: 5px;
  list-style: none;
  margin: 0;
  padding: 0;
}
.barras li {
  height: 6px;
  flex-grow: 1;
  border-radius: 3px;
  background: #d5ded9;
}
.barras li.feito { background: var(--brand); }

/* --- Faixa do total ------------------------------------------------------ */
/* Altura minima igual nos dois estados: trocar um pelo outro nao empurra
   nada na pagina, e o CLS fica em zero.                                    */
.faixa {
  margin-top: 16px;
  min-height: 92px;
  border-radius: 14px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 14px 18px;
}

.faixa-espera {
  border: 1.5px dashed var(--linha);
  background: transparent;
}
.faixa-espera-conteudo {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 15px;
  line-height: 1.4;
  color: var(--muted);
}

.faixa-cheia { background: var(--brand); border: 1.5px solid var(--brand); }
.faixa-cheia .faixa-valor-conteudo { display: block; }

.faixa-linha {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}
.faixa-rotulo { font-size: 15px; font-weight: 500; color: var(--sobre-brand); }

.delta {
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
  background: var(--delta-bg);
  border-radius: 999px;
  padding: 3px 10px;
  white-space: nowrap;
}

.faixa-numero {
  display: block;
  margin-top: 4px;
  font-size: clamp(30px, 9vw, 40px);
  line-height: 1.1;
  font-weight: 700;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
  color: #ffffff;
}

/* --- Passos -------------------------------------------------------------- */
/* O <legend> e desenhado sobre a borda do <fieldset> e ignora o padding
   dele: com padding-top o vao ia todo para DEPOIS da pergunta. Margem no
   fieldset e o que separa a faixa da pergunta.                          */
.passo {
  border: none;
  margin: 28px 0 0;
  padding: 0;
  min-width: 0;
}

.pergunta {
  display: block;
  padding: 0;
  margin: 0 0 10px;
  font-size: clamp(26px, 7.5vw, 33px);
  line-height: 1.15;
  font-weight: 600;
  letter-spacing: -0.03em;
  text-wrap: pretty;
}

.apoio {
  margin: 0 0 18px;
  font-size: 17px;
  line-height: 1.45;
  color: var(--muted);
}

.campo {
  width: 100%;
  min-width: 0;
  height: 64px;
  padding: 0 18px;
  font-family: inherit;
  font-size: 24px;
  font-weight: 600;
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  background: var(--surface);
  border: 2px solid var(--linha);
  border-radius: var(--raio);
  appearance: none;
}
.campo:focus { border-color: var(--brand); }

.campo-data { display: block; }

.campo-moeda {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border: 2px solid var(--linha);
  border-radius: var(--raio);
  padding-left: 18px;
}
.campo-moeda:focus-within { border-color: var(--brand); }
.campo-moeda .prefixo { font-size: 21px; color: var(--muted); }
.campo-moeda .campo {
  border: none;
  background: none;
  padding-left: 0;
  border-radius: 0;
}
.campo-moeda .campo:focus-visible { outline-offset: -2px; }

/* Os botoes de incremento tem ~10x20px e nao ha como aumenta-los. */
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
input[type="number"] { -moz-appearance: textfield; appearance: textfield; }

/* Icone do seletor de data levado a 44x44 de area clicavel. */
input[type="date"]::-webkit-calendar-picker-indicator {
  width: 24px; height: 24px; padding: 10px; margin-inline-end: -6px; cursor: pointer;
}

select.campo {
  font-size: 18px;
  font-weight: 500;
  padding-right: 46px;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%2355635e' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 6l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
  background-size: 16px 16px;
}

/* --- Erro ---------------------------------------------------------------- */
.erro {
  display: none;
  margin-top: 16px;
  padding: 14px 16px;
  background: var(--erro-bg);
  border-radius: 10px;
  color: var(--erro-ink);
  font-size: 16px;
  line-height: 1.45;
}
.erro.visivel { display: block; }

/* --- Acoes --------------------------------------------------------------- */
.acoes {
  margin-top: 22px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.btn-principal {
  width: 100%;
  min-height: 60px;
  border: none;
  border-radius: var(--raio);
  background: var(--brand);
  color: #ffffff;
  font-family: inherit;
  font-size: 19px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  cursor: pointer;
}

.btn-voltar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  border: none;
  background: none;
  font: inherit;
  font-size: 16px;
  color: var(--muted);
  cursor: pointer;
}

/* --- Resultado ----------------------------------------------------------- */
.resultado { margin-top: 24px; }

.aviso-info {
  padding: 13px 16px;
  background: #e8f5f1;
  border-radius: 10px;
  font-size: 16px;
  line-height: 1.45;
  margin-bottom: 16px;
}

.verbas { width: 100%; border-collapse: collapse; font-size: 16px; }

.verbas th,
.verbas td {
  padding: 13px 6px;
  border-bottom: 1px solid var(--linha-fraca);
  text-align: left;
  vertical-align: baseline;
}
.verbas th { font-weight: 400; color: var(--muted); }
.verbas td {
  text-align: right;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.verbas tr:last-child th,
.verbas tr:last-child td { border-bottom: none; }

/* Linha do FGTS da rescisao: fica na tabela, mas fora da soma em especie. */
.verbas tfoot .linha-fgts th,
.verbas tfoot .linha-fgts td {
  border-top: 2px solid var(--linha-fraca);
  border-bottom: none;
  padding-top: 14px;
  color: var(--muted);
}
.nota-linha {
  display: block;
  font-size: 15px;
  line-height: 1.35;
  color: var(--muted);
  margin-top: 2px;
}

.explica {
  margin-top: 18px;
  padding: 16px 18px;
  background: #eaf2ef;
  border-radius: var(--raio);
}
.explica h3 { margin: 0 0 8px; font-size: 17px; font-weight: 600; }
.explica p { margin: 0 0 10px; font-size: 16px; line-height: 1.5; color: var(--muted); }
.explica p:last-child { margin-bottom: 0; }
.explica .atencao { color: var(--ink); }

.meta {
  margin: 14px 0 0;
  font-size: 15px;
  line-height: 1.45;
  color: var(--muted);
}

.nota {
  margin-top: 16px;
  padding: 13px 16px;
  background: #edf3f0;
  border-radius: 10px;
  font-size: 15px;
  line-height: 1.45;
  color: var(--muted);
}

/* --- Conteudo ------------------------------------------------------------ */
.content { margin-top: 44px; }
.content h2 {
  margin: 0 0 10px;
  font-size: 25px;
  line-height: 1.2;
  font-weight: 600;
  letter-spacing: -0.025em;
  text-wrap: pretty;
}
.content h3 { margin: 26px 0 6px; font-size: 18px; font-weight: 600; }
.content p { margin: 0 0 14px; font-size: 17px; line-height: 1.5; color: var(--muted); }
.content .snippet { color: var(--ink); font-weight: 500; }

.faq { margin-top: 34px; }
.faq h2 { margin-bottom: 6px; }
.faq details { border-top: 1px solid var(--linha-fraca); }
.faq details:last-of-type { border-bottom: 1px solid var(--linha-fraca); }
.faq summary {
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 12px 0;
  font-size: 17px;
  font-weight: 600;
  line-height: 1.35;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::before {
  content: "+";
  width: 1.1em;
  color: var(--brand);
  font-weight: 700;
  flex-shrink: 0;
}
.faq details[open] summary::before { content: "\2212"; }
.faq details p { margin: 0 0 14px 1.6em; }

/* --- Rodape -------------------------------------------------------------- */
.rodape {
  border-top: 1px solid var(--linha-fraca);
  background: #eaf0ed;
  padding: 26px 22px 34px;
}
.rodape > * { max-width: 720px; margin-left: auto; margin-right: auto; }
.autoria { margin: 0 0 10px; font-size: 16px; line-height: 1.5; }
.disclaimer { margin: 0; font-size: 15px; line-height: 1.5; color: var(--muted); }

/* --- Zoom de 200%: viewport de layout de ~195px --------------------------- */
@media (max-width: 340px) {
  main { padding-left: 16px; padding-right: 16px; }
  .topo { padding-left: 16px; padding-right: 16px; }
  .verbas th { overflow-wrap: anywhere; hyphens: auto; }
  .verbas td { white-space: normal; }
  .faixa-linha { flex-direction: column; align-items: flex-start; gap: 4px; }
  /* Com zoom de 200% cada px CSS vale 2 fisicos: 22px aqui aparece maior
     que os 40px da tela sem zoom, e e o que faz o numero caber.        */
  .faixa-numero { font-size: 22px; letter-spacing: -0.02em; }
  .delta { font-size: 15px; padding: 2px 8px; }
  .campo { font-size: 20px; padding-left: 12px; padding-right: 12px; }
  .campo-moeda { padding-left: 12px; }
}
