:root {
    --auth-primary: #1d6de8;
    --auth-primary-dark: #1459c0;
    --auth-primary-rgb: 29, 109, 232;
    --auth-bg-page-top: #dcecff;
    --auth-bg-page-bottom: #cfe3ff;
    --auth-bg-card: #f8fbff;
    --bg-page: var(--auth-bg-page-top);
    --bg-card: var(--auth-bg-card);
    --blue-700: var(--auth-primary-dark);
    --blue-600: var(--auth-primary);
    --blue-500: var(--auth-primary);
    --text-main: #1f2b3d;
    --text-muted: #6b7c93;
    --line: #d6dfeb;
    --danger-bg: #fef2f2;
    --danger-border: #fecaca;
    --danger-text: #b91c1c;
    --success-bg: #ecfdf3;
    --success-border: #bbf7d0;
    --success-text: #166534;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: "Space Grotesk", "Sora", "Poppins", "Segoe UI", sans-serif;
    color: var(--text-main);
    background-color: var(--bg-page);
}

.auth-layout {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 18px;
    background:
        radial-gradient(900px 450px at 5% 10%, rgba(var(--auth-primary-rgb), 0.28) 0%, rgba(var(--auth-primary-rgb), 0) 65%),
        radial-gradient(700px 360px at 96% 90%, rgba(var(--auth-primary-rgb), 0.2) 0%, rgba(var(--auth-primary-rgb), 0) 60%),
        linear-gradient(180deg, var(--auth-bg-page-top) 0%, var(--auth-bg-page-bottom) 100%);
}

.login-shell {
    width: 100%;
    max-width: 980px;
    min-height: 620px;
    display: grid;
    grid-template-columns: minmax(320px, 1fr) minmax(340px, 460px);
    background: #ffffff;
    border-radius: 22px;
    overflow: hidden;
    box-shadow: 0 28px 64px rgba(15, 23, 42, 0.2);
}

.login-visual {
    position: relative;
    background: linear-gradient(160deg, var(--blue-600) 0%, var(--blue-700) 100%);
    min-height: 420px;
    padding: 26px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.login-visual-overlay {
    position: absolute;
    inset: 0;
    pointer-events: none;
    background:
        radial-gradient(700px 360px at -8% 95%, rgba(255, 255, 255, 0.12) 0%, rgba(255, 255, 255, 0) 70%),
        linear-gradient(175deg, rgba(var(--auth-primary-rgb), 0.08) 0%, rgba(var(--auth-primary-rgb), 0.22) 100%);
}

.login-visual.is-fallback {
    background:
        linear-gradient(160deg, var(--blue-600) 0%, var(--blue-700) 100%),
        radial-gradient(500px 260px at 20% 20%, rgba(255, 255, 255, 0.2) 0%, rgba(255, 255, 255, 0) 70%);
}

.login-visual-brand {
    position: relative;
    z-index: 2;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #ffffff;
}

.login-visual-brand .brand-mark {
    width: 26px;
    height: 26px;
    object-fit: contain;
    display: block;
}

.login-visual-brand-fallback {
    width: 26px;
    height: 26px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.24);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.82rem;
    color: #ffffff;
}

.login-visual-brand-name {
    color: #ffffff;
    line-height: 1;
    font-size: 0.95rem;
    font-weight: 600;
    letter-spacing: 0.01em;
}

.login-visual-media {
    width: 100%;
    height: calc(100% - 160px);
    min-height: 280px;
    position: relative;
    z-index: 2;
}

.login-visual-media img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.login-visual-text {
    position: relative;
    z-index: 2;
    color: #ffffff;
    padding: 4px 2px 0;
}

.login-visual-title {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 4px;
    letter-spacing: 0.01em;
}

.login-visual-subtitle {
    margin: 0;
    font-size: 0.95rem;
    line-height: 1.5;
    color: rgba(255, 255, 255, 0.9);
}

.login-card {
    border: 0;
    box-shadow: none;
    background: var(--bg-card);
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 34px 36px 24px;
}

.login-header {
    text-align: left;
    margin-bottom: 16px;
}

