body {
  background: linear-gradient(135deg, #1D2458, #2500a7 100%);
  min-height: 100svh;            /* ✅ mejor que 100vh en móvil */
  min-width: 0;                  /* ✅ evita forzar ancho extra */
  margin: 0;
  display: flex;
  justify-content: center;
  align-items: center;           /* ✅ centrado correcto */
  padding: env(safe-area-inset-top) env(safe-area-inset-right)
           env(safe-area-inset-bottom) env(safe-area-inset-left);
  overflow-x: hidden;
  font-family: 'Roboto', Arial, sans-serif; /* ✅ estaba 'Reboto' */
}

/* Ajuste responsive: ancho fluido y centrado */
.form-container {
  background: #fff;
  border-radius: 32px;
  box-shadow: 0 8px 32px rgba(60, 30, 90, 0.15);
  width: 100%;
  max-width: 380px;
  padding: 32px 28px 24px 28px;
  position: relative;
  margin: 0 auto;
  box-sizing: border-box;
}

/* NUEVO BLOQUE UNIFICADO PARA FORMULARIO */
.form-container input[type="number"],
.form-container input[type="password"],
.form-container select,
.form-container button {
  width: 100%;
  padding: 12px 12px;
  border-radius: 8px;
  font-size: 1.08rem;
  box-sizing: border-box;
  display: block;
}

.form-container input[type="number"],
.form-container input[type="password"],
.form-container select {
  margin-bottom: 12px;
  border: 1.5px solid #d1d1d1;
  background: #fafaff;
  transition: border 0.2s;
}

.form-container input[type="number"]:focus,
.form-container input[type="password"]:focus,
.form-container select:focus {
  border-color: #7d2ae8;
  outline: none;
  background: #f6f3ff;
}

.form-container button {
  background: #3069f7;
  color: #fff;
  border: none;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
  margin-top: 24px;
}

.form-container button:hover {
  background: #1b44b8;
}

/* -------- RESTO DE TU CSS (sin cambios) -------- */
.progress-bar-bg {
  width: 100%;
  height: 6px;
  background: #e6e6e6;
  border-radius: 6px;
  margin-bottom: 22px;
  overflow: hidden;
}
.progress-bar {
  width: 18%;
  height: 100%;
  background: linear-gradient(90deg, #00e68a, #36c1f3);
  border-radius: 6px;
  transition: width 0.5s;
}
h2 {
  font-size: 1.4rem;
  font-weight: 700;
  margin-bottom: 22px;
  color: #23223a;
  text-align: center;
}
label {
  display: block;
  font-size: 1rem;
  margin-bottom: 5px;
  margin-top: 16px;
  font-weight: 500;
  color: #23223a;
}

/* -------- MODAL ESTILOS -------- */
.modal-box {
  display: flex;
  flex-direction: column;
  align-items: center;
}
.modal-box .modal-buttons {
  display: flex;
  flex-direction: row;
  gap: 12px;
  justify-content: center;
  margin-top: 8px;
  width: 100%;
}
.modal-box button {
  width: auto !important;
  min-width: 80px;
  padding: 9px 22px;
  border: none;
  border-radius: 6px;
  background: #3069f7;
  color: #fff;
  font-weight: 600;
  font-size: 1em;
  cursor: pointer;
  transition: background 0.2s;
  margin: 0;
}
.modal-box button:hover {
  background: #1b44b8;
}

/* Login container responsive */
.login-container {
  background: #fff;
  border-radius: 20px;
  box-shadow: 0 8px 32px rgba(60, 30, 90, 0.12);
  width: min(92vw, 360px);        /* ✅ perfecto para 400px */
  max-width: 360px;
  padding: 24px 18px 18px 18px;   /* ✅ más compacto */
  margin: 0 auto;                  /* ✅ quita margin-top:60px */
  text-align: center;
  box-sizing: border-box;
}

.hidden {
  display: none !important;
}

/* CORRECCIÓN: Unifica tamaño, padding, radio, font-size y box-sizing */
.login-container input,
.login-container button {
  width: 100%;
  padding: 14px 12px;     /* ✅ mejor touch */
  border-radius: 10px;
  font-size: 1rem;
  box-sizing: border-box;
  display: block;
}
.login-container input {
  margin-bottom: 12px;
  border: 1.5px solid #d1d1d1;
  background: #fafaff;
  transition: border 0.2s;
}
.login-container button {
  background: #3069f7;
  color: #fff;
  border: none;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
  margin-bottom: 0;
}
.login-container button:hover {
  background: #1b44b8;
}

.error-message {
  color: #c00;
  margin-bottom: 12px;
  font-size: 0.98em;
}

/* ✅ Logo más compacto para no empujar en 400px */
.logo-container {
  display: flex;
  justify-content: center;
  align-items: center;
  background: #fff;
  width: 96px;
  height: 96px;
  margin: 0 auto 14px auto;
  border-radius: 18px;
}
.login-logo {
  max-width: 96px;
  max-height: 96px;
}

/* MODAL NOTIFICACIÓN */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.28);
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
}
.modal-overlay.active {
  display: flex;
}
.modal-box {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(60, 30, 90, 0.18);
  padding: 28px 24px 18px 24px;
  min-width: 250px;
  text-align: center;
  animation: fadeIn 0.2s;
}
.modal-box p {
  font-size: 1.09em;
  margin-bottom: 18px;
  color: #222;
}
.modal-buttons {
  display: flex;
  flex-direction: row;
  gap: 12px;
  justify-content: center;
  margin-top: 8px;
  width: 100%;
}
.modal-box button {
  width: auto !important;
  min-width: 80px;
  margin: 0;
  padding: 9px 22px;
  border: none;
  border-radius: 6px;
  background: #3069f7;
  color: #fff;
  font-weight: 600;
  font-size: 1em;
  cursor: pointer;
  transition: background 0.2s;
}
.modal-box button:hover {
  background: #1b44b8;
}
@keyframes fadeIn {
  from { opacity: 0; transform: scale(0.93); }
  to   { opacity: 1; transform: scale(1); }
}

