body.login-page,
body:has(.login-container) {
    position: relative;
    display: grid;
    min-height: 100vh;
    place-items: center;
    padding: 32px 16px;
    overflow-x: hidden;
    background:
        linear-gradient(135deg, rgba(15, 118, 110, 0.12), rgba(37, 99, 235, 0.08) 46%, rgba(15, 23, 42, 0.03)),
        var(--bg);
}

body.login-page::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background-image:
        linear-gradient(rgba(15, 118, 110, 0.08) 1px, transparent 1px),
        linear-gradient(90deg, rgba(15, 118, 110, 0.08) 1px, transparent 1px);
    background-size: 42px 42px;
    mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.7), transparent 72%);
}

.shape {
    position: fixed;
    z-index: 0;
    pointer-events: none;
    opacity: 0.48;
}

.shape-1 {
    top: 70px;
    right: max(22px, 8vw);
    width: 240px;
    height: 240px;
    border: 1px solid rgba(15, 118, 110, 0.22);
    border-radius: 28px;
    background: rgba(15, 118, 110, 0.08);
    transform: rotate(14deg);
}

.shape-2 {
    bottom: 58px;
    left: max(18px, 7vw);
    width: 210px;
    height: 210px;
    border: 1px solid rgba(37, 99, 235, 0.18);
    background: rgba(37, 99, 235, 0.07);
    clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%);
}

.login-container,
.login-card {
    position: relative;
    z-index: 1;
    width: min(440px, 100%);
    padding: 30px;
    background: rgba(255, 255, 255, 0.94);
    border: 1px solid rgba(219, 227, 238, 0.9);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    backdrop-filter: blur(14px);
}

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

.login-logo {
    display: grid;
    width: 76px;
    height: 76px;
    margin: 0 auto 14px;
    place-items: center;
    color: #fff;
    background: var(--primary);
    border-radius: 18px;
    box-shadow: 0 18px 36px rgba(15, 118, 110, 0.24);
    font-size: 30px;
}

.login-title {
    margin: 0;
    color: var(--text);
    font-size: 26px;
    line-height: 1.25;
    font-weight: 900;
}

.login-subtitle {
    margin: 6px 0 0;
    color: var(--text-muted);
    font-size: 14px;
    font-weight: 700;
}

.security-info {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    margin-bottom: 16px;
    color: var(--success);
    background: var(--success-50);
    border: 1px solid #bbf7d0;
    border-radius: var(--radius-md);
    font-size: 12px;
    font-weight: 700;
}

.security-info.attempts-warning {
    color: var(--warning);
    background: var(--warning-50);
    border-color: #fde68a;
}

.login-form {
    display: grid;
    gap: 14px;
}

.login-form-group {
    position: relative;
}

.login-form-control {
    width: 100%;
    min-height: 48px;
    padding: 11px 46px 11px 14px;
    color: var(--text);
    background: var(--surface-soft);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    outline: none;
    font-size: 14px;
    font-weight: 700;
}

.login-form-control:focus {
    background: var(--surface);
    border-color: rgba(15, 118, 110, 0.55);
    box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.12);
}

.login-form-control:disabled {
    opacity: 0.62;
    cursor: not-allowed;
}

.form-icon {
    position: absolute;
    top: 50%;
    right: 16px;
    color: var(--text-muted);
    transform: translateY(-50%);
    transition: color 0.16s ease;
}

.login-form-control:focus + .form-icon {
    color: var(--primary);
}

.remember-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.remember-checkbox {
    width: 18px;
    height: 18px;
    margin: 0;
    accent-color: var(--primary);
}

.remember-label {
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    user-select: none;
}

.login-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 48px;
    width: 100%;
    padding: 12px 16px;
    color: #fff;
    background: var(--primary);
    border: 1px solid var(--primary);
    border-radius: var(--radius-md);
    box-shadow: 0 16px 30px rgba(15, 118, 110, 0.22);
    font-weight: 900;
    transition: transform 0.16s ease, background 0.16s ease, box-shadow 0.16s ease;
}

.login-btn:hover {
    background: var(--primary-600);
    transform: translateY(-1px);
    box-shadow: 0 20px 38px rgba(15, 118, 110, 0.26);
}

.login-btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.theme-toggle-login {
    position: fixed;
    top: 20px;
    left: 20px;
    z-index: 20;
    display: grid;
    width: 44px;
    height: 44px;
    place-items: center;
    color: var(--text);
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid var(--border);
    border-radius: 50%;
    box-shadow: var(--shadow-md);
    transition: transform 0.16s ease, color 0.16s ease, border-color 0.16s ease;
}

.theme-toggle-login:hover {
    color: var(--primary);
    border-color: rgba(15, 118, 110, 0.35);
    transform: translateY(-1px) rotate(10deg);
}

.skip-link {
    position: fixed;
    top: -56px;
    left: 20px;
    z-index: 30;
    padding: 10px 14px;
    color: #fff;
    background: var(--primary);
    border-radius: 0 0 var(--radius-md) var(--radius-md);
    box-shadow: var(--shadow-md);
    font-weight: 800;
    transition: top 0.16s ease;
}

.skip-link:focus {
    top: 0;
    outline: none;
}

[data-theme="dark"] .login-container,
[data-theme="dark"] .login-card,
[data-theme="dark"] .theme-toggle-login {
    background: rgba(17, 24, 39, 0.94);
    border-color: var(--border);
}

[data-theme="dark"] body.login-page {
    background:
        linear-gradient(135deg, rgba(20, 184, 166, 0.12), rgba(37, 99, 235, 0.1) 46%, rgba(2, 6, 23, 0.6)),
        var(--bg);
}

@media (max-width: 520px) {
    body.login-page,
    body:has(.login-container) {
        padding: 72px 12px 24px;
    }

    .login-container,
    .login-card {
        padding: 22px;
    }

    .login-logo {
        width: 64px;
        height: 64px;
        font-size: 26px;
    }

    .login-title {
        font-size: 22px;
    }
}
