:root {
    --page-bg: #020611;
    --panel-bg: #07101f;
    --panel-deep: #030918;
    --line: rgba(118, 151, 214, 0.34);
    --line-soft: rgba(118, 151, 214, 0.18);
    --blue: #3184ff;
    --violet: #7933f3;
    --text: #f5f7fb;
    --muted: #aeb7ca;
}

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

html,
body {
    min-height: 100%;
}

body {
    margin: 0;
    color: var(--text);
    font-family: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
    background:
        radial-gradient(circle at 15% 92%, rgba(42, 56, 200, .28), transparent 27%),
        radial-gradient(circle at 35% 5%, rgba(34, 83, 175, .11), transparent 27%),
        linear-gradient(118deg, #02050c 0%, #040817 46%, #01040c 100%);
    overflow-x: hidden;
}

.login-wrapper {
    min-height: 100vh;
    padding: 48px 24px 52px;
    position: relative;
    flex-direction: column;
}

.theme-switch {
    position: fixed;
    z-index: 20;
    top: 24px;
    right: 30px;
    display: flex;
    align-items: center;
    gap: 9px;
    min-width: 108px;
    height: 42px;
    padding: 0 12px;
    border: 1px solid rgba(118, 157, 231, .5);
    border-radius: 22px;
    background: rgba(8, 18, 35, .86);
    color: #8292af;
    box-shadow: 0 8px 24px rgba(0, 0, 0, .24);
    cursor: pointer;
}

.theme-switch:focus-visible {
    outline: 2px solid #568bff;
    outline-offset: 3px;
}

.theme-icon {
    width: 17px;
    height: 17px;
    flex: 0 0 17px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.7;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.theme-icon-moon {
    color: #8faeff;
}

.theme-switch-track {
    width: 34px;
    height: 18px;
    position: relative;
    flex: 0 0 34px;
    border: 1px solid rgba(112, 141, 202, .5);
    border-radius: 10px;
    background: #111d35;
}

.theme-switch-thumb {
    width: 12px;
    height: 12px;
    position: absolute;
    top: 2px;
    left: 3px;
    border-radius: 50%;
    background: #7599ff;
    box-shadow: 0 0 7px rgba(76, 116, 255, .55);
}

html[data-theme="light"] .theme-switch-thumb {
    left: 17px;
    background: #f3b72f;
    box-shadow: none;
}

html[data-theme="light"] .theme-icon-moon {
    color: #8490a5;
}

html[data-theme="light"] .theme-icon-sun {
    color: #c98700;
}

.login-wrapper::before {
    content: "";
    position: fixed;
    left: -12vw;
    bottom: -42vh;
    width: 72vw;
    height: 76vh;
    border-radius: 50%;
    border: 1px solid rgba(75, 95, 255, .14);
    box-shadow: 0 -22px 70px rgba(42, 52, 245, .12);
    pointer-events: none;
}

.login-card {
    width: min(676px, 100%);
    position: relative;
    overflow: hidden;
    border: 1px solid rgba(118, 157, 231, .74);
    border-radius: 30px;
    background:
        radial-gradient(circle at 42% 20%, rgba(35, 91, 191, .09), transparent 35%),
        linear-gradient(122deg, #081425 0%, #050b18 56%, #020716 100%);
    box-shadow:
        0 25px 60px rgba(0, 0, 0, .55),
        0 0 26px rgba(54, 108, 225, .14),
        inset 0 0 35px rgba(64, 108, 201, .06);
}

.login-card::after {
    content: "";
    position: absolute;
    left: 10%;
    right: 10%;
    bottom: -2px;
    height: 2px;
    background: linear-gradient(90deg, transparent, #5268ff 40%, #b8c6ff 55%, transparent);
    box-shadow: 0 0 14px #334dff;
    pointer-events: none;
}

.form-side {
    width: 100%;
    padding: 56px 60px 48px;
}

.brand {
    margin-bottom: 32px !important;
}

.brand-logo {
    height: 50px;
    width: auto;
    filter: brightness(0) invert(1);
}

.welcome-title {
    margin: 0 0 28px;
    color: #f7f8fb;
    font-size: 2rem;
    font-weight: 650;
    letter-spacing: -.035em;
}

.auth-help-text {
    color: var(--muted);
}

.form-control.auth-standalone-field {
    height: 55px;
    padding: 0 16px;
    border: 1px solid var(--line);
    border-radius: 9px;
}

.input-group .form-control.auth-standalone-field {
    padding-right: 16px;
    padding-left: 16px;
}

.form-label {
    margin-bottom: 8px;
    color: #f0f2f7;
    font-size: .98rem;
    font-weight: 400;
}

#loginForm>.mb-3 {
    margin-bottom: 19px !important;
}

.input-group {
    height: 55px;
    flex-wrap: nowrap;
}

.input-group-text,
.toggle-password {
    display: flex;
    align-items: center;
}

.form-control,
.input-group-text,
.toggle-password {
    border-color: var(--line);
    background: rgba(11, 20, 39, .7);
    color: var(--text);
}

.input-group-text {
    width: 48px;
    padding: 0 0 0 17px;
    border-right: 0;
    border-radius: 9px 0 0 9px;
    color: #bdc6d8;
    font-size: 1.16rem;
}

.field-icon,
.password-eye {
    display: block;
    width: 19px;
    height: 19px;
    flex: 0 0 19px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.55;
    stroke-linecap: round;
    stroke-linejoin: round;
    shape-rendering: geometricPrecision;
}

.form-control {
    min-width: 0;
    padding: 0 10px 0 0;
    border-left: 0;
    border-radius: 0 9px 9px 0;
    font-size: .98rem;
}

.form-control::placeholder {
    color: #98a1b6;
    opacity: 1;
}

.form-control:focus {
    border-color: #4f75bb;
    border-left: 0;
    background: rgba(11, 20, 39, .82);
    color: #fff;
    box-shadow: none;
}

.input-group:focus-within .input-group-text,
.input-group:focus-within .toggle-password {
    border-color: #4f75bb;
}

.toggle-password {
    width: 48px;
    padding: 0 15px 0 7px;
    border-left: 0;
    border-radius: 0 9px 9px 0;
    color: #aeb8cc;
}

.toggle-password .password-eye {
    margin-left: auto;
}

.toggle-password:hover,
.toggle-password:focus {
    border-color: var(--line);
    background: rgba(11, 20, 39, .7);
    color: #fff;
    box-shadow: none;
}

#password {
    border-radius: 0;
    border-right: 0;
}

#loginForm>.d-flex {
    margin-bottom: 24px !important;
}

.form-check-input {
    width: 20px;
    height: 20px;
    margin-top: 1px;
    border-color: #4c6eac;
    border-radius: 4px;
    background-color: #0b1427;
}

.form-check-input:checked {
    border-color: #317bff;
    background-color: #317bff;
}

.form-check-input:focus {
    border-color: #4c77cb;
    box-shadow: none;
}

.form-check-label {
    padding-left: 7px;
    color: #f1f3f7;
    font-size: .94rem;
}

.forgot-link {
    color: #3b8cff;
    font-size: .94rem;
    text-decoration: none;
}

.forgot-link:hover {
    color: #70aaff;
}

.btn-login {
    min-height: 55px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 8px;
    background: linear-gradient(100deg, #2f84ff 0%, #4059ff 47%, #7d2cf0 100%);
    color: #fff;
    font-size: 1.05rem;
    font-weight: 600;
    box-shadow: 0 8px 24px rgba(53, 78, 255, .2);
    transition: transform .18s ease, box-shadow .18s ease, filter .18s ease;
}

.btn-login:hover,
.btn-login:focus,
.btn-login:active {
    background: linear-gradient(100deg, #2f84ff 0%, #4059ff 47%, #7d2cf0 100%) !important;
    color: #fff !important;
    box-shadow: 0 12px 28px rgba(53, 78, 255, .3) !important;
    transform: translateY(-1px);
}

.btn-login:active {
    transform: translateY(0) scale(.99);
}

.auth-back-button {
    min-height: 48px;
    margin-top: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--line);
    border-radius: 8px;
    color: #c9d2e4;
    font-size: .95rem;
    font-weight: 500;
    text-decoration: none;
    transition: border-color .16s ease, background .16s ease, color .16s ease;
}

.auth-back-button:hover,
.auth-back-button:focus {
    border-color: #4f75bb;
    background: rgba(79, 117, 187, .1);
    color: #fff;
}

button.is-submitting {
    cursor: wait !important;
    opacity: .82;
    pointer-events: none;
}

button.is-submitting::after {
    content: '';
    display: inline-block;
    width: 16px;
    height: 16px;
    margin-left: 10px;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    vertical-align: -.15em;
    animation: auth-submit-spin .65s linear infinite;
}

.btn-login.is-submitting .btn-arrow {
    display: none;
}

@keyframes auth-submit-spin {
    to { transform: rotate(360deg); }
}

.btn-arrow {
    position: absolute;
    right: 20px;
    font-size: 1.35rem;
}

.invalid-feedback {
    font-size: .75rem;
}

.form-control.is-invalid {
    border-color: #e16071;
    background-image: none;
}

html[data-theme="light"] body {
    color: #172033;
    background:
        radial-gradient(circle at 15% 92%, rgba(75, 105, 235, .13), transparent 28%),
        radial-gradient(circle at 72% 8%, rgba(89, 133, 221, .11), transparent 30%),
        linear-gradient(118deg, #eef3fb 0%, #f8faff 48%, #eaf0f9 100%);
}

html[data-theme="light"] .login-wrapper::before {
    border-color: rgba(78, 101, 226, .16);
    box-shadow: 0 -22px 70px rgba(80, 102, 222, .09);
}

html[data-theme="light"] .login-card {
    border-color: rgba(72, 108, 177, .5);
    background:
        radial-gradient(circle at 42% 20%, rgba(86, 130, 211, .08), transparent 36%),
        linear-gradient(145deg, rgba(255, 255, 255, .98), rgba(239, 244, 252, .98));
    box-shadow:
        0 25px 60px rgba(44, 65, 102, .16),
        0 0 25px rgba(75, 112, 184, .09),
        inset 0 0 35px rgba(255, 255, 255, .55);
}

html[data-theme="light"] .brand-logo {
    filter: none;
}

html[data-theme="light"] .auth-back-button {
    border-color: rgba(74, 105, 159, .38);
    color: #344057;
}

html[data-theme="light"] .auth-back-button:hover,
html[data-theme="light"] .auth-back-button:focus {
    border-color: #4f75bb;
    background: rgba(79, 117, 187, .08);
    color: #172033;
}

html[data-theme="light"] .welcome-title {
    color: #172033;
}

html[data-theme="light"] .auth-help-text {
    color: #5f6b7f;
}

html[data-theme="light"] .form-label,
html[data-theme="light"] .form-check-label {
    color: #263249;
}

html[data-theme="light"] .form-control,
html[data-theme="light"] .input-group-text,
html[data-theme="light"] .toggle-password {
    border-color: rgba(74, 105, 159, .38);
    background: rgba(247, 249, 253, .92);
    color: #263249;
}

html[data-theme="light"] .form-control::placeholder {
    color: #7c879a;
}

html[data-theme="light"] .form-control:focus {
    border-color: #4f75bb;
    background: #fff;
    color: #172033;
}

html[data-theme="light"] .toggle-password:hover,
html[data-theme="light"] .toggle-password:focus {
    border-color: rgba(74, 105, 159, .38);
    background: #fff;
    color: #172033;
}

html[data-theme="light"] .form-check-input {
    border-color: #8190aa;
    background-color: #fff;
}

html[data-theme="light"] .form-check-input:checked {
    border-color: #317bff;
    background-color: #317bff;
}

html[data-theme="light"] .theme-switch {
    border-color: rgba(78, 104, 153, .4);
    background: rgba(255, 255, 255, .9);
    color: #68758a;
    box-shadow: 0 8px 24px rgba(43, 64, 99, .12);
}

html[data-theme="light"] .theme-switch-track {
    border-color: rgba(120, 130, 149, .42);
    background: #e8edf5;
}

.input-group:has(.form-control.is-invalid) .input-group-text,
.input-group:has(.form-control.is-invalid) .toggle-password {
    border-color: #e16071;
}

@media (max-width: 575.98px) {
    .login-wrapper {
        padding: 12px;
    }

    .login-card {
        border-radius: 22px;
    }

    .form-side {
        padding: 34px 24px 30px;
    }

    .brand-logo {
        height: 50px;
    }

    .welcome-title {
        font-size: 1.65rem;
    }

    .welcome-sub {
        font-size: .9rem;
    }

    .theme-switch {
        top: 14px;
        right: 14px;
    }
}

@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        animation: none !important;
        transition: none !important;
    }
}

.login-footer {
    margin-top: 18px;
    color: var(--muted);
    font-size: .78rem;
    text-align: center;
}

/* Contur unic pentru câmpuri; butonul de parolă are doar separator în stânga. */
.input-group {
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: rgba(11, 20, 39, .7);
    transition: border-color .16s ease, background .16s ease;
}

.input-group .input-group-text,
.input-group .form-control,
.input-group .toggle-password {
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
}

.input-group .toggle-password {
    height: 100%;
    margin: 0 !important;
    border-left: 1px solid var(--line) !important;
    transition: color .16s ease, background .16s ease !important;
}

.input-group .toggle-password:hover {
    background: rgba(79, 117, 187, .12) !important;
}

.input-group:focus-within {
    border-color: #4f75bb;
    background: rgba(11, 20, 39, .82);
}

.input-group:focus-within .toggle-password {
    border-left-color: #4f75bb !important;
}

.input-group:has(.form-control.is-invalid) {
    border-color: #e16071;
}

html[data-theme="light"] .input-group {
    border-color: rgba(74, 105, 159, .38);
    background: rgba(247, 249, 253, .92);
}

html[data-theme="light"] .input-group:focus-within {
    border-color: #4f75bb;
    background: #fff;
}

html[data-theme="light"] .input-group .toggle-password {
    border-left-color: rgba(74, 105, 159, .38) !important;
}

html[data-theme="light"] .input-group:focus-within .toggle-password {
    border-left-color: #4f75bb !important;
}

.input-group .form-control:-webkit-autofill,
.input-group .form-control:-webkit-autofill:hover,
.input-group .form-control:-webkit-autofill:focus,
.input-group .form-control:-webkit-autofill:active,
.form-control.auth-standalone-field:-webkit-autofill,
.form-control.auth-standalone-field:-webkit-autofill:hover,
.form-control.auth-standalone-field:-webkit-autofill:focus,
.form-control.auth-standalone-field:-webkit-autofill:active {
    -webkit-box-shadow: 0 0 0 1000px #0a1426 inset !important;
    -webkit-text-fill-color: #f5f7fb !important;
    caret-color: #f5f7fb;
    transition: background-color 9999s ease-out 0s;
}

html[data-theme="light"] .input-group .form-control:-webkit-autofill,
html[data-theme="light"] .input-group .form-control:-webkit-autofill:hover,
html[data-theme="light"] .input-group .form-control:-webkit-autofill:focus,
html[data-theme="light"] .input-group .form-control:-webkit-autofill:active,
html[data-theme="light"] .form-control.auth-standalone-field:-webkit-autofill,
html[data-theme="light"] .form-control.auth-standalone-field:-webkit-autofill:hover,
html[data-theme="light"] .form-control.auth-standalone-field:-webkit-autofill:focus,
html[data-theme="light"] .form-control.auth-standalone-field:-webkit-autofill:active {
    -webkit-box-shadow: 0 0 0 1000px #f7f9fd inset !important;
    -webkit-text-fill-color: #263249 !important;
    caret-color: #263249;
}

.form-control.auth-standalone-field:focus {
    border-left: 1px solid #4f75bb;
}

.mfa-trust-select {
    height: 48px;
    border: 1px solid var(--line);
    border-left: 1px solid var(--line) !important;
    border-radius: 9px;
    background-color: rgba(11, 20, 39, .7);
    color: var(--text);
    padding: 0 42px 0 12px;
    appearance: none;
    cursor: pointer;
}

.mfa-select-wrap:focus-within .mfa-trust-select {
    border-color: #4f75bb !important;
}

.mfa-select-wrap {
    position: relative;
}

.mfa-select-wrap::after {
    position: absolute;
    top: 50%;
    right: 18px;
    width: 9px;
    height: 9px;
    border-right: 2px solid #9fb0cc;
    border-bottom: 2px solid #9fb0cc;
    content: '';
    pointer-events: none;
    transform: translateY(-70%) rotate(45deg);
    transition: transform .2s ease;
}

.mfa-select-wrap:focus-within::after {
    border-color: #7da2ff;
    transform: translateY(-30%) rotate(225deg);
}

.mfa-trust-select option {
    background: #07101f;
    color: #f5f7fb;
}

html[data-theme="light"] .mfa-trust-select {
    border-color: rgba(74, 105, 159, .38);
    border-left-color: rgba(74, 105, 159, .38) !important;
    background-color: #fff;
    color: #263249;
}

html[data-theme="light"] .mfa-select-wrap:focus-within .mfa-trust-select {
    border-left-color: #4f75bb !important;
}

html[data-theme="light"] .mfa-trust-select option {
    background: #fff;
    color: #263249;
}

html[data-theme="light"] .mfa-select-wrap::after {
    border-color: #60708c;
}

.mfa-secondary-actions {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 9px;
    margin-top: 17px;
}

.mfa-secondary-actions form {
    margin: 0;
}

.mfa-text-action {
    border: 0;
    background: transparent;
    padding: 0;
    cursor: pointer;
}

.mfa-action-separator {
    color: #61708c;
    font-size: .8rem;
}

.mfa-recovery-panel {
    margin-top: 17px;
}

.mfa-recovery-panel .form-control {
    padding: 0 14px;
}

.mfa-recovery-panel[hidden] {
    display: none;
}
