*,
*::before,
*::after {
    box-sizing: border-box;
}

:root {
    color-scheme: dark;
    --highlight-color: #87cefa;
    --background-color: #101b26;
    --surface-color: #172635;
    --surface-raised: #203140;
    --text-color: #edf5fa;
    --text-muted: #a4b4c0;
    --border-color: #354958;
    --focus-ring: rgba(135, 206, 250, 0.3);
    --error-color: #ff8c8c;
    --border-radius-btn: 10px;
    --border-radius-box: 18px;
}

html,
body.login-body {
    min-height: 100%;
    margin: 0;
}

body.login-body {
    display: grid;
    min-height: 100vh;
    padding: 32px 16px;
    overflow: auto;
    overflow-x: hidden;
    place-items: center;
    color: var(--text-color);
    background:
        radial-gradient(ellipse at 18% 12%, rgba(135, 206, 250, 0.12), transparent 38%),
        radial-gradient(ellipse at 86% 82%, rgba(36, 102, 139, 0.16), transparent 36%),
        var(--background-color);
    font-family: Inter, "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
}

.login-container {
    width: min(440px, calc(100vw - 32px));
    max-width: 100%;
    padding: 12px;
}

.login-card {
    padding: clamp(28px, 7vw, 48px);
    background: linear-gradient(155deg, var(--surface-raised), var(--surface-color) 45%);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-box);
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.32);
}

.login-header {
    margin-bottom: 34px;
    text-align: center;
}

.login-header .main-logo {
    width: 72px;
    height: 72px;
    margin-bottom: 16px;
    object-fit: contain;
}

.login-header h1 {
    margin: 0;
    color: var(--text-color);
    font-size: 1.8rem;
    font-weight: 720;
    letter-spacing: -0.045em;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    color: var(--text-muted);
    font-size: 0.83rem;
    font-weight: 650;
    letter-spacing: 0.035em;
}

.form-group input[type="text"],
.form-group input[type="password"] {
    width: 100%;
    min-height: 48px;
    padding: 12px 14px;
    color: var(--text-color);
    background: rgba(5, 15, 23, 0.35);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-btn);
    font: inherit;
    transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.form-group input:focus {
    outline: none;
    background: rgba(5, 15, 23, 0.55);
    border-color: var(--highlight-color);
    box-shadow: 0 0 0 3px var(--focus-ring);
}

.form-actions {
    margin-top: 6px;
}

.btn-primary {
    width: 100%;
    min-height: 48px;
    padding: 12px 18px;
    color: #10202b;
    background: var(--highlight-color);
    border: 0;
    border-radius: var(--border-radius-btn);
    font: inherit;
    font-weight: 700;
    cursor: pointer;
    transition: background-color 160ms ease, transform 160ms ease, box-shadow 160ms ease;
}

.btn-primary:hover {
    background: #a0dcff;
    box-shadow: 0 8px 22px rgba(135, 206, 250, 0.2);
}

.btn-primary:active {
    transform: translateY(1px);
}

.btn-primary:focus-visible {
    outline: 3px solid var(--focus-ring);
    outline-offset: 3px;
}

.form-errors,
.field-errors {
    margin-top: 4px;
    color: var(--error-color);
    font-size: 0.86rem;
    line-height: 1.5;
}

.field-errors ul,
.non-field-errors ul {
    margin: 0;
    padding: 0;
    list-style: none;
}

.login-footer {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 30px;
    margin-top: 24px;
}

.login-footer a {
    display: inline-flex;
    flex: 0 1 124px;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    opacity: 0.78;
    transition: opacity 160ms ease;
}

.login-footer a:hover {
    opacity: 1;
}

.login-footer img {
    width: auto;
    max-width: 130px;
    height: 30px;
    object-fit: contain;
}

@media (max-width: 480px) {
    body.login-body {
        padding: 20px 12px;
    }

    .login-container {
        width: calc(100vw - 24px);
    }

    .login-card {
        padding: 24px 18px;
    }

    .login-header {
        margin-bottom: 24px;
    }

    .login-header .main-logo {
        width: 60px;
        height: 60px;
    }

    .login-footer {
        gap: 14px;
    }

    .login-footer a {
        flex-basis: 110px;
    }

    .login-footer img {
        max-width: 100%;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}

/* --- Acceso a la demo --- */
.login-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 24px 0 16px;
    color: var(--text-muted);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.login-divider::before,
.login-divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--border-color);
}

.btn-demo {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 48px;
    padding: 12px 18px;
    color: var(--highlight-color);
    background: transparent;
    border: 1px solid var(--highlight-color);
    border-radius: var(--border-radius-btn);
    font-weight: 700;
    text-decoration: none;
    transition: background-color 160ms ease;
}

.btn-demo:hover {
    background: rgba(135, 206, 250, 0.1);
}

.btn-demo:focus-visible {
    outline: 3px solid var(--focus-ring);
    outline-offset: 3px;
}

.demo-hint {
    margin: 10px 0 0;
    color: var(--text-muted);
    font-size: 0.82rem;
    text-align: center;
}
