:root {
  --primary: #1A56DB;
  --primary-dark: #1748b8;
  --accent: #FFCA28;
  --text-dark: #1A1A1A;
  --text-medium: #6B7280;
  --text-soft: #9CA3AF;
  --border: #E5E7EB;
  --bg: #F8FAFB;
  --error: #DC2626;
  --success: #059669;
  --radius: 16px;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
  background: var(--bg);
  color: var(--text-dark);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

body {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
}

.card {
  width: 100%;
  max-width: 440px;
  background: #fff;
  border-radius: 24px;
  padding: 40px 32px 24px;
  box-shadow:
    0 1px 2px rgba(16, 24, 40, 0.04),
    0 12px 32px rgba(16, 24, 40, 0.08);
}

.brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-bottom: 32px;
  font-weight: 800;
  font-size: 28px;
  letter-spacing: -0.5px;
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: var(--accent);
  color: var(--primary);
  border-radius: 12px;
  font-size: 28px;
  font-weight: 800;
  line-height: 1;
}

.brand-name {
  color: var(--primary);
}

.state {
  display: none;
  text-align: center;
}

.state--visible {
  display: block;
}

.state[aria-hidden="false"] {
  display: block;
}

#state-form[aria-hidden="false"] {
  text-align: left;
}

.title {
  font-size: 22px;
  font-weight: 700;
  margin: 16px 0 8px;
  color: var(--text-dark);
}

.subtitle {
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-medium);
  margin: 0 0 24px;
}

.muted {
  color: var(--text-medium);
  font-size: 13px;
}

/* spinner inicial */
.spinner {
  width: 36px;
  height: 36px;
  margin: 24px auto 12px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* form */
.field {
  display: block;
  margin-bottom: 16px;
}

.field-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-dark);
  margin-bottom: 6px;
}

.input-wrapper {
  position: relative;
}

input[type="password"],
input[type="text"] {
  width: 100%;
  padding: 14px 44px 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 15px;
  color: var(--text-dark);
  background: #fff;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  font-family: inherit;
}

input::placeholder {
  color: var(--text-soft);
}

input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(26, 86, 219, 0.12);
}

input.invalid {
  border-color: var(--error);
}

input.invalid:focus {
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.12);
}

.toggle {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: 0;
  color: var(--text-soft);
  cursor: pointer;
  padding: 4px;
  display: inline-flex;
  border-radius: 8px;
}

.toggle:hover {
  color: var(--text-medium);
}

.error {
  display: block;
  color: var(--error);
  font-size: 12px;
  margin-top: 6px;
}

.checklist {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
}

.checklist li {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-medium);
  padding: 3px 0;
  transition: color 0.15s;
}

.checklist .dot {
  flex: 0 0 14px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 1.5px solid #CBD5E1;
  background: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}

.checklist li.met {
  color: var(--success);
}

.checklist li.met .dot {
  background: var(--success);
  border-color: var(--success);
}

.checklist li.met .dot::after {
  content: '';
  width: 4px;
  height: 7px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg) translate(-1px, -1px);
}

.error--block {
  margin: 16px 0 0;
  padding: 12px 14px;
  background: #FEF2F2;
  border: 1px solid #FECACA;
  border-radius: 12px;
  font-size: 13px;
}

/* botão */
.primary {
  width: 100%;
  background: var(--primary);
  color: #fff;
  border: 0;
  border-radius: var(--radius);
  padding: 16px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s, transform 0.05s;
  font-family: inherit;
  margin-top: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.primary:hover:not(:disabled) {
  background: var(--primary-dark);
}

.primary:active:not(:disabled) {
  transform: scale(0.99);
}

.primary:disabled {
  background: #93B4F0;
  cursor: not-allowed;
}

.btn-spinner {
  display: none;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.primary[aria-busy="true"] .btn-spinner {
  display: inline-block;
}

/* círculos de status */
.icon-circle {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: 8px 0 12px;
}

.icon-circle--success {
  background: #ECFDF5;
  color: var(--success);
}

.icon-circle--error {
  background: #FEF2F2;
  color: var(--error);
}

.footer {
  margin-top: 32px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  text-align: center;
}

.footer .muted {
  font-size: 12px;
}

@media (max-width: 480px) {
  .card {
    padding: 32px 24px 20px;
    border-radius: 20px;
  }
  .title {
    font-size: 20px;
  }
}
