:root {
  --bg-a: #e9ecfb;
  --bg-b: #fdeef3;
  --card: #ffffff;
  --text: #201f1e;
  --text-dim: #3b3a39;
  --accent: #0067b8;
  --accent-hover: #005aa1;
  --muted-btn: #c8c8c8;
  --muted-btn-text: #1b1b1b;
  --border: #d9d9d9;
  --plomo: rgba(32, 31, 30, 0.55);
}

* {
  box-sizing: border-box;
}

html, body {
  height: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: sans-serif;
  color: var(--text);
  background: url("/assets/background.png") center center / cover no-repeat fixed,
    linear-gradient(135deg, var(--bg-a) 0%, var(--bg-b) 100%);
  position: relative;
  overflow: hidden;
}

.wrapper {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 20px;
  width: 100%;
  max-width: 440px;
}

.card {
  position: relative;
  width: 100%;
  padding: 46px 44px;
  background-color: var(--card);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
  min-width: 320px;
  border-radius: 0;
  display: flex;
  flex-direction: column;
}

#wizard {
  display: grid;
}

.loading-overlay {
  position: absolute;
  inset: 0;
  background: var(--card);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
}

.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.loading-text {
  font-size: 0.95rem;
  color: var(--text-dim);
  margin: 0;
}

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

.welcome-banner {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: var(--card);
  padding: 1rem 1.5rem;
  border-radius: 10px;
  box-shadow: 0 10px 40px rgba(20, 20, 50, 0.12);
  color: var(--text-dim);
  font-size: 0.95rem;
}

.welcome-banner .key-icon {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
}

#bienvenido-texto {
  font-family: "Segoe UI", system-ui, sans-serif;
  font-size: 15px;
  font-weight: 400;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.65rem;
}

.brand .logo {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  grid-template-rows: repeat(2, 1fr);
  gap: 1px;
  width: 24px;
  height: 24px;
  flex-shrink: 0;
}

.brand .logo i {
  display: block;
  border-radius: 1px;
}

.brand .logo i:nth-child(1) {
  background: #f25022;
}

.brand .logo i:nth-child(2) {
  background: #ffb900;
}

.brand .logo i:nth-child(3) {
  background: #7fba00;
}

.brand .logo i:nth-child(4) {
  background: #00a4ef;
}

.brand span {
  font-family: "Segoe UI", system-ui, sans-serif;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--plomo);
}

.step {
  grid-area: 1 / 1;
  display: flex;
  flex-direction: column;
  visibility: hidden;
}

.step.active {
  visibility: visible;
}

.step h1:not(.title-lg) {
  font-family: "Segoe UI", system-ui, sans-serif;
  font-size: 24px;
  font-weight: 600;
  margin: 0.4rem 0 1.2rem;
}

.back-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 1.2rem;
}

.back-arrow {
  background: none;
  border: none;
  padding: 0;
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1;
  color: var(--text-dim);
  cursor: pointer;
}

.prev-answer {
  font-size: 0.95rem;
  color: var(--text);
}

.title-lg {
  font-size: 1.3rem;
  font-weight: 700;
  margin: 0 0 1rem;
}

.hint-link {
  font-size: 0.8rem;
  font-family: inherit;
  margin: 0 0 1.4rem;
}

.field {
  margin-bottom: 2.05rem;
}

.field input {
  width: 100%;
  border: none;
  border-bottom: 1px solid rgba(0, 103, 184, 0.35);
  background: transparent;
  padding: 0.4rem 0.1rem;
  font-size: 0.95rem;
  color: var(--text);
}

.field input::placeholder {
  color: var(--plomo);
}

.field-password {
  position: relative;
}

.field-password input {
  padding-right: 1.75rem;
}

.toggle-visibility {
  position: absolute;
  right: 0;
  bottom: 0.35rem;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  color: var(--text-dim);
}

.toggle-visibility svg {
  width: 18px;
  height: 18px;
  display: block;
}

.field input:focus {
  outline: none;
  border-bottom: 1px solid var(--accent);
}

.field input.input-error {
  border-bottom: 2px solid #e81123;
}

.error-msg {
  font-size: 0.88rem;
  font-family: inherit;
  color: #e81123;
  margin: 0 0 1rem;
}

.hint {
  font-family: "Segoe UI", system-ui, sans-serif;
  font-size: 13px;
  font-weight: 400;
  color: var(--text);
  margin: 0 0 0.9rem;
}

.subhint {
  font-family: "Segoe UI", system-ui, sans-serif;
  font-size: 13px;
  font-weight: 400;
  margin: 0 0 0.75rem;
}

.link {
  color: var(--accent);
  text-decoration: none;
}

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

.actions {
  display: flex;
  justify-content: flex-end;
  margin-top: auto;
}

button {
  border: none;
  border-radius: 0;
  padding: 0.6rem 1.5rem;
  font-size: 0.85rem;
  cursor: pointer;
}

.button.primary {
  color: #fff;
  border-color: #0067b8;
  background-color: #0067b8;
  font-weight: 400;
}

.button.primary:hover {
  background-color: var(--accent-hover);
}

.done {
  text-align: center;
}

.done h1 {
  margin-bottom: 0.5rem;
}

.done p {
  color: var(--text-dim);
}

@media (max-width: 480px) {
  body {
    background: #ffffff;
    overflow-y: auto;
    align-items: flex-start;
  }

  .wrapper {
    max-width: 100%;
    width: 100%;
    min-height: 100vh;
    gap: 0;
  }

  .card {
    width: 100%;
    margin: 0;
    padding: 24px;
    border-radius: 0;
    box-shadow: none;
  }

  .welcome-banner {
    margin: 14px 0 1rem;
    padding: 1rem 1.5rem;
    border: 1px solid var(--border);
    border-radius: 0;
    box-shadow: none;
    font-size: 1.1rem;
  }

  .welcome-banner .key-icon {
    width: 28px;
    height: 28px;
  }

  .step h1 {
    font-size: 1.05rem;
    margin-bottom: 1.75rem;
  }

  .field {
    margin-bottom: 1.75rem;
  }

  .actions {
    gap: 0.5rem;
  }

  button {
    padding: 0.55rem 1.1rem;
    font-size: 0.85rem;
  }
}

/* Aviso de apellido: circulo rojo con signo de exclamacion */
.apellido-error {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: -1.5rem 0 1rem;
  font-size: 0.72rem;
}

.err-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #e81123;
  color: #fff;
  font-weight: 700;
  font-size: 9px;
  line-height: 1;
}

/* Que el aviso oculto (hidden) siga oculto aunque tenga display: flex */
.apellido-error[hidden] {
  display: none;
}
