:root{
    /* NODEXIS (extraído del logo) */
    --navy-deep:#0B1A35;
    --navy:#12243F;
    --petrol:#153C54;

    --teal:#0E8F8F;
    --teal-2:#1A7476;

    --green:#358161;     /* acento del logo */
    --gray:#CDD7DD;

    --panel:#ffffff;
    --line:#e7edf5;

    --text:#0f172a;
    --muted:#5b677a;

    --error-bg: #fee2e2;
    --error-border: #fecaca;
    --error-text: #991b1b;

    --success-bg: #dcfce7;
    --success-border: #bbf7d0;
    --success-text: #166534;

    --shadow: 0 22px 60px rgba(0,0,0,.22);
    --radius: 20px;
}

*{
    box-sizing:border-box;
    margin: 0;
    padding: 0;
}

html, body{
    height:100%;
}

body{
    font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
    background:
            radial-gradient(900px 600px at 25% 30%, rgba(14,143,143,.25), transparent 60%),
            radial-gradient(800px 520px at 80% 40%, rgba(53,129,97,.18), transparent 60%),
            linear-gradient(135deg, var(--navy-deep), var(--navy));
    height:100vh;
}

/* Centro */
.shell{
    min-height:100vh;
    display:flex;
    align-items:center;
    justify-content:center;
    padding:16px;
}

/* Contenedor principal */
.frame{
    width:min(1080px, 98vw);
    min-height: 620px;
    background: #fff;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow:hidden;
    display:grid;
    grid-template-columns: 0.95fr 1.25fr;
}

/* PANEL IZQUIERDO */
.panel{
    background: var(--panel);
    padding: clamp(24px, 4vw, 48px);
    display:flex;
    flex-direction:column;
    justify-content:center;
    gap: 20px;
}

.panel__brand{
    display:flex;
    flex-direction:column;
    gap: 8px;
}

.logo{
    width: 210px;
    height:auto;
    transition: width 0.2s ease;
}

.tagline{
    color: var(--muted);
    font-size: 0.9rem;
    line-height: 1.4;
}

.title{
    font-size: clamp(24px, 4vw, 32px);
    font-weight: 600;
    letter-spacing: -0.02em;
    color: var(--text);
    line-height: 1.2;
}

/* Alerts - MEJORADAS: más contraste */
.alerts{
    margin: 4px 0;
}

.alert{
    border-radius: 12px;
    padding: 14px 16px;
    font-size: 0.95rem;
    margin-bottom: 12px;
    border: 1px solid transparent;
    font-weight: 500;
}

.alert--error{
    background: var(--error-bg);
    border-color: var(--error-border);
    color: var(--error-text);
}

.alert--success{
    background: var(--success-bg);
    border-color: var(--success-border);
    color: var(--success-text);
}

/* Form */
.form{
    display:grid;
    gap: 20px;
}

.field{
    display: grid;
    gap: 6px;
}

.field label{
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text);
}

