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

:root {
  --bg:        #080b12;
  --surface:   #0d1117;
  --border:    #1e2533;
  --accent:    #6c63ff;
  --accent2:   #a78bfa;
  --text:      #e2e8f0;
  --muted:     #64748b;
  --error:     #f87171;
  --glow:      rgba(108, 99, 255, 0.35);
}

html, body {
  height: 100%;
  font-family: 'Inter', sans-serif;
  background: var(--bg);
  color: var(--text);
  overflow: hidden;
}

/* ── Fundo animado ── */
.bg-canvas {
  position: fixed; inset: 0; z-index: 0;
  overflow: hidden;
}
.bg-canvas::before {
  content: '';
  position: absolute;
  width: 700px; height: 700px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(108,99,255,0.12) 0%, transparent 70%);
  top: -200px; left: -150px;
  animation: drift1 14s ease-in-out infinite alternate;
}
.bg-canvas::after {
  content: '';
  position: absolute;
  width: 500px; height: 500px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(167,139,250,0.10) 0%, transparent 70%);
  bottom: -180px; right: -100px;
  animation: drift2 18s ease-in-out infinite alternate;
}

@keyframes drift1 {
  from { transform: translate(0, 0) scale(1); }
  to   { transform: translate(60px, 80px) scale(1.15); }
}
@keyframes drift2 {
  from { transform: translate(0, 0) scale(1); }
  to   { transform: translate(-50px, -60px) scale(1.2); }
}

/* Grid de pontos */
.dot-grid {
  position: fixed; inset: 0; z-index: 0;
  background-image:
    radial-gradient(circle, rgba(255,255,255,0.03) 1px, transparent 1px);
  background-size: 32px 32px;
}

/* ── Card ── */
.wrapper {
  position: relative; z-index: 10;
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh;
  padding: 1.5rem;
}

.card {
  width: 100%; max-width: 400px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 2.5rem 2.25rem;
  position: relative;
  animation: slideUp .6s cubic-bezier(.22,1,.36,1) both;
  box-shadow:
    0 0 0 1px rgba(108,99,255,.06),
    0 8px 48px rgba(0,0,0,.55),
    0 0 80px var(--glow);
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(32px) scale(.97); }
  to   { opacity: 1; transform: translateY(0)    scale(1);   }
}

/* Linha decorativa topo */
.card::before {
  content: '';
  position: absolute; top: 0; left: 15%; right: 15%;
  height: 2px; border-radius: 0 0 8px 8px;
  background: linear-gradient(90deg, transparent, var(--accent), var(--accent2), transparent);
  opacity: .9;
}

/* ── Logo / Brand ── */
.brand {
  display: flex; align-items: center; gap: .65rem;
  margin-bottom: 2rem;
}
.brand-icon {
  width: 38px; height: 38px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 0 18px var(--glow);
}
.brand-icon svg { width: 20px; height: 20px; fill: #fff; }
.brand-name {
  font-size: 1.25rem; font-weight: 700; letter-spacing: .5px;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}

/* ── Títulos ── */
.card-title {
  font-size: 1.45rem; font-weight: 600;
  line-height: 1.3; margin-bottom: .4rem;
}
.card-sub {
  font-size: .85rem; color: var(--muted);
  margin-bottom: 2rem; font-weight: 400;
}

/* ── Campos ── */
.field { margin-bottom: 1.1rem; }
.field label {
  display: block;
  font-size: .75rem; font-weight: 500;
  color: var(--muted); letter-spacing: .5px;
  text-transform: uppercase; margin-bottom: .45rem;
}

.input-wrap {
  position: relative;
  display: flex; align-items: center;
}
.input-wrap .icon {
  position: absolute; left: 13px;
  color: var(--muted); font-size: .95rem;
  pointer-events: none; transition: color .25s;
}
.input-wrap .icon svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.input-wrap input {
  width: 100%; padding: .75rem .9rem .75rem 2.5rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text); font-size: .9rem; font-family: inherit;
  outline: none;
  transition: border-color .25s, box-shadow .25s;
}
.input-wrap input::placeholder { color: var(--muted); }
.input-wrap input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(108,99,255,.18);
}
.input-wrap:has(input:focus) .icon { color: var(--accent); }

/* toggle senha */
.toggle-pw {
  position: absolute; right: 12px;
  background: none; border: none; cursor: pointer;
  color: var(--muted); padding: 4px;
  display: flex; align-items: center;
  transition: color .2s;
}
.toggle-pw:hover { color: var(--text); }
.toggle-pw svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ── Lembrar / Esqueci ── */
.row-options {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 1.6rem; font-size: .8rem;
}
.checkbox-label {
  display: flex; align-items: center; gap: .5rem;
  color: var(--muted); cursor: pointer; user-select: none;
}
.checkbox-label input[type="checkbox"] { display: none; }
.checkbox-label .box {
  width: 16px; height: 16px; border-radius: 5px;
  border: 1.5px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  transition: background .2s, border-color .2s;
}
.checkbox-label input:checked ~ .box {
  background: var(--accent); border-color: var(--accent);
}
.checkbox-label .box svg {
  width: 10px; height: 10px; stroke: #fff; fill: none;
  stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round;
  opacity: 0; transition: opacity .15s;
}
.checkbox-label input:checked ~ .box svg { opacity: 1; }

