:root {
    --primary: #6366f1;
    --primary-2: #8b5cf6;
    --text: #0f172a;
    --muted: #64748b;
    --border: #e2e8f0;
    --danger: #ef4444;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: 'Inter', system-ui, sans-serif;
    min-height: 100vh;
    display: grid;
    place-items: center;
    background: #0b1020;
    color: var(--text);
    overflow-x: hidden;
    padding: 24px 16px;
}

/* Fondo animado */
.bg { position: fixed; inset: 0; overflow: hidden; z-index: 0; }
.blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(90px);
    opacity: .55;
    animation: float 18s ease-in-out infinite;
}
.blob-1 { width: 480px; height: 480px; background: #6366f1; top: -120px; left: -100px; }
.blob-2 { width: 420px; height: 420px; background: #a855f7; bottom: -140px; right: -80px; animation-delay: -6s; }
.blob-3 { width: 320px; height: 320px; background: #06b6d4; top: 40%; left: 45%; animation-delay: -12s; opacity: .35; }

@keyframes float {
    0%, 100% { transform: translate(0, 0) scale(1); }
    33% { transform: translate(60px, -40px) scale(1.08); }
    66% { transform: translate(-40px, 50px) scale(.95); }
}

/* Contenedor */
.login-wrapper {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: 1.05fr 1fr;
    width: 100%;
    max-width: 960px;
    min-height: 580px;
    border-radius: 24px;
    overflow: hidden;
    background: rgba(255, 255, 255, .06);
    border: 1px solid rgba(255, 255, 255, .12);
    backdrop-filter: blur(20px);
    box-shadow: 0 30px 80px rgba(0, 0, 0, .45);
    animation: appear .7s cubic-bezier(.2, .8, .2, 1);
}

@keyframes appear {
    from { opacity: 0; transform: translateY(24px) scale(.98); }
    to   { opacity: 1; transform: none; }
}

/* Panel de marca */
.brand-panel {
    padding: 56px 48px;
    color: #fff;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 22px;
}
/* El logo tiene trazos negros: va sobre un círculo blanco para leerse en el fondo oscuro */
.brand-logo {
    width: 200px; height: 200px;
    padding: 10px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 20px 50px rgba(0, 0, 0, .35), 0 0 0 8px rgba(255, 255, 255, .08);
    animation: appear .9s cubic-bezier(.2, .8, .2, 1);
}
.brand-logo img { display: block; width: 100%; height: 100%; object-fit: contain; }
.brand-panel h1 { font-size: 2.2rem; font-weight: 700; letter-spacing: -.02em; }

/* Tarjeta de login */
.login-card {
    background: #fff;
    padding: 56px 48px 32px;
    display: flex;
    flex-direction: column;
}
.login-card header h2 { font-size: 1.6rem; font-weight: 700; letter-spacing: -.01em; }
.login-card header p { color: var(--muted); margin-top: 6px; font-size: .95rem; }

form { margin-top: 32px; display: grid; gap: 20px; }

.field { position: relative; }
.field .icon {
    position: absolute; left: 16px; top: 50%;
    width: 18px; height: 18px;
    transform: translateY(-50%);
    color: var(--muted);
    pointer-events: none;
    transition: color .2s;
}
.field input {
    width: 100%;
    height: 56px;
    padding: 20px 48px 6px 46px;
    border: 1.5px solid var(--border);
    border-radius: 12px;
    font: inherit;
    font-size: .95rem;
    color: var(--text);
    background: #f8fafc;
    outline: none;
    transition: border-color .2s, box-shadow .2s, background .2s;
}
.field label {
    position: absolute; left: 46px; top: 50%;
    transform: translateY(-50%);
    color: var(--muted);
    font-size: .95rem;
    pointer-events: none;
    transition: all .2s ease;
}
.field input:focus,
.field input:not(:placeholder-shown) { background: #fff; }
.field input:focus { border-color: var(--primary); box-shadow: 0 0 0 4px rgba(99, 102, 241, .15); }
.field input:focus ~ .icon,
.field:focus-within .icon { color: var(--primary); }
.field input:focus + label,
.field input:not(:placeholder-shown) + label {
    top: 16px;
    font-size: .72rem;
    font-weight: 600;
    color: var(--primary);
}
.field.invalid input { border-color: var(--danger); animation: shake .35s; }

@keyframes shake {
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

.toggle-pass {
    position: absolute; right: 10px; top: 50%;
    transform: translateY(-50%);
    width: 36px; height: 36px;
    border: none; background: none;
    border-radius: 8px;
    color: var(--muted);
    cursor: pointer;
    display: grid; place-items: center;
}
.toggle-pass:hover { background: #f1f5f9; color: var(--text); }
.toggle-pass svg { width: 18px; height: 18px; }
.toggle-pass.active { color: var(--primary); }

.caps-warning { font-size: .8rem; color: #d97706; margin-top: -10px; }

.btn-primary {
    position: relative;
    height: 52px;
    border: none;
    border-radius: 12px;
    font: inherit;
    font-weight: 600;
    font-size: 1rem;
    color: #fff;
    cursor: pointer;
    background: linear-gradient(135deg, var(--primary), var(--primary-2));
    box-shadow: 0 10px 24px rgba(99, 102, 241, .35);
    transition: transform .15s, box-shadow .2s, filter .2s;
    display: flex; align-items: center; justify-content: center; gap: 10px;
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 14px 30px rgba(99, 102, 241, .45); }
.btn-primary:active { transform: translateY(0); }
.btn-primary .spinner {
    display: none;
    width: 18px; height: 18px;
    border: 2px solid rgba(255, 255, 255, .4);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin .7s linear infinite;
}
.btn-primary.loading { pointer-events: none; filter: brightness(.95); }
.btn-primary.loading .spinner { display: block; }

@keyframes spin { to { transform: rotate(360deg); } }

.alert {
    display: flex; align-items: center; gap: 10px;
    margin-top: 24px;
    padding: 12px 14px;
    border-radius: 10px;
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #b91c1c;
    font-size: .9rem;
    animation: appear .35s ease;
}
.alert svg { width: 18px; height: 18px; flex-shrink: 0; }

.login-card footer {
    margin-top: auto;
    padding-top: 32px;
    text-align: center;
    color: var(--muted);
    font-size: .8rem;
}

/* Responsive */
@media (max-width: 820px) {
    .login-wrapper { grid-template-columns: 1fr; max-width: 440px; min-height: auto; }
    .brand-panel { padding: 32px 28px; gap: 14px; }
    .brand-logo { width: 110px; height: 110px; padding: 6px; }
    .brand-panel h1 { font-size: 1.8rem; }
    .login-card { padding: 36px 28px 24px; }
}