.field input{
    width:100%;
    height: 48px;
    padding: 0 16px;
    border: 2px solid var(--line);
    border-radius: 12px;
    outline:none;
    background: #fff;
    font-size: 1rem;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.field input:focus{
    border-color: var(--teal);
    box-shadow: 0 0 0 4px rgba(14,143,143,.15);
}

/* MEJORA UX: focus visible para teclado */
.field input:focus-visible {
    border-color: var(--teal);
    box-shadow: 0 0 0 4px rgba(14,143,143,.25);
}

.row{
    display:flex;
    justify-content:space-between;
    align-items:center;
    gap: 16px;
    flex-wrap: wrap;
}

/* MEJORA UX: Área táctil más grande */
.check{
    display:flex;
    align-items:center;
    gap: 12px;
    color: var(--text);
    font-size: 0.95rem;
    cursor: pointer;
    padding: 8px 0;
    min-height: 44px; /* Área táctil mínima */
}

.check input{
    width: 18px;
    height: 18px;
    accent-color: var(--teal);
    cursor: pointer;
}

.link{
    font-size: 0.95rem;
    color: var(--teal);
    font-weight: 500;
    text-decoration:none;
    padding: 8px 0;
    min-height: 44px; /* Área táctil mínima */
    display: inline-flex;
    align-items: center;
    transition: color 0.15s ease;
}

.link:hover{
    color: var(--teal-2);
    text-decoration: underline;
}

.link:focus-visible {
    outline: 2px solid var(--teal);
    outline-offset: 4px;
    border-radius: 4px;
}

/* Botón - MEJORADO con estado de carga */
.btn{
    height: 52px;
    border:none;
    border-radius: 12px;
    cursor:pointer;
    color: white;
    font-weight: 700;
    font-size: 1rem;
    letter-spacing: 0.3px;
    background: linear-gradient(90deg, var(--teal), var(--green));
    box-shadow: 0 8px 20px rgba(14,143,143,.25);
    transition: transform 0.1s ease, filter 0.2s ease, opacity 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn:hover{
    filter: brightness(1.05);
    transform: translateY(-1px);
}

.btn:active{
    transform: translateY(2px);
    box-shadow: 0 4px 12px rgba(14,143,143,.2);
}

.btn:focus-visible {
    outline: 3px solid var(--teal);
    outline-offset: 3px;
}

/* Estado de carga del botón */
.btn.loading {
    opacity: 0.8;
    cursor: not-allowed;
    pointer-events: none;
}

.btn.loading::after {
    content: "";
    width: 20px;
    height: 20px;
    border: 3px solid white;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spinner 0.8s linear infinite;
    display: inline-block;
}

@keyframes spinner {
    to { transform: rotate(360deg); }
}

.panel__footer{
    margin-top: 24px;
    color: var(--muted);
    font-size: 0.85rem;
    text-align: center;
    padding-top: 16px;
    border-top: 1px solid var(--line);
}

/* HERO DERECHA */
.hero{
    position:relative;
    background: radial-gradient(900px 700px at 25% 30%, rgba(14,143,143,.18), transparent 55%),
    radial-gradient(800px 600px at 80% 35%, rgba(53,129,97,.14), transparent 55%),
    linear-gradient(135deg, #0B1A35, #12243F);
    display:flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
}

.hero__logo{
    width: min(480px, 85%);
    max-width: 100%;
    height:auto;
    filter: drop-shadow(0 20px 30px rgba(0,0,0,.25));
    transition: transform 0.3s ease;
}

.hero__logo:hover {
    transform: scale(1.02);
}

/* ===== RESPONSIVE MEJORADO ===== */
@media (max-width: 900px){
    .frame{
        grid-template-columns: 1fr;
        width: 100%;
        border-radius: 24px;
    }

    .hero{
        order: -1;
        padding: 48px 24px;
        min-height: 280px;
    }
    .hero {
        display: none; /* Ocultamos hero solo en móviles muy pequeños */
    }

    .panel{
        padding: 32px 24px;
    }

    .logo{
        width: 180px;
    }
}

@media (max-width: 600px){
    .shell {
        padding: 12px;
    }

    .frame {
        border-radius: 20px;
        min-height: auto;
    }

    .hero {
        padding: 40px 20px;
        min-height: 200px;
    }

    .hero {
        display: none; /* Ocultamos hero solo en móviles muy pequeños */
    }

    .panel {
        padding: 28px 20px;
        gap: 16px;
    }

    .logo {
        width: 160px;
    }

    .title {
        font-size: 26px;
    }

    .row {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .check {
        min-height: 48px;
    }

    .link {
        min-height: 48px;
        padding: 8px 0;
    }

    .btn {
        height: 56px; /* Más grande en móvil */
        font-size: 1.1rem;
    }

    .field input {
        height: 52px; /* Más grande en móvil */
        font-size: 16px; /* Evita zoom en iOS */
    }
}

/* Para pantallas muy pequeñas */
@media (max-width: 380px) {
    .hero {
        display: none; /* Ocultamos hero solo en móviles muy pequeños */
    }

    .panel {
        padding: 24px 16px;
    }

    .logo {
        width: 140px;
    }
}

/* MEJORA: Soportar prefers-reduced-motion */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}