.forgot {
  color: var(--accent2); text-decoration: none; font-weight: 500;
  transition: color .2s;
}
.forgot:hover { color: var(--accent); }

/* ── Botão ── */
.btn-login {
  width: 100%; padding: .85rem;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  border: none; border-radius: 12px;
  color: #fff; font-size: .95rem; font-weight: 600; font-family: inherit;
  cursor: pointer; position: relative; overflow: hidden;
  transition: opacity .2s, transform .15s, box-shadow .2s;
  box-shadow: 0 4px 24px var(--glow);
  letter-spacing: .3px;
}
.btn-login:hover  { opacity: .92; box-shadow: 0 6px 32px var(--glow); }
.btn-login:active { transform: scale(.98); }

/* ripple */
.btn-login .ripple {
  position: absolute; border-radius: 50%;
  background: rgba(255,255,255,.25);
  transform: scale(0); animation: ripple .55s linear;
  pointer-events: none;
}
@keyframes ripple {
  to { transform: scale(4); opacity: 0; }
}

/* Spinner dentro do botão */
.btn-login .spinner {
  display: none;
  width: 18px; height: 18px; margin: 0 auto;
  border: 2.5px solid rgba(255,255,255,.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
.btn-login.loading .btn-text { display: none; }
.btn-login.loading .spinner  { display: block; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Divider ── */
.divider {
  display: flex; align-items: center; gap: .75rem;
  margin: 1.5rem 0; color: var(--muted); font-size: .75rem;
}
.divider::before, .divider::after {
  content: ''; flex: 1; height: 1px; background: var(--border);
}

/* ── Cadastro ── */
.signup-row {
  text-align: center; font-size: .82rem; color: var(--muted);
}
.signup-row a {
  color: var(--accent2); font-weight: 500; text-decoration: none;
  transition: color .2s;
}
.signup-row a:hover { color: var(--accent); }

/* ── Modal de feedback ── */
.modal-overlay {
  position: fixed; inset: 0; z-index: 9999;
  display: flex; align-items: center; justify-content: center;
  padding: 1.5rem;
  background: rgba(8, 11, 18, 0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  opacity: 0; pointer-events: none;
  transition: opacity .3s ease;
}
.modal-overlay.show {
  opacity: 1; pointer-events: all;
}

.modal-box {
  width: 100%; max-width: 360px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 2rem 1.75rem 1.5rem;
  position: relative;
  text-align: center;
  transform: scale(.88) translateY(24px);
  transition: transform .35s cubic-bezier(.22,1,.36,1);
  box-shadow: 0 8px 48px rgba(0,0,0,.6);
}
.modal-overlay.show .modal-box {
  transform: scale(1) translateY(0);
}

/* Tipo: erro */
.modal-box.is-error  { border-top: 2px solid var(--error); box-shadow: 0 0 60px rgba(248,113,113,.18), 0 8px 48px rgba(0,0,0,.6); }
/* Tipo: sucesso */
.modal-box.is-success { border-top: 2px solid #34d399; box-shadow: 0 0 60px rgba(52,211,153,.18), 0 8px 48px rgba(0,0,0,.6); }

/* Ícone */
.modal-icon {
  width: 60px; height: 60px; border-radius: 50%;
  margin: 0 auto 1.1rem;
  display: flex; align-items: center; justify-content: center;
  position: relative;
}
.modal-icon::before {
  content: '';
  position: absolute; inset: -6px;
  border-radius: 50%;
  animation: iconPulse 2s ease-in-out infinite;
}
.is-error  .modal-icon { background: rgba(248,113,113,.12); }
.is-error  .modal-icon::before { background: rgba(248,113,113,.08); }
.is-success .modal-icon { background: rgba(52,211,153,.12); }
.is-success .modal-icon::before { background: rgba(52,211,153,.08); }

.modal-icon svg { width: 28px; height: 28px; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; fill: none; }
.is-error  .modal-icon svg { stroke: var(--error); }
.is-success .modal-icon svg { stroke: #34d399; }

@keyframes iconPulse {
  0%, 100% { transform: scale(1);   opacity: 1; }
  50%       { transform: scale(1.18); opacity: 0; }
}

/* Textos */
.modal-title {
  font-size: 1.05rem; font-weight: 600; margin-bottom: .4rem;
}
.is-error  .modal-title { color: var(--error); }
.is-success .modal-title { color: #34d399; }

.modal-msg {
  font-size: .85rem; color: var(--muted); line-height: 1.55;
}

/* Barra de progresso (auto-fechar) */
.modal-progress {
  height: 3px; border-radius: 99px;
  margin-top: 1.4rem;
  overflow: hidden;
  background: var(--border);
}
.modal-progress-bar {
  height: 100%; border-radius: 99px;
  width: 100%;
  transform-origin: left;
  transition: none;
}
.modal-progress-bar.run {
  transition: transform linear;
  transform: scaleX(0);
}
.is-error  .modal-progress-bar { background: var(--error); }
.is-success .modal-progress-bar { background: #34d399; }

/* Botão fechar (X) */
.modal-close {
  position: absolute; top: 12px; right: 14px;
  background: none; border: none; cursor: pointer;
  color: var(--muted); font-size: 1.1rem; line-height: 1;
  padding: 4px 6px; border-radius: 6px;
  transition: color .2s, background .2s;
}
.modal-close:hover { color: var(--text); background: var(--border); }