.login-title {
    font-size: 2rem;
    color: var(--blue-600);
    letter-spacing: 0;
    font-weight: 700;
    margin-bottom: 6px;
}

.login-subtitle {
    font-size: 0.94rem;
    color: var(--text-muted);
    line-height: 1.5;
}

.login-form {
    margin-top: 6px;
}

.form-group {
    margin-bottom: 14px;
}

label {
    display: block;
    font-size: 0.78rem;
    color: #9aa7b8;
    font-weight: 600;
    margin-bottom: 4px;
}

input[type="text"],
input[type="password"] {
    width: 100%;
    height: 40px;
    border: 0;
    border-bottom: 1px solid var(--line);
    border-radius: 0;
    background: transparent;
    color: var(--text-main);
    padding: 0 28px 0 0;
    font-size: 0.95rem;
    outline: none;
    transition: border-color 0.15s ease;
}

input::placeholder {
    color: #9ca3af;
}

input:focus {
    border-color: var(--blue-600);
}

.password-group {
    position: relative;
    display: flex;
    align-items: center;
}

.password-toggle {
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    border: none;
    background: transparent;
    padding: 4px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #a6b4c5;
}

.password-toggle:hover {
    color: var(--blue-600);
}

.password-toggle:focus-visible {
    outline: 2px solid var(--blue-600);
    outline-offset: 2px;
}

.password-toggle svg {
    width: 18px;
    height: 18px;
    display: block;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
}

.password-toggle .icon-eye-off {
    display: none;
}

.password-toggle.is-visible .icon-eye {
    display: none;
}

.password-toggle.is-visible .icon-eye-off {
    display: inline-block;
}

.form-actions {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-top: 4px;
    margin-bottom: 14px;
    flex-wrap: nowrap;
}

.remember-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: #7b8da4;
    font-size: 0.8rem;
    font-weight: 500;
    margin: 0;
    white-space: nowrap;
}

.remember-label input[type="checkbox"] {
    width: 14px;
    height: 14px;
    accent-color: var(--blue-600);
}

.forgot-link {
    display: block;
    text-align: center;
    margin: 0 0 12px 0;
    color: var(--blue-600);
    font-weight: 600;
    font-size: 0.88rem;
    text-decoration: none;
}

.forgot-link:hover {
    color: var(--blue-700);
    text-decoration: none;
}

.login-btn {
    width: 132px;
    height: 42px;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    font-size: 0.94rem;
    font-weight: 700;
    color: #ffffff;
    background: var(--blue-600);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: 0 8px 20px rgba(var(--auth-primary-rgb), 0.28);
    transition: background-color 0.15s ease, box-shadow 0.15s ease;
}

.login-btn:hover:not(:disabled) {
    background: var(--blue-700);
    box-shadow: 0 10px 24px rgba(var(--auth-primary-rgb), 0.3);
}

.login-btn:disabled {
    opacity: 0.68;
    cursor: default;
    box-shadow: none;
}

.login-btn-wide {
    width: 100%;
}

.login-btn .loader {
    width: 14px;
    height: 14px;
    border-radius: 999px;
    border: 2px solid rgba(239, 246, 255, 0.7);
    border-top-color: #ffffff;
    animation: auth-spin 0.6s linear infinite;
}

.login-footer {
    margin-top: 16px;
    text-align: left;
    font-size: 0.74rem;
    color: #8d9aae;
}

.alert {
    font-size: 0.8rem;
    padding: 8px 10px;
    border-radius: 8px;
    margin-bottom: 10px;
}

.alert-error {
    background: var(--danger-bg);
    color: var(--danger-text);
    border: 1px solid var(--danger-border);
}

.alert-success {
    background: var(--success-bg);
    color: var(--success-text);
    border: 1px solid var(--success-border);
}

@keyframes auth-spin {
    to {
        transform: rotate(360deg);
    }
}

@media (max-width: 920px) {
    .login-shell {
        grid-template-columns: 1fr;
        grid-template-rows: 300px auto;
        max-width: 680px;
        min-height: auto;
    }

    .login-visual {
        padding: 20px;
    }

    .login-visual-media {
        height: calc(100% - 136px);
    }

    .login-card {
        padding: 26px 24px 20px;
    }

    .login-form {
        margin-top: 12px;
    }
}

