/* Estrutura do formulário e do painel. Cor, fonte, raio e layout da página vêm do tema.css.
   Tokens que o tema define: --tinta --suave --linha --borda --fundo --acao --acao-hover --acao-tinta --acao-leve
   --erro --erro-leve --ok --ok-leve --ambar --foco --raio --raio-campo --fonte --titulo */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding: 7rem 0; }
body { margin: 0; min-height: 100svh; background: var(--fundo); color: var(--tinta); font: 400 1rem/1.55 var(--fonte); -webkit-font-smoothing: antialiased; }
h1, h2, h3, h4, p, dl, dd, ul { margin: 0; }
h1, h2, h3, h4 { font-family: var(--titulo); text-wrap: balance; }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
legend { padding: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
img, svg { display: block; }
:focus-visible { outline: 3px solid var(--foco); outline-offset: 2px; }
h2:focus, .aviso:focus { outline: none; }

/* ---------------------------------------------------------------- faixa de demonstração */
.demo { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: .1rem 1.1rem; padding: .45rem 1.25rem; font-size: .84rem; text-align: center; }
.demo button { border: 0; padding: .35rem 0; background: none; font-weight: 600; color: inherit; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }

/* ---------------------------------------------------------------- títulos e blocos */
.cabeca h2 { font-size: clamp(1.6rem, 1.2rem + 1.4vw, 2.05rem); line-height: 1.15; letter-spacing: -.02em; }
.cabeca p { margin-top: .55rem; max-width: 62ch; color: var(--suave); }
.grupo { margin-top: 2.25rem; }
.grupo > legend { margin-bottom: .85rem; font: 700 1.06rem/1.3 var(--titulo); }
.grupo--curto { margin-top: 1rem; }
.grupo--curto > legend { font-size: .92rem; margin-bottom: .55rem; }
.aviso { margin-top: 1.4rem; padding: .85rem 1.1rem; border-radius: var(--raio-campo); background: var(--acao-leve); font-size: .94rem; }
.aviso--erro { background: var(--erro-leve); color: var(--erro); font-weight: 500; }
.vazio { margin-top: 1.6rem; color: var(--suave); }
.miudo { margin-top: .9rem; color: var(--suave); font-size: .85rem; }
.msg { display: block; margin-top: .4rem; color: var(--erro); font-size: .86rem; font-weight: 500; }

/* ---------------------------------------------------------------- opções (rádio e caixa) */
.ops { display: grid; gap: .7rem; }
.ops--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.ops--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.op { display: flex; gap: .8rem; align-items: flex-start; padding: 1rem 1.1rem; border-radius: var(--raio); border: 1px solid var(--linha); background: #fff; cursor: pointer; transition: border-color .18s, background-color .18s, box-shadow .18s; }
.op:hover { border-color: var(--acao); }
.op:has(input:checked) { border-color: var(--acao); background: var(--acao-leve); box-shadow: inset 0 0 0 1px var(--acao); }
.op:has(input:focus-visible), .tier:has(input:focus-visible), .seg label:has(input:focus-visible), .consent:has(input:focus-visible) { outline: 3px solid var(--foco); outline-offset: 2px; }
.op input:focus-visible, .tier input:focus-visible, .seg input:focus-visible, .consent input:focus-visible { outline: none; }
.op__txt { min-width: 0; }
.op__txt b { display: block; font-weight: 600; line-height: 1.35; }
.op__txt small { display: block; margin-top: .2rem; color: var(--suave); font-size: .85rem; line-height: 1.4; }
.op--fora { opacity: .6; cursor: not-allowed; }
input[type=radio], input[type=checkbox] { appearance: none; flex: none; width: 1.2rem; height: 1.2rem; margin: .12rem 0 0; border: 1.5px solid var(--borda); background: #fff; cursor: pointer; transition: border-color .15s, background-color .15s, box-shadow .15s; }
input[type=radio] { border-radius: 50%; }
input[type=checkbox] { border-radius: 5px; }
input[type=radio]:checked { border-color: var(--acao); box-shadow: inset 0 0 0 3.5px #fff; background: var(--acao); }
input[type=checkbox]:checked { border-color: var(--acao); background: var(--acao) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='white' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3.5 8.5 6.6 11.5 12.5 4.8'/%3E%3C/svg%3E") center/100% no-repeat; }

/* tipos de plano: uma tabela em que a linha inteira é a opção */
.tiers { margin-top: .7rem; border: 1px solid var(--linha); border-radius: var(--raio); background: #fff; overflow: hidden; }
.tiers.has-err { border-color: var(--erro); }
.tiers__cab, .tier { display: grid; grid-template-columns: minmax(0, 1fr) 8.5rem; gap: .25rem 1rem; align-items: center; padding: .8rem 1.1rem; }
.tiers--dois .tiers__cab, .tiers--dois .tier { grid-template-columns: minmax(0, 1fr) 7.5rem 9rem; }
.tiers__cab { padding-block: .6rem; color: var(--suave); font-size: .83rem; }
.tiers__cab span:not(:first-child), .tier__valor { text-align: right; }
.tier { position: relative; border-top: 1px solid var(--linha); cursor: pointer; transition: background-color .18s; }
.tier:hover, .tier:has(input:checked) { background: var(--acao-leve); }
.tier:has(input:focus-visible) { outline-offset: -3px; }
.tier input { position: absolute; left: 1.1rem; top: 50%; margin-top: -.6rem; }
.tier__nome { padding-left: 2rem; font-weight: 600; line-height: 1.35; }
.tier__valor { font-variant-numeric: tabular-nums; }

/* ---------------------------------------------------------------- campos */
.grade { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.15rem 1.1rem; }
.cheio { grid-column: 1 / -1; }
.dep .grade { margin-top: 1.4rem; }
.campo__rotulo { display: block; margin-bottom: .4rem; font-weight: 600; font-size: .92rem; line-height: 1.35; }
.campo__rotulo small { font-weight: 400; font-size: 1em; color: var(--suave); }
input[type=text], input[type=date], input[type=email], input[type=tel], input[type=search], select, textarea { width: 100%; min-height: 3rem; padding: .65rem .9rem; border: 1px solid var(--borda); border-radius: var(--raio-campo); background: #fff; transition: border-color .15s, box-shadow .15s; }
select { appearance: none; padding-right: 2.4rem; background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8' fill='none' stroke='%234d5a89' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M1.5 1.5 6 6l4.5-4.5'/%3E%3C/svg%3E") right .95rem center/.75rem no-repeat; }
::placeholder { color: #71818f; opacity: 1; }
input:hover, select:hover, textarea:hover { border-color: var(--acao); }
.campo input:focus-visible, .campo select:focus-visible, .campo textarea:focus-visible { outline: none; border-color: var(--acao); box-shadow: 0 0 0 3px var(--foco); }
.has-err > input, .has-err > select, .has-err .seg label { border-color: var(--erro); }
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; }
.seg label { display: flex; align-items: center; gap: .65rem; min-height: 3rem; padding: .5rem .9rem; border: 1px solid var(--borda); border-radius: var(--raio-campo); background: #fff; cursor: pointer; transition: border-color .15s, background-color .15s; }
.seg label:hover { border-color: var(--acao); }
.seg label:has(input:checked) { border-color: var(--acao); background: var(--acao-leve); }
.seg input { margin: 0; }

/* ---------------------------------------------------------------- dependentes, termos, resumo */
.dep { margin-top: 1.6rem; padding: 1.4rem 1.5rem 1.6rem; border: 1px solid var(--linha); border-radius: var(--raio); background: #fff; }
.dep__cab, .termo__cab { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: .25rem 1rem; }
.dep h3, .termo h3 { font-size: 1.12rem; line-height: 1.3; }
.consent { display: flex; gap: .9rem; align-items: flex-start; padding: 1.1rem 1.2rem; border: 1px solid var(--linha); border-radius: var(--raio); background: #fff; cursor: pointer; font-size: .94rem; color: var(--suave); transition: border-color .18s, background-color .18s; }
.consent + .consent { margin-top: .7rem; }
.consent b { display: block; margin-bottom: .25rem; font-weight: 600; color: var(--tinta); font-size: 1rem; }
.consent:hover, .consent:has(input:checked) { border-color: var(--acao); }
.consent:has(input:checked) { background: var(--acao-leve); }
.consent.has-err { border-color: var(--erro); }
.termo { margin-top: 1.6rem; padding: 1.4rem 1.5rem; border: 1px solid var(--linha); border-radius: var(--raio); background: #fff; }
.termo__cab--dep { margin-top: 1.5rem; padding-top: 1.2rem; border-top: 1px solid var(--linha); }
.termo h4, .det h4 { font-size: 1rem; }
.kv { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .95rem 1.5rem; margin-top: 1.1rem; font-size: .94rem; }
.kv dt { color: var(--suave); font-size: .85rem; }
.kv dd { font-weight: 500; overflow-wrap: anywhere; }
table { width: 100%; border-collapse: collapse; font-size: .94rem; font-variant-numeric: tabular-nums; }
th, td { padding: .6rem 0; text-align: left; vertical-align: top; }
.n { text-align: right; white-space: nowrap; padding-left: 1rem; }
.termo tbody tr + tr { border-top: 1px solid var(--linha); }
.termo .rot th { padding-top: 1.2rem; color: var(--suave); font-weight: 500; font-size: .88rem; }
.termo .soma td { font-weight: 700; }
.texto { margin-top: 1.6rem; }
.texto summary { width: fit-content; padding: .4rem 0; font-weight: 600; color: var(--acao); cursor: pointer; }
.texto textarea { margin: .7rem 0 .8rem; font: 400 .84rem/1.6 ui-monospace, Consolas, monospace; }
.copiado { margin-left: .7rem; color: var(--ok); font-weight: 600; }

/* ---------------------------------------------------------------- botões e rodapé da etapa */
.bt { display: inline-flex; align-items: center; justify-content: center; min-height: 3rem; padding: .7rem 1.6rem; border: 1px solid var(--acao); border-radius: var(--raio-campo); background: var(--acao); color: var(--acao-tinta); font-weight: 600; text-decoration: none; cursor: pointer; transition: background-color .18s, border-color .18s, color .18s; }
.bt:hover { background: var(--acao-hover); border-color: var(--acao-hover); }
.bt:disabled { opacity: .65; cursor: wait; }
.bt--fio { background: transparent; color: var(--acao); border-color: var(--borda); }
.bt--fio:hover { background: var(--acao-leve); border-color: var(--acao); }
.bt--texto { min-height: 2.2rem; padding: .2rem 0; border: 0; background: none; color: var(--acao); font-size: .9rem; }
.bt--texto:hover { background: none; text-decoration: underline; text-underline-offset: 3px; }
.bt--mais { margin-top: 1.4rem; }
.nav { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 1rem; margin-top: 2.5rem; }
.nav__total { grid-column: 2; text-align: right; line-height: 1.3; }
.nav__total span, .nav__total small { color: var(--suave); font-size: .85rem; }
.nav__total small { display: block; }
.nav__total b { font-size: 1.15rem; font-variant-numeric: tabular-nums; }
.nav__dir { grid-column: 3; }

/* ---------------------------------------------------------------- confirmação */
.pronto { display: flex; flex-direction: column; align-items: flex-start; gap: .9rem; padding: 1rem 0 2rem; }
.pronto h2 { font-size: clamp(1.7rem, 1.3rem + 1.6vw, 2.3rem); letter-spacing: -.02em; line-height: 1.15; }
.pronto__ok { width: 64px; height: 64px; fill: none; stroke: var(--acao); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.pronto__prot b { font-variant-numeric: tabular-nums; }
.pronto__prot { font-size: 1.15rem; }
.pronto .aviso { margin-top: .4rem; }
.pronto__bts { display: flex; flex-wrap: wrap; gap: .7rem; margin-top: .8rem; }

/* ---------------------------------------------------------------- painel do RH */
.cabeca--painel { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 1rem; }
.conta { display: flex; flex-wrap: wrap; gap: 1rem 2.75rem; margin: 1.9rem 0; }
.conta div { display: flex; flex-direction: column-reverse; }
.conta dt { color: var(--suave); font-size: .88rem; }
.conta dd { font: 700 1.75rem/1.15 var(--titulo); font-variant-numeric: tabular-nums; }
.filtros { display: grid; grid-template-columns: minmax(14rem, 1fr) repeat(3, minmax(9rem, auto)) auto auto; gap: .9rem; align-items: end; }
.chk { display: flex; align-items: center; gap: .6rem; min-height: 3rem; font-size: .94rem; cursor: pointer; }
.chk input { margin: 0; }
.tabela { margin-top: 1.3rem; overflow-x: auto; border: 1px solid var(--linha); border-radius: var(--raio); background: #fff; }
.tabela > table { min-width: 1080px; }
.tabela th, .tabela td { padding: .85rem .9rem; border-top: 1px solid var(--linha); }
.tabela thead th { border-top: 0; color: var(--suave); font-weight: 500; font-size: .85rem; white-space: nowrap; }
.tabela td small { display: block; color: var(--suave); font-size: .84rem; }
.linha td:nth-child(2) { white-space: nowrap; }
.linha { cursor: pointer; transition: background-color .15s; }
.linha:hover { background: var(--acao-leve); }
.linha:focus-visible { outline-offset: -3px; }
.linha select { width: auto; min-height: 2.5rem; padding-block: .35rem; }
.selo { display: inline-block; padding: .1rem .65rem; border-radius: 99px; font-size: .83rem; font-weight: 600; white-space: nowrap; }
.selo--ok { background: var(--ok-leve); color: var(--ok); }
.selo--ruim { background: var(--erro-leve); color: var(--erro); }
.det > td { padding: 1.3rem 1.5rem 1.6rem; background: var(--acao-leve); cursor: auto; }
.det .kv { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.det h4 { margin-top: 1.4rem; }
.det .campo { margin-top: 1.3rem; max-width: 46rem; }
.miolo { margin-top: .5rem; }
.miolo th, .miolo td { padding: .55rem 1rem .55rem 0; background: none; }
.pend { margin-bottom: .4rem; padding-left: 1.1rem; color: var(--erro); font-weight: 500; }

/* ---------------------------------------------------------------- telas menores */
@media (max-width: 1100px) { .filtros { grid-template-columns: repeat(3, minmax(0, 1fr)); } .campo--busca { grid-column: 1 / -1; } .det .kv { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) {
  .ops--2, .ops--3, .grade, .kv, .det .kv { grid-template-columns: minmax(0, 1fr); }
  .kv { gap: .75rem; }
  .op { padding: .9rem 1rem; }
  .dep, .termo { padding: 1.2rem 1.1rem 1.3rem; }
  .filtros { grid-template-columns: minmax(0, 1fr); }
  .conta { gap: 1rem 2rem; }
  .tiers__cab { display: none; }
  .tier, .tiers--dois .tier { grid-template-columns: minmax(0, 1fr); padding-left: 3.1rem; }
  .tier:first-of-type { border-top: 0; }
  .tier input { left: 1rem; top: 1rem; margin: 0; }
  .tier__nome { padding-left: 0; }
  .tier__valor { display: flex; justify-content: space-between; text-align: right; font-size: .92rem; }
  .tier__valor::before { content: attr(data-col); color: var(--suave); }
  .nav { grid-template-columns: auto 1fr; }
  .nav__total { grid-column: 1 / -1; grid-row: 1; text-align: left; }
  .nav__total small { display: inline; margin-left: .5rem; }
  .nav__esq { grid-column: 1; grid-row: 2; }
  .nav__dir { grid-column: 2; grid-row: 2; }
  .nav__esq:empty { display: none; }
  .nav__dir .bt { width: 100%; }
  .nav__esq:empty + .nav__dir, .nav__esq:empty + .nav__total + .nav__dir { grid-column: 1 / -1; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; } }
