.m12-recovery[hidden] {
  display: none !important;
}

.m12-recovery {
  position: fixed;
  inset: 0;
  z-index: 100100;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgb(5 7 12 / 78%);
  backdrop-filter: blur(8px);
}

/* M12.3: flicker-fix oculta los hijos directos de <body> mientras el Vault
   está bloqueado. El modal de recuperación es una excepción de seguridad
   y debe quedar por encima de #vaultModal (z-index: 99999). */
html[data-boot="1"] body > #m12RecoveryModal[aria-hidden="false"],
html[data-app-locked="true"] body > #m12RecoveryModal[aria-hidden="false"],
body[data-app-locked] > #m12RecoveryModal[aria-hidden="false"],
body.app-locked > #m12RecoveryModal[aria-hidden="false"] {
  display: grid !important;
}

.m12-recovery__username-field {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0 0 0 0) !important;
  clip-path: inset(50%) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.m12-recovery__panel {
  width: min(100%, 560px);
  max-height: calc(100dvh - 36px);
  overflow: auto;
  border: 1px solid rgb(166 142 246 / 55%);
  border-radius: 18px;
  background: #171722;
  box-shadow: 0 24px 80px rgb(0 0 0 / 48%);
  color: #fff;
}

.m12-recovery__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 20px 22px 16px;
  border-bottom: 1px solid rgb(255 255 255 / 10%);
}

.m12-recovery__header h3 {
  margin: 0;
  font-size: 1.35rem;
}

.m12-recovery__header p {
  margin: 5px 0 0;
  color: rgb(255 255 255 / 68%);
  font-size: 0.92rem;
}

.m12-recovery__close {
  min-width: 40px;
  min-height: 40px;
  border: 0;
  border-radius: 10px;
  background: rgb(255 255 255 / 8%);
  color: #fff;
  font-size: 1.65rem;
  line-height: 1;
  cursor: pointer;
}

.m12-recovery__form {
  display: grid;
  gap: 16px;
  padding: 20px 22px 22px;
}

.m12-recovery__notice {
  padding: 12px 14px;
  border: 1px solid rgb(166 142 246 / 42%);
  border-radius: 12px;
  background: rgb(166 142 246 / 10%);
  line-height: 1.45;
}

.m12-recovery label {
  display: grid;
  gap: 7px;
  font-weight: 650;
}

#m12RecoveryModal .m12-recovery__form input {
  width: 100%;
  min-height: 46px;
  box-sizing: border-box;
  border: 1px solid rgb(255 255 255 / 18%) !important;
  border-radius: 10px;
  background: #242433 !important;
  color: #fff !important;
  -webkit-text-fill-color: #fff !important;
  caret-color: #fff !important;
  opacity: 1 !important;
  padding: 10px 48px 10px 12px;
  font: inherit;
}

/* M12.5: dist/app.css define un color negro global con !important para todos
   los input. Estos selectores por nombre mantienen blancos los dígitos tanto
   con type=password como cuando el botón del ojo cambia el campo a type=text. */
#m12RecoveryModal input[name="password"],
#m12RecoveryModal input[name="newPin"],
#m12RecoveryModal input[name="confirmPin"] {
  color: #fff !important;
  -webkit-text-fill-color: #fff !important;
  caret-color: #fff !important;
}

#m12RecoveryModal input[name="password"]::selection,
#m12RecoveryModal input[name="newPin"]::selection,
#m12RecoveryModal input[name="confirmPin"]::selection {
  color: #fff;
  background: rgb(166 142 246 / 55%);
}

#m12RecoveryModal .m12-recovery__form input::placeholder {
  color: rgb(255 255 255 / 72%) !important;
  -webkit-text-fill-color: rgb(255 255 255 / 72%) !important;
  opacity: 1 !important;
}

.m12-recovery input:-webkit-autofill,
.m12-recovery input:-webkit-autofill:hover,
.m12-recovery input:-webkit-autofill:focus {
  -webkit-text-fill-color: #fff;
  caret-color: #fff;
  box-shadow: 0 0 0 1000px #242433 inset;
}

.m12-recovery__secret-field {
  position: relative;
  display: block;
}

.m12-recovery__visibility {
  position: absolute;
  top: 50%;
  right: 6px;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: rgb(255 255 255 / 76%);
  transform: translateY(-50%);
  cursor: pointer;
}

.m12-recovery__visibility:hover {
  background: rgb(255 255 255 / 9%);
  color: #fff;
}

.m12-recovery__visibility:focus-visible {
  outline: 2px solid #a68ef6;
  outline-offset: 1px;
}

.m12-recovery__eye {
  width: 22px;
  height: 22px;
  fill: currentColor;
}

.m12-recovery__eye--hide {
  display: none;
}

.m12-recovery__visibility[aria-pressed="true"] .m12-recovery__eye--show {
  display: none;
}

.m12-recovery__visibility[aria-pressed="true"] .m12-recovery__eye--hide {
  display: block;
}

#m12RecoveryModal .m12-recovery__form input:focus {
  outline: 3px solid rgb(166 142 246 / 25%);
  border-color: #a68ef6;
}

.m12-recovery__pin-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.m12-recovery__status {
  min-height: 1.4em;
  margin: 0;
  font-weight: 650;
}

.m12-recovery__status[data-kind="error"] {
  color: #ff9f9f;
}

.m12-recovery__status[data-kind="ok"] {
  color: #8ce6b4;
}

.m12-recovery__actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

#m12RecoveryModal[data-busy="1"] .m12-recovery__close,
#m12RecoveryModal[data-busy="1"] .m12-recovery__cancel {
  pointer-events: none;
  opacity: 0.55;
}

@media (max-width: 560px) {
  .m12-recovery {
    align-items: end;
    padding: 0;
  }

  .m12-recovery__panel {
    width: 100%;
    max-height: 92dvh;
    border-radius: 20px 20px 0 0;
  }

  .m12-recovery__pin-grid {
    grid-template-columns: 1fr;
  }

  .m12-recovery__actions > .btn {
    width: 100%;
  }
}
