/* ═══════════════════════════════════════════════════════════
   Migs Signup SPA — Shared design system
   Primary: #660EBA  Font: Poppins
   ═══════════════════════════════════════════════════════════ */

*,
*::before,
*::after {
  font-family: 'Poppins', sans-serif;
  box-sizing: border-box;
}

/* ── Layout ─────────────────────────────────────────────── */
.auth-wrap {
  display: grid;
  min-height: 100dvh;
  width: 100%;
  grid-template-columns: 1fr;
}

@media (min-width: 1280px) {
  .auth-wrap {
    grid-template-columns: 8fr 13fr;
  }
}

.auth-aside {
  display: none;
  flex-direction: column;
  justify-content: space-between;
  padding: 3rem;
  background: linear-gradient(to top right, #660EBA, #7763FF);
  overflow: hidden;
  isolation: isolate;
  position: sticky;
  top: 0;
  height: 100dvh;
  align-self: flex-start;
}

@media (min-width: 1280px) {
  .auth-aside {
    display: flex;
  }
}

.auth-aside>img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: -1;
  pointer-events: none;
}

.auth-panel {
  min-height: 100dvh;
  background: #fff;
  display: flex;
  flex-direction: column;
}

.auth-inner {
  margin: 0 auto;
  width: 100%;
  max-width: 36rem;
  padding: 3rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  flex: 1;
}

/* ── Form primitives ─────────────────────────────────────── */
.sig-label {
  display: block;
  font-size: .875rem;
  font-weight: 500;
  color: #111827;
  margin-bottom: .5rem;
  user-select: none;
}

.sig-label b {
  color: #660EBA;
}

.sig-input {
  display: block;
  width: 100%;
  height: 3rem;
  border: 1px solid #e2e8f0;
  border-radius: .375rem;
  padding: .25rem .75rem;
  font-size: .875rem;
  background: #fff;
  transition: border-color .15s, box-shadow .15s;
  outline: none;
  color: #111827;
}

.sig-input:focus {
  border-color: #660EBA;
  box-shadow: 0 0 0 3px rgba(102, 14, 186, .18);
}

.sig-input:disabled {
  background: #f8fafc;
  opacity: .7;
  cursor: not-allowed;
}

.sig-input::placeholder {
  color: #9ca3af;
}

select.sig-input {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%239ca3af' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right .75rem center;
  padding-right: 2.25rem;
}

.sig-row {
  display: flex;
  gap: .75rem;
  flex-direction: column;
}

@media (min-width: 640px) {
  .sig-row {
    flex-direction: row;
  }
}

.sig-row>* {
  flex: 1;
  min-width: 0;
}

.sig-field {
  display: flex;
  flex-direction: column;
  position: relative;
}

.sig-field-inner {
  position: relative;
}

/* ── Field error — compact, no box ─────────────────────── */
.field-err {
  display: none;
  align-items: center;
  gap: .25rem;
  font-size: .6875rem;
  font-weight: 500;
  color: #dc2626;
  margin-top: .25rem;
  line-height: 1.3;
}

.field-err.show {
  display: flex;
  animation: err-in .12s ease-out both;
}

.field-err svg {
  flex-shrink: 0;
  color: #ef4444;
  width: 12px;
  height: 12px;
}

