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

:root {
  --blue: #00e510;
  --blue-dark: #00b80d;
  --blue-light: #eafff0;
  --green: #00e510;
  --red: #DC2626;
  --gray-50: #F8FAFC;
  --gray-100: #F1F5F9;
  --gray-200: #E2E8F0;
  --gray-400: #94A3B8;
  --gray-500: #64748B;
  --gray-700: #334155;
  --gray-900: #0F172A;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(0,0,0,.08), 0 4px 16px rgba(0,0,0,.06);
  --shadow-hover: 0 2px 8px rgba(0,0,0,.1), 0 8px 24px rgba(0,0,0,.08);
}

html { font-size: 16px; -webkit-text-size-adjust: 100%; }

body {
  font-family: 'Nunito Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--gray-50);
  color: var(--gray-900);
  min-height: 100vh;
  line-height: 1.5;
}

/* ── Layout ─────────────────────────────────── */
.page { display: flex; flex-direction: column; min-height: 100vh; }

/* ── Header ─────────────────────────────────── */
.header {
  background: white;
  border-bottom: 1px solid var(--gray-200);
  position: sticky; top: 0; z-index: 10;
}
.header-inner {
  max-width: 540px; margin: 0 auto;
  padding: 14px 20px;
  display: flex; align-items: center; justify-content: space-between;
}
.logo { display: flex; align-items: center; gap: 10px; }
.logo-text {
  font-size: 18px; font-weight: 700;
  color: var(--blue); letter-spacing: -0.3px;
}
.header-title {
  font-size: 13px; font-weight: 500;
  color: var(--gray-500);
}

/* ── Progress bar ───────────────────────────── */
.progress-bar {
  height: 3px; background: var(--gray-200);
  position: sticky; top: 56px; z-index: 9;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--blue-dark) 0%, var(--blue) 100%);
  transition: width .4s ease;
  width: 25%;
}

/* ── Steps nav ──────────────────────────────── */
.steps-nav {
  max-width: 540px; margin: 0 auto;
  padding: 20px 20px 0;
  display: flex; align-items: center;
}
.step-item {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  flex: 1;
}
.step-dot {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--gray-200);
  display: flex; align-items: center; justify-content: center;
  transition: all .3s ease;
}
.step-dot span {
  font-size: 13px; font-weight: 600;
  color: var(--gray-400);
  transition: color .3s;
}
.step-label {
  font-size: 11px; font-weight: 500;
  color: var(--gray-400);
  white-space: nowrap;
  transition: color .3s;
}
.step-divider {
  flex: 1; height: 2px; background: var(--gray-200);
  margin: 0 4px; margin-bottom: 24px;
  transition: background .3s;
}

.step-item.active .step-dot { background: var(--blue); }
.step-item.active .step-dot span { color: white; }
.step-item.active .step-label { color: var(--blue); font-weight: 600; }
.step-item.done .step-dot { background: var(--green); }
.step-item.done .step-dot span { color: white; }
.step-item.done .step-label { color: var(--green); }
.step-item.done ~ .step-divider { background: var(--green); }

/* ── Main / Card ────────────────────────────── */
.main {
  max-width: 540px; margin: 0 auto;
  padding: 20px 16px 40px;
  flex: 1;
  position: relative;
}

.card {
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 28px 24px;
  box-shadow: var(--shadow);
  display: none;
}
.card.active { display: block; }

/* Card animations */
.card.slide-in {
  animation: slideIn .3s ease forwards;
}
.card.slide-out {
  animation: slideOut .2s ease forwards;
}
@keyframes slideIn {
  from { opacity: 0; transform: translateX(30px); }
  to   { opacity: 1; transform: translateX(0); }
}
@keyframes slideOut {
  from { opacity: 1; transform: translateX(0); }
  to   { opacity: 0; transform: translateX(-30px); }
}