/* ====================== */
/*   RESPONSIVE ADAPTS    */
/* ====================== */

/* ✅ Ajuste específico para móviles tipo 400px */
@media (max-width: 420px) {
  .form-container,
  .login-container {
    width: 92vw;
    max-width: 360px;
    padding: 22px 16px 16px 16px;
    border-radius: 18px;
  }

  h2 {
    font-size: 1.15rem;
    margin-bottom: 16px;
  }

  .logo-container {
    width: 88px;
    height: 88px;
    margin-bottom: 12px;
  }
  .login-logo {
    max-width: 88px;
    max-height: 88px;
  }

  .login-container input,
  .login-container button,
  .form-container input[type="number"],
  .form-container input[type="password"],
  .form-container select,
  .form-container button {
    padding: 13px 12px;
    font-size: 1rem;
    border-radius: 10px;
  }

  .login-container button,
  .form-container button {
    margin-top: 14px; /* ✅ antes 24px */
  }

  .modal-box {
    min-width: 90vw;
    padding: 14px 4vw 10px 4vw;
  }
}

/* ✅ Si el alto es bajo, permitimos scroll sin romper */
@media (max-height: 700px) {
  body {
    align-items: flex-start;
    padding-top: 16px;
    padding-bottom: 16px;
  }
}
/* ============================= */
/*   FIX RESPONSIVE REAL         */
/*   (Pegar al FINAL del CSS)    */
/* ============================= */

/* Alto real en móvil + centra bien */
body{
  min-height: 100svh;          /* mejor que 100vh en móviles */
  min-width: 0;
  overflow-x: hidden;

  display: flex;
  justify-content: center;
  align-items: center;

  padding: 16px;
  padding-top: max(16px, env(safe-area-inset-top));
  padding-bottom: max(16px, env(safe-area-inset-bottom));
}

/* Card del login: ancho ideal para 400px */
.login-container{
  width: min(92vw, 380px);
  max-width: 380px;
  margin: 0 auto;
  padding: 22px 18px 18px 18px;
  border-radius: 22px;
}

/* Logo (en tu HTML NO usas .logo-container, usas .login-logo) */
.login-logo{
  display: block;
  margin: 0 auto 10px auto;
  max-width: 150px;     /* ajusta tu logo horizontal */
  width: 60%;
  height: auto;
}

/* Título */
.login-container h2{
  margin: 8px 0 14px 0;
  font-size: 1.2rem;
}

/* Inputs y botón más “touch friendly” */
.login-container input,
.login-container button{
  width: 100%;
  padding: 14px 12px;
  font-size: 1rem;
  border-radius: 10px;
}

/* Espacio del botón */
.login-container button{
  margin-top: 10px;
}

/* Ajuste fino para pantallas ~400px */
@media (max-width: 420px){
  body{ padding: 14px; }

  .login-container{
    width: 92vw;
    padding: 20px 16px 16px 16px;
    border-radius: 18px;
  }

  .login-logo{
    width: 65%;
    max-width: 160px;
    margin-bottom: 10px;
  }

  .login-container h2{
    font-size: 1.15rem;
  }
}

/* Si el alto es pequeño, permite que “suba” y se pueda hacer scroll */
@media (max-height: 700px){
  body{
    align-items: flex-start;
  }
}
/* ===========================
   FIX DEFINITIVO (400x861)
   Pegar AL FINAL del CSS
   =========================== */

/* 1) Alto real móvil */
body{
  min-height: 100svh;
  min-width: 0;
  overflow-x: hidden;
}

/* 2) OVERRIDE del @media que te lo manda arriba */
@media (max-width: 800px) {
  body{
    align-items: center !important;   /* <-- anula flex-start */
    padding-top: 0 !important;        /* <-- anula 30px */
    padding-bottom: 0 !important;
  }
}

/* 3) Card centrada y sin empujes */
.login-container{
  margin-top: 0 !important;
  width: min(92vw, 380px);
}