/* CESASCORE — formulário em etapas (registro.html). Requer base.css */
/* ===================== CABEÇALHO ===================== */
.topo {
  display: grid;
  grid-template-columns: minmax(220px, 32%) 1fr;
  min-height: 88px;
  background: var(--topo-grad);
}
.topo-marca {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 24px 0 32px;
  background: var(--topo-claro);
}
.logo-icone { width: 46px; height: 46px; flex: none; }
.logo-texto {
  font-weight: 800;
  font-size: 19px;
  letter-spacing: 0.02em;
  color: var(--azul-marca);
  border-bottom: 2px solid var(--teal-marca);
  padding-bottom: 2px;
}
.logo-texto b { font-weight: 800; }
.logo-texto span { color: var(--teal-marca); }

.topo-etapas {
  display: flex;
  align-items: center;
  padding: 0 40px 0 56px;
}
.stepper {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  align-items: center;
  width: 100%;
}
.stepper li {
  display: flex;
  align-items: center;
  flex: 1;
}
.stepper li:last-child { flex: none; }
.stepper li:not(:last-child)::after {
  content: '';
  flex: 1;
  height: 4px;
  margin: 0 4px;
  border-radius: 2px;
  background: var(--cinza-linha);
  transition: background .25s;
}
.stepper li.feita:not(:last-child)::after { background: var(--verde); }

.stepper button {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 2px solid #9ea5ad;
  background: var(--cinza-etapa);
  color: var(--tinta);
  font: 700 16px 'Manrope', sans-serif;
  cursor: default;
  flex: none;
  transition: background .25s, border-color .25s;
}
.stepper li.feita button {
  background: var(--verde);
  border-color: var(--verde-escuro);
  cursor: pointer;
}
.stepper li.atual button { box-shadow: 0 0 0 3px rgba(255, 255, 255, .7); }
.stepper button:disabled { opacity: 1; }

/* ===================== CONTEÚDO / CARTÃO ===================== */
.conteudo {
  flex: 1;
  padding: 40px 24px 48px;
}
#formCesascore { max-width: 1040px; margin: 0 auto; }

.cartao {
  background: var(--cartao-fundo);
  border: 1px solid var(--cartao-borda);
  border-radius: 16px;
  box-shadow: 0 4px 14px rgba(30, 50, 80, .14);
  overflow: visible;
}
.cartao-estreito { max-width: 860px; margin: 0 auto; }

.cartao-topo {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 20px;
  background: var(--cartao-topo);
  border-radius: 16px 16px 0 0;
  box-shadow: 0 3px 6px rgba(30, 50, 80, .12);
}
.cartao-topo h1 {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.01em;
}
.cartao-icone {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: #fff;
  display: grid;
  place-items: center;
  flex: none;
}
.cartao-icone svg {
  width: 30px;
  height: 30px;
  fill: none;
  stroke: var(--tinta);
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.cartao-corpo { padding: 14px 20px 16px; }

.quadro {
  margin: 0;
  border: 1px solid var(--quadro-borda);
  border-radius: 6px;
  background: #fff;
  padding: 16px 16px 14px;
  min-width: 0;
}
fieldset.quadro { padding-top: 6px; background: transparent; }
.quadro legend {
  font-size: 18px;
  font-weight: 600;
  padding: 0 10px;
  margin-left: 6px;
}
.cartao-corpo > .quadro:not(fieldset) { background: transparent; }

.grade { display: grid; gap: 4px 32px; }
.grade-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grade-3 { grid-template-columns: 1fr 1.15fr 1fr; }
.coluna { display: flex; flex-direction: column; min-width: 0; }

/* ===================== CAMPOS ===================== */
.campo-grupo {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  margin-bottom: 18px;
  position: relative;
}
.campo-grupo:last-child { margin-bottom: 4px; }
.campo-grupo > label,
.rotulo {
  font-size: 16px;
  font-weight: 500;
  color: var(--tinta);
}
.rotulo-menor { font-size: 13px; color: var(--tinta-suave); }

.campo,
.contador {
  font: 500 13px 'Manrope', sans-serif;
  color: var(--campo-texto);
  background: var(--campo-fundo);
  border: 1px solid var(--campo-borda);
  border-radius: 4px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .12);
  height: 28px;
}
.campo {
  width: 100%;
  max-width: 300px;
  padding: 0 8px;
  outline: none;
}
.campo-data { max-width: 160px; }
.campo::placeholder,
.contador input::placeholder { color: var(--placeholder); }
.campo:focus,
.contador:focus-within {
  border-color: #7c9cc4;
  box-shadow: 0 0 0 3px rgba(124, 156, 196, .3);
}
.campo[readonly] { color: #80868d; cursor: default; }

/* Contador: input + botões − / + dentro da mesma caixa */
.contador {
  display: inline-flex;
  align-items: center;
  width: 160px;
  padding: 0 4px 0 8px;
}
.contador-curto { width: 120px; }
.contador input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  font: inherit;
  color: inherit;
  outline: none;
  padding: 0;
  -moz-appearance: textfield;
}
.contador input::-webkit-outer-spin-button,
.contador input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.contador button {
  border: 0;
  background: none;
  font: 700 15px 'Manrope', sans-serif;
  color: var(--tinta);
  width: 20px;
  height: 22px;
  padding: 0;
  border-radius: 3px;
  cursor: pointer;
  line-height: 1;
}
.contador button:hover { background: rgba(0, 0, 0, .08); }