/* ── Card header ────────────────────────────── */
.card-header {
  display: flex; align-items: flex-start; gap: 14px;
  margin-bottom: 24px;
}
.card-icon {
  width: 44px; height: 44px; border-radius: 10px;
  background: var(--blue-light);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.card-title {
  font-size: 18px; font-weight: 700;
  color: var(--gray-900); line-height: 1.3;
}
.card-subtitle {
  font-size: 13px; color: var(--gray-500); margin-top: 2px;
}

/* ── Form ───────────────────────────────────── */
.form-group { margin-bottom: 20px; }
.form-group label {
  display: block; font-size: 13px; font-weight: 600;
  color: var(--gray-700); margin-bottom: 7px;
}
.form-group input {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--gray-200);
  border-radius: 8px;
  font-size: 15px; font-family: inherit;
  color: var(--gray-900);
  background: white;
  transition: border-color .2s, box-shadow .2s;
  outline: none;
}
.form-group input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(0,229,16,.15);
}
.form-group input.error { border-color: var(--red); }
.form-group input::placeholder { color: var(--gray-400); }

.input-wrap { position: relative; }
.input-wrap input { padding-right: 44px; }
.btn-eye {
  position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
  background: none; border: none; cursor: pointer;
  color: var(--gray-400); padding: 2px; line-height: 0;
  transition: color .2s;
}
.btn-eye:hover { color: var(--gray-700); }

.field-hint {
  display: block; font-size: 12px; color: var(--gray-400); margin-top: 6px;
}