@media (max-width: 480px) {
    .auth-layout {
        align-items: center;
        padding: 14px 14px 20px;
        background:
            radial-gradient(560px 300px at 50% -10%, rgba(var(--auth-primary-rgb), 0.2) 0%, rgba(var(--auth-primary-rgb), 0) 72%),
            linear-gradient(180deg, var(--auth-bg-page-top) 0%, var(--auth-bg-page-bottom) 100%);
    }

    .login-shell {
        min-height: auto;
        max-width: 390px;
        width: 100%;
        display: grid;
        grid-template-columns: 1fr;
        grid-template-rows: auto auto;
        gap: 0;
        border-radius: 24px;
        background: #ffffff;
        box-shadow: 0 16px 34px rgba(15, 23, 42, 0.16);
        overflow: hidden;
        margin: 0 auto;
    }

    .login-visual {
        display: flex;
        min-height: 180px;
        padding: 16px 18px 14px;
        border-radius: 0;
        background:
            radial-gradient(circle at 10% 20%, rgba(255, 255, 255, 0.15) 0 10%, transparent 11%),
            radial-gradient(circle at 88% 24%, rgba(255, 255, 255, 0.14) 0 9%, transparent 10%),
            linear-gradient(160deg, var(--blue-600) 0%, var(--blue-700) 100%);
        position: relative;
    }

    .login-visual-media {
        display: none;
    }

    .login-visual-brand,
    .login-visual-text {
        position: relative;
        z-index: 2;
    }

    .login-visual-title {
        font-size: 1.6rem;
        margin-bottom: 2px;
    }

    .login-visual-subtitle {
        font-size: 0.8rem;
        line-height: 1.35;
    }

    .login-card {
        border-radius: 0;
        padding: 16px 18px 18px;
        background: var(--bg-card);
        box-shadow: none;
    }

    .login-header {
        text-align: left;
        margin: 0 0 10px;
    }

    .login-title {
        font-size: 1.65rem;
        color: var(--blue-600);
        margin: 0 0 2px;
    }

    .login-subtitle {
        display: block;
        font-size: 0.8rem;
        line-height: 1.4;
    }

    .form-group {
        margin-bottom: 10px;
    }

    label {
        font-size: 0.74rem;
        color: #6f7c8f;
        margin-bottom: 4px;
    }

    input[type="text"],
    input[type="password"] {
        height: 42px;
        border: 0;
        border-bottom: 1px solid var(--line);
        border-radius: 0;
        background: transparent;
        padding: 0 30px 0 0;
    }

    input:focus {
        border-color: var(--blue-600);
        box-shadow: none;
    }

    .password-toggle {
        right: 0;
    }

    .form-actions {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 8px;
        margin-top: 8px;
        margin-bottom: 10px;
        flex-wrap: nowrap;
    }

    .login-btn {
        width: 136px;
        min-width: 136px;
        height: 42px;
        border-radius: 10px;
        background: var(--blue-600);
        box-shadow: 0 8px 16px rgba(var(--auth-primary-rgb), 0.2);
    }

    .login-btn:hover:not(:disabled) {
        background: var(--blue-700);
        box-shadow: 0 10px 20px rgba(var(--auth-primary-rgb), 0.3);
    }

    .remember-label {
        display: inline-flex;
        font-size: 0.74rem;
        white-space: nowrap;
        gap: 4px;
    }

    .forgot-link {
        margin: 0 0 2px;
        font-size: 0.82rem;
        text-align: center;
        color: var(--blue-600);
    }

    .login-footer {
        margin-top: 12px;
        text-align: center;
        font-size: 0.72rem;
    }
}

@media (min-width: 481px) and (max-width: 920px) {
    .login-form {
        margin-top: 16px;
    }
}

input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus {
    -webkit-text-fill-color: var(--text-main);
    -webkit-box-shadow: 0 0 0 1000px #ffffff inset;
    transition: background-color 5000s ease-in-out 0s;
}
