* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #6d63ff;
    --primary-hover: #7f78ff;
    --primary-dark: #4738f2;
    --primary-glow: rgba(109, 99, 255, 0.28);
    --bg: #050711;
    --bg-card: rgba(16, 18, 34, 0.72);
    --bg-input: rgba(7, 9, 18, 0.62);
    --text: #fafafa;
    --text-muted: #9ca3b8;
    --border: rgba(170, 184, 255, 0.22);
    --error: #f87171;
    --success: #4ade80;
}

body {
    font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
    background:
        radial-gradient(circle at 0% 0%, rgba(73, 82, 255, 0.52) 0%, rgba(73, 82, 255, 0.18) 17%, transparent 34%),
        radial-gradient(circle at 100% 74%, rgba(47, 72, 255, 0.58) 0%, rgba(47, 72, 255, 0.2) 17%, transparent 36%),
        linear-gradient(135deg, #080a17 0%, #090b1a 45%, #050711 100%);
    color: var(--text);
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

*:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
    border-radius: 6px;
}

body::before {
    content: '';
    position: fixed;
    inset: 0;
    background:
        linear-gradient(112deg, transparent 0 20%, rgba(109, 99, 255, 0.07) 20.15%, transparent 20.5% 100%),
        linear-gradient(328deg, transparent 0 72%, rgba(109, 99, 255, 0.1) 72.15%, transparent 72.5% 100%);
    pointer-events: none;
    z-index: 0;
}

body::after {
    content: '';
    position: fixed;
    inset: -20vh -10vw;
    background:
        radial-gradient(ellipse at -8% 4%, transparent 0 28%, rgba(97, 113, 255, 0.24) 28.4%, transparent 28.8% 100%),
        radial-gradient(ellipse at 108% 102%, transparent 0 30%, rgba(97, 113, 255, 0.24) 30.4%, transparent 30.8% 100%);
    opacity: 0.85;
    pointer-events: none;
    z-index: 0;
}

.login-page {
    width: 100%;
    max-width: none;
    min-height: 100vh;
    min-height: 100dvh;
    padding: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 1;
}

.login-card {
    width: min(540px, calc(100vw - 40px));
    background: var(--bg-card);
    border: 1px solid rgba(187, 198, 255, 0.42);
    border-radius: 28px;
    padding: 36px 60px 28px;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.08),
        0 0 0 1px rgba(109, 99, 255, 0.06),
        0 36px 120px rgba(0, 0, 0, 0.5),
        0 0 120px rgba(73, 82, 255, 0.14);
    animation: cardEntry 0.5s ease forwards;
    backdrop-filter: blur(22px);
}