@keyframes err-in {
  from {
    opacity: 0;
    transform: translateY(-3px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ── Input error state — stronger signal on the border ─── */
.sig-input.has-error {
  border-color: #ef4444;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, .1);
}

.sig-input.has-error:focus {
  border-color: #ef4444;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, .2);
}

/* ── Shake on submit ─────────────────────────────────────── */
@keyframes field-shake {

  0%,
  100% {
    transform: translateX(0);
  }

  20% {
    transform: translateX(-5px);
  }

  40% {
    transform: translateX(5px);
  }

  60% {
    transform: translateX(-3px);
  }

  80% {
    transform: translateX(3px);
  }
}

.sig-field.shake {
  animation: field-shake .3s ease;
}

/* ── Toggle switch ───────────────────────────────────────── */
.sig-toggle {
  position: relative;
  display: inline-block;
  width: 40px;
  height: 22px;
  flex-shrink: 0;
}

.sig-toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}

.sig-toggle-slider {
  position: absolute;
  inset: 0;
  background: #e5e7eb;
  border-radius: 22px;
  cursor: pointer;
  transition: .25s;
}

.sig-toggle-slider::before {
  content: '';
  position: absolute;
  height: 16px;
  width: 16px;
  left: 3px;
  bottom: 3px;
  background: white;
  border-radius: 50%;
  transition: .25s;
}

.sig-toggle input:checked+.sig-toggle-slider {
  background: #660EBA;
}

.sig-toggle input:checked+.sig-toggle-slider::before {
  transform: translateX(18px);
}

/* ── Curl / content-type checkbox tiles ──────────────────── */
.curl-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
}

.curl-tile input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.curl-box {
  width: 2.5rem;
  height: 2.5rem;
  border: 2px solid #e5e7eb;
  border-radius: .625rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .75rem;
  font-weight: 700;
  color: #6b7280;
  transition: border-color .15s, background .15s, color .15s;
  cursor: pointer;
}

.curl-tile input:checked~.curl-box {
  border-color: #660EBA;
  background: #faf5ff;
  color: #660EBA;
}

.content-tile {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .625rem .75rem;
  border: 1px solid #e5e7eb;
  border-radius: .625rem;
  cursor: pointer;
  transition: border-color .15s, background .15s;
  font-size: .75rem;
  color: #374151;
}

.content-tile input {
  width: 1rem;
  height: 1rem;
  accent-color: #660EBA;
  cursor: pointer;
  flex-shrink: 0;
}

.content-tile:has(input:checked) {
  border-color: #660EBA;
  background: #faf5ff;
  color: #660EBA;
}

/* ── Social input with prefix ────────────────────────────── */
.social-input-wrap {
  display: flex;
  align-items: center;
  border: 1px solid #e2e8f0;
  border-radius: .375rem;
  overflow: hidden;
  transition: border-color .15s, box-shadow .15s;
}

.social-input-wrap:focus-within {
  border-color: #660EBA;
  box-shadow: 0 0 0 3px rgba(102, 14, 186, .18);
}

.social-prefix {
  padding: 0 .75rem;
  height: 3rem;
  background: #f8fafc;
  color: #9ca3af;
  font-size: .875rem;
  border-right: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  white-space: nowrap;
  flex-shrink: 0;
}

.social-input-wrap input {
  flex: 1;
  min-width: 0;
  height: 3rem;
  padding: 0 .75rem;
  border: none;
  outline: none;
  font-size: .875rem;
  color: #111827;
  background: transparent;
}

.social-input-wrap input::placeholder {
  color: #9ca3af;
}

/* ── Checkbox ────────────────────────────────────────────── */
.sig-checkbox {
  appearance: none;
  -webkit-appearance: none;
  width: 1.25rem;
  height: 1.25rem;
  border-radius: .375rem;
  border: 2px solid #d1d5db;
  padding: 2px;
  background-color: #fff;
  background-clip: content-box;
  cursor: pointer;
  flex-shrink: 0;
  transition: border-color .2s ease, background-color .2s ease;
}

.sig-checkbox:hover:not(:checked) {
  border-color: #a78bfa;
  background-color: #f5f3ff;
}

.sig-checkbox:checked {
  background-color: #660EBA;
  border-color: #660EBA;
}

.sig-checkbox:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(102, 14, 186, .18);
}

/* ── Buttons ─────────────────────────────────────────────── */
.btn-primary {
  height: 3rem;
  padding: 0 2rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  background: linear-gradient(to right, #660EBA, #7763FF);
  color: #fff;
  font-size: .875rem;
  font-weight: 600;
  border: none;
  border-radius: .75rem;
  cursor: pointer;
  transition: opacity .2s, box-shadow .2s;
}

.btn-primary:hover:not(:disabled) {
  opacity: .9;
  box-shadow: 0 4px 16px rgba(102, 14, 186, .25);
}

.btn-primary:disabled {
  opacity: .5;
  cursor: not-allowed;
}

.btn-ghost {
  height: 3rem;
  padding: 0 1.5rem;
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  background: transparent;
  color: #6b7280;
  font-size: .875rem;
  font-weight: 500;
  border: none;
  border-radius: .375rem;
  cursor: pointer;
  text-decoration: none;
  transition: color .15s;
}

.btn-ghost:hover {
  color: #111827;
}

.btn-link {
  display: inline-flex;
  align-items: center;
  gap: .25rem;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  color: #660EBA;
  font-size: .875rem;
  font-weight: 500;
  text-decoration: none;
}

.btn-link:hover {
  text-decoration: underline;
}

/* ── Toast (JS-driven — class names referenced in utils.js) ── */
.toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 9999;
  display: flex;
  flex-direction: column-reverse;
  gap: .5rem;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: .625rem;
  padding: .75rem 1rem;
  border-radius: .875rem;
  font-size: .8125rem;
  font-weight: 500;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .12), 0 2px 6px rgba(0, 0, 0, .07);
  max-width: 22rem;
  pointer-events: all;
  animation: toast-in .28s cubic-bezier(.34, 1.56, .64, 1) both;
}