/* ── Password strength ──────────────────────── */
.strength-bar {
  height: 4px; background: var(--gray-200); border-radius: 2px;
  margin-top: 8px; overflow: hidden;
}
.strength-fill {
  height: 100%; border-radius: 2px;
  transition: width .3s ease, background .3s ease;
  width: 0%;
}
.strength-label {
  display: block; font-size: 11px; font-weight: 500;
  margin-top: 4px; color: var(--gray-400);
}
.strength-label.fraca  { color: var(--red); }
.strength-label.media  { color: #D97706; }
.strength-label.forte  { color: var(--green); }

/* ── Match hint ─────────────────────────────── */
.match-hint {
  display: block; font-size: 12px; margin-top: 6px; font-weight: 500;
}
.match-hint.ok  { color: var(--green); }
.match-hint.err { color: var(--red); }

/* ── Error box ──────────────────────────────── */
.error-box {
  background: #FEF2F2; border: 1px solid #FECACA;
  border-radius: 8px; padding: 12px 14px;
  font-size: 13px; color: #B91C1C;
  margin-bottom: 16px;
}

/* ── Buttons ────────────────────────────────── */
.btn-primary {
  width: 100%; padding: 13px;
  background: var(--blue);
  color: #0a1a0a; font-size: 15px; font-weight: 700;
  border: none; border-radius: 8px;
  cursor: pointer; font-family: inherit;
  transition: background .2s, transform .1s, box-shadow .2s;
  margin-top: 4px;
}
.btn-primary:hover { background: var(--blue-dark); box-shadow: 0 4px 12px rgba(0,229,16,.3); }
.btn-primary:active { transform: scale(.98); }
.btn-primary:disabled {
  background: var(--gray-400); cursor: not-allowed;
  box-shadow: none; transform: none;
}

.btn-secondary {
  padding: 13px 20px;
  background: white; color: var(--gray-700);
  font-size: 15px; font-weight: 600;
  border: 1.5px solid var(--gray-200); border-radius: 8px;
  cursor: pointer; font-family: inherit;
  transition: background .2s, border-color .2s;
}
.btn-secondary:hover { background: var(--gray-100); border-color: var(--gray-400); }

.btn-row {
  display: flex; gap: 10px; margin-top: 4px;
}
.btn-row .btn-secondary { flex: 0 0 auto; }
.btn-row .btn-primary { flex: 1; }

/* ── Conexões list ──────────────────────────── */
.conexoes-list { margin-bottom: 16px; }

.conexao-item {
  border: 1.5px solid var(--gray-200);
  border-radius: 10px; padding: 14px 16px;
  margin-bottom: 10px; cursor: pointer;
  display: flex; align-items: center; gap: 14px;
  transition: all .2s;
}
.conexao-item:hover { border-color: var(--blue); background: var(--blue-light); }
.conexao-item:last-child { margin-bottom: 0; }

.conexao-icon {
  width: 40px; height: 40px; border-radius: 8px;
  background: var(--blue-light);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.conexao-body { flex: 1; min-width: 0; }
.conexao-endereco {
  font-size: 14px; font-weight: 600; color: var(--gray-900);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.conexao-meta {
  font-size: 12px; color: var(--gray-500); margin-top: 2px;
}
.conexao-arrow {
  color: var(--gray-400); flex-shrink: 0;
  transition: color .2s, transform .2s;
}
.conexao-item:hover .conexao-arrow { color: var(--blue); transform: translateX(2px); }

/* ── States (step 4) ────────────────────────── */
.state-center {
  display: flex; flex-direction: column; align-items: center;
  text-align: center; padding: 16px 0;
}
.state-title {
  font-size: 20px; font-weight: 700;
  color: var(--gray-900); margin-top: 20px;
}
.state-sub {
  font-size: 14px; color: var(--gray-500); margin-top: 8px;
  max-width: 300px; line-height: 1.6;
}

/* Spinner */
.spinner {
  width: 52px; height: 52px;
  border: 4px solid var(--gray-200);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Success ring */
.success-ring {
  width: 72px; height: 72px; border-radius: 50%;
  background: var(--green);
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 0 0 8px rgba(22,163,74,.15);
  animation: popIn .4s cubic-bezier(0.34,1.56,0.64,1) forwards;
}
/* Error ring */
.error-ring {
  width: 72px; height: 72px; border-radius: 50%;
  background: var(--red);
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 0 0 8px rgba(220,38,38,.15);
  animation: popIn .4s cubic-bezier(0.34,1.56,0.64,1) forwards;
}
@keyframes popIn {
  from { transform: scale(0); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}

/* Wi-Fi info card */
.wifi-card {
  background: var(--gray-50); border: 1px solid var(--gray-200);
  border-radius: 10px; padding: 16px 20px;
  width: 100%; margin-top: 20px; text-align: left;
}
.wifi-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.wifi-label { font-size: 13px; color: var(--gray-500); }
.wifi-value {
  font-size: 15px; color: var(--gray-900);
  word-break: break-all; text-align: right;
}
.wifi-divider { height: 1px; background: var(--gray-200); margin: 12px 0; }

.hint-small { font-size: 12px; color: var(--gray-400); margin-top: 12px; }

/* ── Footer ─────────────────────────────────── */
.footer {
  text-align: center; padding: 20px;
  font-size: 12px; color: var(--gray-400);
}

/* ── Modal ──────────────────────────────────── */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex; align-items: flex-end; justify-content: center;
  padding: 0 16px 24px;
  animation: fadeBackdrop .2s ease forwards;
}
@keyframes fadeBackdrop {
  from { opacity: 0; }
  to   { opacity: 1; }
}
.modal {
  background: white;
  border-radius: 20px;
  padding: 28px 24px 24px;
  width: 100%; max-width: 440px;
  box-shadow: 0 -4px 6px rgba(0,0,0,.04), 0 20px 60px rgba(0,0,0,.2);
  animation: slideUpModal .3s cubic-bezier(0.34,1.56,0.64,1) forwards;
}
@keyframes slideUpModal {
  from { opacity: 0; transform: translateY(40px) scale(.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.modal-icon {
  width: 52px; height: 52px; border-radius: 14px;
  background: var(--blue-light);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 16px;
}
.modal-title {
  font-size: 18px; font-weight: 700;
  color: var(--gray-900); margin-bottom: 6px;
}
.modal-desc {
  font-size: 13px; color: var(--gray-500); margin-bottom: 14px;
}
.modal-address {
  background: var(--gray-50);
  border: 1.5px solid var(--gray-200);
  border-radius: 10px;
  padding: 11px 14px;
  font-size: 14px; font-weight: 600; color: var(--gray-900);
  margin-bottom: 12px;
}
.modal-preview {
  background: var(--blue-light);
  border: 1.5px solid rgba(0,229,16,.25);
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 24px;
  display: flex; flex-direction: column; gap: 8px;
}
.modal-preview-row {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 13px;
}
.modal-preview-row span { color: var(--gray-500); }
.modal-preview-row strong { color: var(--gray-900); font-weight: 700; }
.modal-actions { display: flex; gap: 10px; }
.modal-actions .btn-secondary { flex: 0 0 auto; padding: 13px 20px; }
.modal-actions .btn-primary { flex: 1; margin-top: 0; }

/* ── Utilities ──────────────────────────────── */
.hidden { display: none !important; }

/* ── Responsive ─────────────────────────────── */
@media (max-width: 400px) {
  .card { padding: 22px 16px; }
  .card-title { font-size: 16px; }
  .step-label { font-size: 10px; }
}
