/* =====================================================================
   CADASTRO · wizard de autocadastro (tela de login)
   ---------------------------------------------------------------------
   Reusa o fundo imersivo + card do login (login.css) e o design system
   (despacha-ui.css). Aqui ficam o stepper, os passos animados, os
   seletores segmentados (PF/PJ) e os cards de modo de uso.
   ===================================================================== */

/* Card um pouco mais largo que o do login (tem mais campos) */
.wz-card {
  max-width: 560px;
  padding-top: 2rem;
}
.wz-head { margin-bottom: 1.25rem; }

/* ---------------- Indicador de passos ---------------- */
.wz-steps { margin: 0 0 1.5rem; }
.wz-steps__list {
  display: flex;
  justify-content: space-between;
  list-style: none;
  margin: 0 0 0.85rem;
  padding: 0;
}
.wz-steps__item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  flex: 1;
  min-width: 0;
}
.wz-steps__num {
  width: 2rem;
  height: 2rem;
  display: grid;
  place-items: center;
  border-radius: 50%;
  font-weight: 600;
  font-size: 0.9rem;
  background: var(--db-surface-2, #eef2f7);
  color: var(--db-text-soft);
  border: 2px solid transparent;
  transition: background 0.28s ease, color 0.28s ease, border-color 0.28s ease, transform 0.28s ease;
}
.wz-steps__label {
  font-size: 0.74rem;
  color: var(--db-text-soft);
  letter-spacing: 0.2px;
  transition: color 0.28s ease;
}
.wz-steps__item.is-active .wz-steps__num {
  background: var(--db-accent);
  color: #fff;
  transform: scale(1.06);
  box-shadow: 0 6px 16px rgba(0, 149, 217, 0.35);
}
.wz-steps__item.is-active .wz-steps__label { color: var(--db-text); font-weight: 600; }
.wz-steps__item.is-done .wz-steps__num {
  background: rgba(0, 149, 217, 0.14);
  color: var(--db-accent);
  border-color: rgba(0, 149, 217, 0.35);
}

/* Trilho de progresso */
.wz-steps__track {
  height: 5px;
  border-radius: 999px;
  background: var(--db-surface-2, #eef2f7);
  overflow: hidden;
}
.wz-steps__fill {
  height: 100%;
  width: 25%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--db-accent), #38bdf8);
  transition: width 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}

/* ---------------- Passos ---------------- */
.wz-step { display: none; }
.wz-step.is-active {
  display: block;
  animation: wz-step-in 0.38s cubic-bezier(0.22, 1, 0.36, 1) both;
}
@keyframes wz-step-in {
  from { opacity: 0; transform: translateX(14px); }
  to   { opacity: 1; transform: none; }
}
.wz-step.is-back.is-active { animation-name: wz-step-in-back; }
@keyframes wz-step-in-back {
  from { opacity: 0; transform: translateX(-14px); }
  to   { opacity: 1; transform: none; }
}
.wz-step__title {
  font-size: 1.12rem;
  font-weight: 600;
  color: var(--db-text);
  margin: 0 0 0.2rem;
}
.wz-step__hint {
  font-size: 0.86rem;
  color: var(--db-text-muted);
  margin: 0 0 1.15rem;
}
.wz-badge {
  font-size: 0.66rem;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  vertical-align: middle;
  padding: 0.12rem 0.5rem;
  border-radius: 999px;
  background: var(--db-surface-2, #eef2f7);
  color: var(--db-text-soft);
  font-weight: 600;
}

.wz-field { margin-bottom: 1rem; }

/* Select com ícone (UF) dentro do db-input-group: mesmo recuo dos inputs. */
.wz-form .db-input-group .form-select { padding-left: 2.6rem; flex: 1 1 auto; min-width: 0; }

/* Dica sob um campo: status da busca do endereço (CEP) e da empresa na Receita
   (CNPJ). O [hidden] precisa vencer o display:inline-flex herdado de
   .db-field-hint. */
.wz-hint { color: var(--db-text-soft); align-items: flex-start; line-height: 1.3; }
.wz-hint svg { flex: none; margin-top: 0.1rem; }
.wz-hint[hidden] { display: none; }
.wz-hint--ok { color: var(--db-success); }
.wz-hint--erro { color: var(--db-danger); }
/* `aviso` é o meio dos dois: CNPJ não encontrado, empresa baixada, fornecedor
   fora do ar. Nada disso impede o cadastro: é recado, não recusa, e por isso
   não leva o vermelho de erro. */
.wz-hint--aviso { color: var(--db-warning); }
.wz-hint--load svg { animation: db-spin 0.9s linear infinite; }

/* ---------------- Seletor segmentado PF/PJ ---------------- */
.wz-segment {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}
.wz-segment__opt {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 1.1rem 0.75rem;
  border: 1.5px solid var(--db-border);
  border-radius: var(--db-radius, 12px);
  cursor: pointer;
  color: var(--db-text-muted);
  background: #fff;
  transition: border-color 0.2s ease, background 0.2s ease, color 0.2s ease, transform 0.12s ease;
}
.wz-segment__opt:hover { border-color: var(--db-accent); }
.wz-segment__opt:active { transform: scale(0.98); }
.wz-segment__opt i { width: 26px; height: 26px; }
.wz-segment__opt span { font-weight: 600; font-size: 0.95rem; }
.wz-segment__input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.wz-segment__opt.is-active {
  border-color: var(--db-accent);
  background: rgba(0, 149, 217, 0.08);
  color: var(--db-accent);
  box-shadow: 0 4px 14px rgba(0, 149, 217, 0.16);
}

/* ---------------- Grid de endereço ---------------- */
.wz-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 0 0.75rem;
}
.wz-grid__c4  { grid-column: span 4; }
.wz-grid__c8  { grid-column: span 8; }
.wz-grid__c12 { grid-column: span 12; }
@media (max-width: 480px) {
  .wz-grid__c4, .wz-grid__c8 { grid-column: span 12; }
}

/* ---------------- Grade de ramo de negócio ---------------- */
.wz-ramo {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-bottom: 0.4rem;
}
.wz-ramo__opt {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 1.15rem 0.75rem;
  border: 1.5px solid var(--db-border);
  border-radius: var(--db-radius, 12px);
  cursor: pointer;
  background: #fff;
  text-align: center;
  transition: border-color 0.2s ease, background 0.2s ease, transform 0.12s ease, box-shadow 0.2s ease;
}
.wz-ramo__opt:hover { border-color: var(--db-accent); }
.wz-ramo__opt:active { transform: scale(0.98); }
.wz-ramo__input { position: absolute; opacity: 0; pointer-events: none; }
.wz-ramo__icon {
  width: 2.7rem;
  height: 2.7rem;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: var(--db-surface-2, #eef2f7);
  color: var(--db-text-soft);
  transition: background 0.2s ease, color 0.2s ease, transform 0.18s ease;
}
.wz-ramo__icon i { width: 24px; height: 24px; }
.wz-ramo__name { font-weight: 600; font-size: 0.9rem; color: var(--db-text); line-height: 1.2; }
.wz-ramo__opt--wide { grid-column: 1 / -1; }
.wz-ramo__check {
  position: absolute;
  top: 0.6rem;
  right: 0.6rem;
  width: 18px;
  height: 18px;
  color: var(--db-accent);
  opacity: 0;
  transform: scale(0.6);
  transition: opacity 0.18s ease, transform 0.18s ease;
}
.wz-ramo__opt.is-active {
  border-color: var(--db-accent);
  background: rgba(0, 149, 217, 0.06);
  box-shadow: 0 6px 18px rgba(0, 149, 217, 0.14);
}
.wz-ramo__opt.is-active .wz-ramo__icon { background: var(--db-accent); color: #fff; transform: scale(1.05); }
.wz-ramo__opt.is-active .wz-ramo__check { opacity: 1; transform: scale(1); }

.wz-note { margin-top: 0.9rem; }

@media (max-width: 480px) {
  .wz-ramo { grid-template-columns: 1fr; }
}

/* ---------------- Navegação ---------------- */
.wz-nav {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 1.5rem;
}
.wz-nav__back { margin-right: auto; }
.wz-nav__next, .wz-nav__submit { margin-left: auto; }

/* Saudação do CONVITE (conta criada pelo admin). O nome do cliente aparece logo
   no topo porque é o que prova, antes de qualquer campo, que o link é para ele:
   sem isso a tela é indistinguível de um cadastro do zero. */
.wz-convite-oi {
  margin: 0.6rem 0 0;
  font-size: 0.92rem;
  line-height: 1.45;
  color: var(--db-text-soft);
}
.wz-convite-oi strong { color: var(--db-text); }

/* Resumo do que o admin já preencheu. Nasceu na tela de conferência do convite e
   veio para cá quando o wizard reduzido passou a mostrar o mesmo bloco (macro em
   `auth/_convite_resumo.html`): as duas telas carregam este CSS. */
.cvc-resumo {
  display: grid; gap: 0.15rem; margin: 1.1rem 0 0.7rem;
  border: 1px solid var(--db-border); border-radius: 14px; padding: 0.5rem 0.2rem;
  background: color-mix(in srgb, var(--db-surface-2) 55%, transparent);
}
.cvc-item { display: flex; align-items: center; gap: 0.65rem; padding: 0.42rem 0.75rem; }
.cvc-item__ic {
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; flex: 0 0 30px; border-radius: 9px;
  background: color-mix(in srgb, var(--db-accent) 12%, transparent);
  color: var(--db-accent);
}
.cvc-item__ic svg { width: 15px; height: 15px; }
.cvc-item__txt { display: flex; flex-direction: column; min-width: 0; }
.cvc-item__txt small { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--db-text-soft); }
.cvc-item__txt strong { font-size: 0.9rem; font-weight: 600; overflow-wrap: anywhere; }
.cvc-editar {
  display: inline-flex; align-items: center; gap: 0.35rem;
  font-size: 0.82rem; color: var(--db-accent); text-decoration: none; margin-bottom: 1.1rem;
}
.cvc-editar:hover { text-decoration: underline; }
.cvc-editar svg { width: 14px; height: 14px; }
/* Virou nota, não link: o cadastro que o admin preencheu não se corrige aqui
   (convite.campos_travados). Mesma caixa, sem a cor de ação: azul sublinhado
   prometeria um clique que não existe. */
.cvc-editar--nota { color: var(--db-text-soft); }
.cvc-editar--nota:hover { text-decoration: none; }

/* "Parte do seu cadastro já está preenchida", recolhido de propósito: quem abre
   o convite quer terminar, não reler o que não digitou. Aberto, mostra o resumo e
   o caminho para corrigir. */
.wz-jafeito {
  border: 1px solid var(--db-border); border-radius: 14px;
  padding: 0.55rem 0.85rem; margin-bottom: 1.1rem;
  background: color-mix(in srgb, var(--db-success) 6%, transparent);
}
.wz-jafeito > summary {
  display: flex; align-items: center; gap: 0.5rem; cursor: pointer; list-style: none;
  font-size: 0.85rem; color: var(--db-text-soft);
}
.wz-jafeito > summary::-webkit-details-marker { display: none; }
.wz-jafeito__ok { width: 16px; height: 16px; flex: 0 0 16px; color: var(--db-success); }
.wz-jafeito__caret { width: 15px; height: 15px; flex: 0 0 15px; margin-left: auto; transition: transform .15s ease; }
.wz-jafeito[open] > summary .wz-jafeito__caret { transform: rotate(180deg); }
.wz-jafeito .cvc-resumo { margin-top: 0.7rem; background: var(--db-surface); }
.wz-jafeito .cvc-editar { margin-bottom: 0.3rem; }

.wz-foot { margin-top: 1.25rem; }
.wz-foot svg { width: 15px; height: 15px; vertical-align: -2px; margin-right: 0.25rem; }
.wz-foot a { color: var(--db-accent); text-decoration: none; }
.wz-foot a:hover { text-decoration: underline; }
/* Linha dos documentos: fica ACIMA do "já tem conta?", em bloco próprio, para
   não competir com o link de login pelo mesmo eixo. */
.wz-foot__termos { display: block; margin-bottom: 0.5rem; font-size: 0.82rem; opacity: 0.85; }

@media (prefers-reduced-motion: reduce) {
  .wz-step.is-active { animation: none; }
  .wz-steps__fill { transition: none; }
}