.toast.removing {
  animation: toast-out .2s ease-in both;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateX(1.25rem) scale(.96);
  }

  to {
    opacity: 1;
    transform: translateX(0) scale(1);
  }
}

@keyframes toast-out {
  from {
    opacity: 1;
    transform: translateX(0) scale(1);
  }

  to {
    opacity: 0;
    transform: translateX(1.25rem) scale(.96);
  }
}

.toast-icon {
  flex-shrink: 0;
  display: flex;
}

.toast-msg {
  flex: 1;
}

.toast-close {
  flex-shrink: 0;
  background: none;
  border: none;
  cursor: pointer;
  padding: .125rem;
  opacity: .6;
  line-height: 1;
  color: inherit;
  border-radius: .25rem;
}

.toast-close:hover {
  opacity: 1;
}

.toast.error {
  background: #fef2f2;
  color: #b91c1c;
  border: 1px solid #fca5a5;
}

.toast.success {
  background: #f0fdf4;
  color: #15803d;
  border: 1px solid #86efac;
}

.toast.warning {
  background: #fffbeb;
  color: #92400e;
  border: 1px solid #fde68a;
}

.toast.info {
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
}

/* ── Spinner keyframes (referenced by cep-spinner inline style) ── */
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ── Password requirements ───────────────────────────────── */
.pw-toggle {
  position: absolute;
  right: .25rem;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  padding: .5rem;
  color: #660EBA;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: .25rem;
}

.pw-toggle:hover {
  background: #f3f0ff;
}

.pw-reqs {
  display: none;
  flex-direction: column;
  gap: .3rem;
  font-size: .75rem;
  border: 1px solid #e2e8f0;
  border-radius: .375rem;
  background: rgba(255, 255, 255, .95);
  backdrop-filter: blur(8px);
  padding: .75rem;
  margin-top: .25rem;
  z-index: 20;
}

.pw-reqs.show {
  display: flex;
}

@media (min-width: 640px) {
  .pw-reqs {
    position: absolute;
    top: calc(100% + .25rem);
    left: 0;
    width: 100%;
    margin-top: 0;
  }
}

.pw-req {
  display: flex;
  align-items: center;
  gap: .35rem;
}

.pw-req.ok {
  color: #22c55e;
}

.pw-req.fail {
  color: #ef4444;
}

/* ── Legacy banner ───────────────────────────────────────── */
#legacy-banner {
  display: none;
  border: 1px solid #c4b5fd;
  background: #faf5ff;
  border-radius: .75rem;
  padding: 1rem;
}

#legacy-banner.show {
  display: block;
}

/* ── CEP spinner ─────────────────────────────────────────── */
#cep-spinner {
  display: none;
  position: absolute;
  right: .75rem;
  top: 50%;
  transform: translateY(-50%);
}

#cep-spinner.show {
  display: block;
}

/* O SVG do logo vem com dimensões próprias; aqui ele passa a acompanhar a
   altura definida pelo invólucro, preservando a escala por breakpoint. */
.aside-logo > svg {
  display: block;
  height: 100%;
  width: auto;
}

/* ── Passos do aside ─────────────────────────────────────────
   O estado de cada passo vem de data-state, para que fluxos com etapas
   controladas no navegador (verificação de identidade) atualizem a lista
   sem recarregar a página. */
.aside-step {
  display: flex;
  align-items: center;
}

.aside-step-dot {
  border-radius: 9999px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background .3s, border-color .3s;
}

.aside-step-check,
.aside-step-num {
  display: none;
  line-height: 1;
}

.aside-step-label {
  transition: color .3s;
}