@keyframes cardEntry {
    from {
        opacity: 0;
        transform: translateY(16px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.login-header {
    text-align: center;
    margin-bottom: 32px;
}

.login-brand-icon {
    width: 70px;
    height: 70px;
    border-radius: 22px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    margin: 0 auto 20px;
    box-shadow:
        0 0 0 16px rgba(109, 99, 255, 0.08),
        0 0 38px rgba(109, 99, 255, 0.55),
        0 16px 34px rgba(45, 37, 180, 0.45);
}

.login-brand-icon svg {
    width: 36px;
    height: 36px;
}

.login-logo {
    font-size: 1.78rem;
    font-weight: 800;
    color: var(--text);
    margin-bottom: 8px;
    line-height: 1.3;
    letter-spacing: -0.02em;
}

.login-subtitle {
    color: var(--text-muted);
    font-size: 0.98rem;
    font-weight: 600;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 17px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    font-size: 0.9rem;
    font-weight: 600;
    color: #b3b9ce;
}

.input-with-icon,
.password-input {
    position: relative;
    display: flex;
    align-items: center;
}

.input-icon {
    position: absolute;
    left: 20px;
    width: 22px;
    height: 22px;
    color: var(--text-muted);
    pointer-events: none;
    transition: color 0.2s;
}

.input-with-icon input,
.password-input input {
    width: 100%;
    height: 58px;
    padding: 0 20px 0 66px;
    background: var(--bg-input);
    border: 1px solid rgba(170, 184, 255, 0.22);
    border-radius: 14px;
    color: var(--text);
    font-size: 1.08rem;
    font-family: inherit;
    transition: all 0.2s ease;
}

.password-input input {
    padding-right: 58px;
}

.input-with-icon input::placeholder,
.password-input input::placeholder {
    color: var(--text-muted);
}

.input-with-icon input:focus,
.password-input input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
}

.input-with-icon:focus-within .input-icon,
.password-input:focus-within .input-icon {
    color: var(--primary);
}

.toggle-password {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 6px;
    display: flex;
    border-radius: 8px;
    transition: all 0.2s;
    z-index: 1;
}

.toggle-password:hover {
    color: var(--primary);
    background: var(--primary-glow);
}

.toggle-password svg {
    width: 22px;
    height: 22px;
}

.form-options {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.92rem;
}

.remember-me {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    color: var(--text-muted);
    transition: color 0.2s;
}

.remember-me:hover {
    color: var(--text);
}

.remember-me input {
    width: 16px;
    height: 16px;
    accent-color: var(--primary);
    cursor: pointer;
    border-radius: 4px;
}

.forgot-link {
    color: var(--primary);
    text-decoration: none;
    font-size: 0.92rem;
    font-weight: 500;
    transition: color 0.2s;
}

.forgot-link:hover {
    color: var(--primary-hover);
}

.btn-login {
    width: 100%;
    height: 58px;
    background: linear-gradient(180deg, var(--primary) 0%, var(--primary-dark) 100%);
    border: none;
    border-radius: 12px;
    color: #fff;
    font-size: 1.08rem;
    font-weight: 800;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-top: 4px;
    box-shadow: 0 14px 32px rgba(73, 82, 255, 0.24);
}

.btn-login:hover {
    background: linear-gradient(180deg, var(--primary-hover) 0%, var(--primary) 100%);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(99, 102, 241, 0.3);
}

.btn-login:active {
    transform: translateY(0);
}

.btn-login:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.btn-login.loading {
    position: relative;
    color: transparent;
    pointer-events: none;
}

.btn-login.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 22px;
    height: 22px;
    margin: -11px 0 0 -11px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.login-footer {
    text-align: center;
    margin-top: 22px;
    padding-top: 30px;
    border-top: none;
    position: relative;
}

.login-footer::before {
    content: '';
    position: absolute;
    top: 10px;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, rgba(170, 184, 255, 0.18), rgba(170, 184, 255, 0.18) 46%, transparent 46%, transparent 54%, rgba(170, 184, 255, 0.18) 54%, rgba(170, 184, 255, 0.18));
}

.login-footer::after {
    content: '';
    position: absolute;
    top: 7px;
    left: 50%;
    width: 7px;
    height: 7px;
    transform: translateX(-50%);
    border-radius: 50%;
    background: var(--primary);
    box-shadow: 0 0 18px rgba(109, 99, 255, 0.9);
}

.login-footer p {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.error-message {
    text-align: center;
    color: var(--error);
    font-size: 0.85rem;
    min-height: 20px;
    opacity: 0;
    transition: opacity 0.2s;
}

.error-message.show {
    opacity: 1;
}

.toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    padding: 14px 24px;
    border-radius: 14px;
    font-size: 0.875rem;
    font-weight: 500;
    opacity: 1;
    transition: opacity 0.3s;
    z-index: 1000;
}

.toast.hidden {
    opacity: 0;
    pointer-events: none;
}

.toast.error {
    background: rgba(248, 113, 113, 0.15);
    color: #fca5a5;
    border: 1px solid rgba(248, 113, 113, 0.2);
}

.toast.success {
    background: rgba(74, 222, 128, 0.15);
    color: #86efac;
    border: 1px solid rgba(74, 222, 128, 0.2);
}

@media (max-width: 640px) {
    body {
        align-items: stretch;
        min-height: 100svh;
        min-height: 100dvh;
        overflow-x: hidden;
    }

    .login-page {
        max-width: none;
        min-height: 100svh;
        min-height: 100dvh;
        display: flex;
        align-items: center;
        padding: max(10px, env(safe-area-inset-top)) 18px max(10px, env(safe-area-inset-bottom));
    }

    .login-card {
        width: 100%;
        max-width: 430px;
        padding: 26px 24px 20px;
        border-radius: 20px;
    }

    .login-brand-icon {
        width: 58px;
        height: 58px;
        border-radius: 16px;
        margin-bottom: 16px;
        box-shadow:
            0 0 0 12px rgba(109, 99, 255, 0.08),
            0 0 30px rgba(109, 99, 255, 0.5),
            0 12px 24px rgba(45, 37, 180, 0.38);
    }

    .login-brand-icon svg {
        width: 30px;
        height: 30px;
    }

    .login-logo {
        font-size: 1.45rem;
    }

    .login-subtitle {
        font-size: 0.9rem;
    }

    .login-header {
        margin-bottom: 24px;
    }

    .login-form {
        gap: 14px;
    }

    .form-group {
        gap: 6px;
    }

    .form-group label {
        font-size: 0.82rem;
    }

    .input-with-icon input,
    .password-input input {
        height: 50px;
        font-size: 0.95rem;
        padding-left: 50px;
        border-radius: 12px;
    }

    .input-icon {
        left: 17px;
        width: 18px;
        height: 18px;
    }

    .btn-login {
        height: 52px;
        font-size: 1rem;
    }

    .form-options,
    .forgot-link {
        font-size: 0.82rem;
    }

    .login-footer {
        margin-top: 18px;
        padding-top: 24px;
    }

    .login-footer p {
        font-size: 0.78rem;
    }
}
