:root {
    --login-blue: #1e5a9e;
    --login-blue-hover: #174a82;
    --login-blue-focus: rgba(30, 90, 158, 0.15);
    --login-bg: #eef2f6;
    --login-text: #1e293b;
    --login-muted: #64748b;
    --login-border: #cbd5e1;
}

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

html,
body {
    height: 100%;
    margin: 0;
}

body.login-page {
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    background: var(--login-bg);
    color: var(--login-text);
    -webkit-font-smoothing: antialiased;
}

.login-preloader {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--login-bg);
    transition: opacity 0.2s ease, visibility 0.2s ease;
}

.login-preloader.is-hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.login-preloader img {
    width: 40px;
    height: 40px;
}

.login-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}

.login-card {
    width: 100%;
    max-width: 380px;
    padding: 2rem 2rem 1.75rem;
    background: #fff;
    border: 1px solid var(--login-border);
    border-radius: 6px;
}

.login-brand {
    text-align: center;
    margin-bottom: 1.75rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid #e2e8f0;
}

.login-brand-logo {
    max-width: 140px;
    max-height: 56px;
    object-fit: contain;
    margin-bottom: 0.75rem;
}

.login-brand-fallback {
    width: 48px;
    height: 48px;
    margin: 0 auto 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    background: var(--login-blue);
    color: #fff;
    font-size: 1.35rem;
}

.login-brand h1 {
    margin: 0;
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--login-text);
}

.login-brand p {
    margin: 0.35rem 0 0;
    font-size: 0.875rem;
    color: var(--login-muted);
}

.login-alert {
    padding: 0.75rem 0.875rem;
    margin-bottom: 1rem;
    border-radius: 4px;
    font-size: 0.8125rem;
    line-height: 1.5;
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #991b1b;
}

.login-field {
    margin-bottom: 1rem;
}

.login-field label {
    display: block;
    margin-bottom: 0.35rem;
    font-size: 0.8125rem;
    font-weight: 500;
    color: #475569;
}

.login-input-wrap {
    position: relative;
}

.login-input-wrap input {
    width: 100%;
    height: 42px;
    padding: 0 2.5rem 0 0.75rem;
    border: 1px solid var(--login-border);
    border-radius: 4px;
    background: #fff;
    font: inherit;
    font-size: 0.875rem;
    color: var(--login-text);
}

.login-input-wrap input::placeholder {
    color: #94a3b8;
}

.login-input-wrap input:focus {
    outline: none;
    border-color: var(--login-blue);
    box-shadow: 0 0 0 3px var(--login-blue-focus);
}

.login-input-wrap input.is-invalid {
    border-color: #dc2626;
}

.login-toggle-password {
    position: absolute;
    right: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 4px;
    background: transparent;
    color: #94a3b8;
    cursor: pointer;
    padding: 0;
}

.login-toggle-password:hover {
    color: var(--login-blue);
}

.login-field-error {
    display: block;
    margin-top: 0.35rem;
    font-size: 0.8125rem;
    color: #dc2626;
}

.login-options {
    margin-bottom: 1.25rem;
}

.login-remember {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-size: 0.8125rem;
    color: var(--login-muted);
}

.login-remember input {
    width: 15px;
    height: 15px;
    accent-color: var(--login-blue);
    cursor: pointer;
}

.login-submit {
    width: 100%;
    height: 42px;
    border: none;
    border-radius: 4px;
    background: var(--login-blue);
    color: #fff;
    font: inherit;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
}

.login-submit:hover:not(:disabled) {
    background: var(--login-blue-hover);
}

.login-submit:disabled {
    opacity: 0.7;
    cursor: wait;
}

.login-footer {
    margin-top: 1.25rem;
    padding-top: 1rem;
    border-top: 1px solid #e2e8f0;
    text-align: center;
    font-size: 0.75rem;
    color: #94a3b8;
}

@media (prefers-reduced-motion: reduce) {
    .login-preloader {
        transition: none;
    }
}