.aside-step[data-state="done"] .aside-step-dot {
  background: rgba(255, 255, 255, .25);
}

.aside-step[data-state="done"] .aside-step-check {
  display: block;
}

.aside-step[data-state="done"] .aside-step-label {
  color: rgba(255, 255, 255, .65);
}

.aside-step[data-state="active"] .aside-step-dot {
  background: #fff;
}

.aside-step[data-state="active"] .aside-step-num {
  display: block;
  color: #660EBA;
  font-weight: 700;
}

.aside-step[data-state="active"] .aside-step-label {
  color: #fff;
  font-weight: 600;
}

.aside-step[data-state="pending"] .aside-step-dot {
  border: 1.5px solid rgba(255, 255, 255, .3);
}

.aside-step[data-state="pending"] .aside-step-num {
  display: block;
  color: rgba(255, 255, 255, .4);
}

.aside-step[data-state="pending"] .aside-step-label {
  color: rgba(255, 255, 255, .4);
}

/* ── Cabeçalho de progresso do cadastro ──────────────────── */
.signup-progress {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.signup-progress-track {
  display: flex;
  align-items: center;
  gap: .625rem;
  flex: 1;
  min-width: 0;
}

.signup-progress-current {
  font-size: .8125rem;
  font-weight: 700;
  color: #111827;
  flex-shrink: 0;
}

.signup-progress-total {
  font-size: .8125rem;
  font-weight: 700;
  color: #9ca3af;
  flex-shrink: 0;
}

.signup-progress-bar {
  flex: 1;
  height: 6px;
  background: #ede9fe;
  border-radius: 9999px;
  overflow: hidden;
}

.signup-progress-fill {
  height: 100%;
  background: linear-gradient(to right, #660EBA, #7763FF);
  border-radius: 9999px;
  transition: width .4s ease;
}

.signup-progress-sep {
  width: 1px;
  height: 1.5rem;
  background: #e5e7eb;
  flex-shrink: 0;
}

/* A identidade é o gatilho do menu de saída, então precisa se comportar como botão */
.signup-user-menu {
  position: relative;
  flex-shrink: 0;
}

.signup-user {
  display: flex;
  align-items: center;
  gap: .5rem;
  flex-shrink: 0;
  padding: .25rem .5rem .25rem .25rem;
  border: 1px solid transparent;
  border-radius: 9999px;
  background: none;
  cursor: pointer;
  transition: background .15s, border-color .15s;
}

.signup-user:hover,
.signup-user[aria-expanded="true"] {
  background: #faf5ff;
  border-color: #ede9fe;
}

.signup-user-caret {
  color: #9ca3af;
  flex-shrink: 0;
  transition: transform .15s;
}

.signup-user[aria-expanded="true"] .signup-user-caret {
  transform: rotate(180deg);
}

.signup-user-dropdown {
  position: absolute;
  top: calc(100% + .375rem);
  right: 0;
  z-index: 20;
  min-width: 11rem;
  padding: .25rem;
  border: 1px solid #e5e7eb;
  border-radius: .75rem;
  background: #fff;
  box-shadow: 0 10px 24px rgba(17, 24, 39, .12);
}

.signup-user-dropdown[hidden] {
  display: none;
}

.signup-user-item {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .5rem .625rem;
  border-radius: .5rem;
  color: #374151;
  font-size: .875rem;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
  transition: background .15s, color .15s;
}

.signup-user-item:hover {
  background: #fef2f2;
  color: #b91c1c;
}

.signup-avatar {
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  border: 1.5px solid #660EBA;
  color: #660EBA;
  font-size: .6875rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  user-select: none;
}

.signup-username {
  font-size: .875rem;
  font-weight: 500;
  color: #374151;
  white-space: nowrap;
}

/* ── Campo travado (preenchido automaticamente pelo CEP) ── */
.lock-icon {
  display: none;
  position: absolute;
  right: .75rem;
  top: 1.5rem;
  transform: translateY(-50%);
  color: #9ca3af;
  pointer-events: none;
}

.sig-input.is-locked {
  background: #f3f4f6;
  color: #4b5563;
  cursor: default;
  padding-right: 2.25rem;
}

.sig-input.is-locked:focus {
  border-color: #e2e8f0;
  box-shadow: none;
}

.sig-input.is-locked ~ .lock-icon {
  display: flex;
}