/* Inválido (marcado pelo JS após tentar avançar) */
.tentou :invalid:not(fieldset):not(form),
.tentou .contador:has(:invalid) {
  border-color: var(--erro);
}
.campo-grupo.erro > .rotulo,
.campo-grupo.erro > label { color: var(--erro); }

/* Radios */
.opcoes {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 22px;
}
.opcao {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  color: var(--campo-texto);
}
.opcao input[type="radio"] {
  appearance: none;
  -webkit-appearance: none;
  margin: 0;
  width: 13px;
  height: 13px;
  border: 1.5px solid #3a3f45;
  border-radius: 50%;
  display: grid;
  place-items: center;
  cursor: pointer;
  flex: none;
}
.opcao input[type="radio"]::before {
  content: '';
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--verde-escuro);
  transform: scale(0);
  transition: transform .12s;
}
.opcao input[type="radio"]:checked::before { transform: scale(1); }
.opcao input[type="radio"]:focus-visible { outline: 2px solid #7c9cc4; outline-offset: 2px; }

/* Seleção múltipla ("Selecionar") */
.multi { position: relative; width: 100%; max-width: 300px; }
.multi-botao {
  text-align: left;
  cursor: pointer;
  color: var(--placeholder);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding-right: 26px;
  position: relative;
}
.multi-botao.preenchido { color: var(--campo-texto); }
.multi-botao::after {
  content: '';
  position: absolute;
  right: 10px;
  top: 50%;
  width: 6px;
  height: 6px;
  border-right: 1.5px solid #6b7178;
  border-bottom: 1.5px solid #6b7178;
  transform: translateY(-70%) rotate(45deg);
}
.multi-painel {
  position: absolute;
  z-index: 20;
  top: calc(100% + 4px);
  left: 0;
  min-width: 100%;
  width: max-content;
  max-width: 320px;
  background: #fff;
  border: 1px solid var(--campo-borda);
  border-radius: 6px;
  box-shadow: 0 8px 20px rgba(30, 50, 80, .18);
  padding: 6px;
  display: flex;
  flex-direction: column;
}
.multi-painel label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  padding: 6px 8px;
  border-radius: 4px;
  cursor: pointer;
}
.multi-painel label:hover { background: #eef2f7; }
.multi-painel input { accent-color: var(--verde-escuro); margin: 0; }

/* Blocos condicionais e dicas */
.condicional {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 4px;
}
.atencao {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
  color: var(--alerta);
}
.dica {
  font-size: 12px;
  color: var(--tinta-suave);
  min-height: 0;
}
.dica:empty { display: none; }
.dica-aviso { color: var(--alerta); font-weight: 600; max-width: 220px; }

/* ===================== AÇÕES ===================== */
.acoes {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 24px;
  margin-top: 12px;
}
.dica-bishop { margin-right: auto; font-size: 13px; }
.botao {
  font: 700 16px 'Manrope', sans-serif;
  padding: 0 22px;
  height: 36px;
  min-width: 132px;
  border-radius: 999px;
  border: 1.5px solid;
  cursor: pointer;
  box-shadow: 0 2px 4px rgba(0, 0, 0, .1);
  transition: filter .15s, transform .1s;
}
.botao:hover { filter: brightness(.96); }
.botao:active { transform: translateY(1px); }
.botao:focus-visible { outline: 2px solid #7c9cc4; outline-offset: 2px; }
.botao-voltar { background: var(--voltar-fundo); border-color: var(--voltar-borda); color: var(--voltar-texto); }
.botao-avancar { background: var(--avancar-fundo); border-color: var(--avancar-borda); color: var(--avancar-texto); }

.relatorio-texto {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  font: 400 13px/1.55 'Manrope', system-ui, sans-serif;
  color: var(--tinta);
  background: #fff;
  border: 1px solid var(--quadro-borda);
  border-radius: 6px;
  padding: 18px 20px;
  max-height: 65vh;
  overflow: auto;
}
.status-relatorio { margin: 10px 0 0; min-height: 1em; }
.status-relatorio.erro-msg { color: var(--erro); font-weight: 600; }
.acoes-relatorio { flex-wrap: wrap; gap: 12px; }
.acoes-relatorio .botao { min-width: 0; }
.acoes-espaco { flex: 1; }
.botao:disabled { opacity: .6; cursor: progress; }

.status {
  margin: 20px auto 0;
  max-width: 860px;
  padding: 12px 16px;
  border-radius: 10px;
  background: #e8f8ec;
  border: 1px solid var(--avancar-borda);
  color: var(--avancar-texto);
  font-size: 14px;
  font-weight: 600;
}

/* ===================== DIÁLOGO DE CONFIRMAÇÃO ===================== */
.dialogo {
  padding: 0;
  border: 1px solid var(--cartao-borda);
  border-radius: 16px;
  width: min(760px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  background: var(--cartao-fundo);
  color: var(--tinta);
  box-shadow: 0 12px 40px rgba(30, 50, 80, .3);
}
.dialogo[open] { display: flex; flex-direction: column; }
.dialogo::backdrop { background: rgba(29, 32, 36, .45); }
.dialogo .cartao-topo { padding: 16px 20px; }
.dialogo-corpo { padding: 8px 20px; overflow-y: auto; }
.dialogo-corpo h3 {
  font-size: 15px;
  margin: 16px 0 6px;
  color: var(--azul-marca);
}
.dialogo-corpo table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  background: #fff;
  border: 1px solid var(--quadro-borda);
  border-radius: 6px;
}
.dialogo-corpo td {
  padding: 6px 10px;
  border-bottom: 1px solid #edf0f3;
  vertical-align: top;
}
.dialogo-corpo td:first-child { width: 40%; color: var(--tinta-suave); font-weight: 600; }
.dialogo .acoes { padding: 12px 20px 18px; margin: 0; }

/* ===================== RESPONSIVO ===================== */
@media (max-width: 900px) {
  .grade-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 680px) {
  .topo { grid-template-columns: 1fr; }
  .topo-marca { padding: 12px 16px; }
  .topo-etapas { padding: 14px 16px; }
  .stepper button { width: 30px; height: 30px; font-size: 14px; }
  .conteudo { padding: 20px 16px 32px; }
  .cartao-topo h1 { font-size: 17px; }
  .cartao-icone { width: 40px; height: 40px; }
  .cartao-icone svg { width: 24px; height: 24px; }
  .cartao-corpo { padding: 12px; }
  .grade-2, .grade-3 { grid-template-columns: 1fr; }
  .grade > .coluna:not(:last-child) > .campo-grupo:last-child { margin-bottom: 18px; }
  .acoes { gap: 12px; flex-wrap: wrap; }
  .botao { min-width: 0; flex: 1; }
  .dica-bishop { flex-basis: 100%; }
}
