:root {
    color-scheme: light;
    --page-bg: #f2f6fb;
    --control: #ffffff;
    --text: #122947;
    --muted: #5d7189;
    --border: #c9d8e7;
    --input: #f8fbfe;
    --link: #35698f;
    --button: #4f7fa7;
    --button-hover: #3f6b91;
    --subtle: #e5eef7;
    --focus: #79a7c9;
}

:root[data-theme="dark"] {
    color-scheme: dark;
    --page-bg: #111315;
    --control: #222529;
    --text: #f0f2f4;
    --muted: #adb4bb;
    --border: #3a3f44;
    --input: #191c1f;
    --link: #9ab8d0;
    --button: #6e9bc1;
    --button-hover: #83acd0;
    --subtle: #202326;
    --focus: #8cb5d8;
}

* {
    box-sizing: border-box;
}

html {
    min-width: 320px;
    background: var(--page-bg);
}

body {
    margin: 0;
    min-height: 100vh;
    background: var(--page-bg);
    color: var(--text);
    font-family: Inter, "Segoe UI", Arial, sans-serif;
}

button,
input {
    font: inherit;
}

button,
a {
    -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
a:focus-visible,
input:focus-visible {
    outline: 3px solid var(--focus);
    outline-offset: 3px;
}

.login-shell {
    display: grid;
    grid-template-columns: 47.2% 52.8%;
    min-height: 100vh;
}

.login-brand {
    position: relative;
    display: flex;
    min-width: 0;
    min-height: 100vh;
    flex-direction: column;
    overflow: hidden;
    padding: 32px clamp(30px, 2.8vw, 48px) 30px;
    background:
        linear-gradient(128deg, transparent 0 48%, rgba(139, 187, 221, 0.09) 48% 68%, transparent 68%),
        linear-gradient(158deg, #0d213a 0%, #153a5b 55%, #2b5874 100%);
    color: #f3f7fc;
}

:root[data-theme="dark"] .login-brand {
    background:
        linear-gradient(128deg, transparent 0 48%, rgba(129, 174, 207, 0.08) 48% 68%, transparent 68%),
        linear-gradient(158deg, #101923 0%, #152b40 56%, #243f51 100%);
}

.login-company-logo {
    position: relative;
    z-index: 2;
    display: block;
    width: min(224px, 68%);
    height: auto;
}

.login-product {
    position: relative;
    z-index: 2;
    display: flex;
    align-items: center;
    margin-top: clamp(78px, 10vh, 116px);
    gap: 14px;
    color: #9fc3df;
    font-family: Manrope, Inter, "Segoe UI", sans-serif;
    font-size: 40px;
    font-weight: 450;
    line-height: 1;
}

.login-product strong {
    color: #f4f8fc;
    font-weight: 700;
}

.login-product-mark {
    display: grid;
    width: 50px;
    height: 50px;
    flex: 0 0 50px;
    place-items: center;
    border: 1px solid rgba(168, 204, 232, 0.36);
    border-radius: 10px;
    background: rgba(118, 169, 208, 0.13);
    color: #9fc8e8;
}

.login-product-mark svg {
    width: 26px;
    height: 26px;
}

.login-brand-copy {
    position: relative;
    z-index: 2;
    margin-top: 42px;
}

.login-brand-copy h1 {
    max-width: 470px;
    margin: 0;
    color: #f4f8fc;
    font-family: Manrope, Inter, "Segoe UI", sans-serif;
    font-size: 48px;
    font-weight: 680;
    letter-spacing: 0;
    line-height: 1.08;
}

.login-brand-copy h1 span {
    color: #9fc3df;
}

.login-brand-copy p {
    max-width: 390px;
    margin: 21px 0 0;
    color: #c4d4e2;
    font-size: 14px;
    line-height: 1.65;
}

.brand-contours {
    position: absolute;
    right: -62px;
    bottom: 50px;
    width: 310px;
    height: 310px;
    pointer-events: none;
    transform: rotate(-18deg);
}

.brand-contours span {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 100%;
    height: 78%;
    border: 1px solid rgba(143, 184, 216, 0.29);
    border-radius: 30%;
    transform: translate(-50%, -50%);
}

.brand-contours span:nth-child(2) {
    width: 82%;
    height: 65%;
    opacity: 0.8;
}

.brand-contours span:nth-child(3) {
    width: 64%;
    height: 52%;
    opacity: 0.62;
}

.brand-contours span:nth-child(4) {
    width: 46%;
    height: 39%;
    opacity: 0.46;
}

.login-company-footer {
    position: relative;
    z-index: 2;
    display: flex;
    max-width: 460px;
    align-items: center;
    margin: auto 0 0;
    gap: 11px;
    color: #c4d4e2;
    font-size: 11px;
    line-height: 1.65;
}

.login-company-footer::before {
    width: 27px;
    height: 1px;
    flex: 0 0 27px;
    background: #8fb8d8;
    content: "";
}

.login-form-panel {
    display: grid;
    min-width: 0;
    min-height: 100vh;
    grid-template-rows: auto 1fr auto;
    padding: 25px clamp(34px, 3.4vw, 60px) 30px;
    background: var(--page-bg);
    transition: background-color 220ms ease, color 220ms ease;
}

.login-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: var(--link);
    font-size: 10px;
    font-weight: 750;
    letter-spacing: 0.16em;
}

.auth-theme-toggle {
    display: grid;
    width: 46px;
    height: 46px;
    place-items: center;
    border: 1px solid var(--border);
    border-radius: 50%;
    padding: 11px;
    background: var(--subtle);
    color: var(--link);
    cursor: pointer;
    transition: background-color 160ms ease, border-color 160ms ease, color 160ms ease, transform 160ms ease;
}

.auth-theme-toggle:hover {
    border-color: var(--focus);
    background: var(--control);
    transform: translateY(-2px);
}

.auth-theme-toggle:active {
    transform: scale(0.94);
}

.auth-theme-toggle span,
.auth-theme-toggle svg {
    display: block;
    width: 21px;
    height: 21px;
}

.auth-theme-toggle.is-changing span {
    animation: auth-icon-swap 300ms cubic-bezier(0.16, 1, 0.3, 1);
}

.login-form-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 0;
}

.login-form {
    width: 100%;
    max-width: 380px;
}

.form-eyebrow {
    display: block;
    color: var(--link);
    font-size: 10px;
    font-weight: 760;
    letter-spacing: 0.15em;
}

.login-form h2 {
    margin: 13px 0 0;
    color: var(--text);
    font-family: Manrope, Inter, "Segoe UI", sans-serif;
    font-size: 36px;
    font-weight: 740;
    letter-spacing: 0;
    line-height: 1.15;
}

.form-intro {
    margin: 13px 0 30px;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.65;
}

.auth-error {
    margin: -10px 0 19px;
    border-left: 3px solid #bd5b65;
    padding: 9px 11px;
    background: color-mix(in srgb, #bd5b65 11%, transparent);
    color: #a43642;
    font-size: 12px;
    line-height: 1.5;
}

:root[data-theme="dark"] .auth-error {
    color: #f0b9bf;
}

.auth-field {
    margin-top: 22px;
}

.auth-field.compact-field {
    margin-top: 15px;
}

.auth-field label,
.auth-label-row label {
    display: block;
    margin: 0 0 8px;
    color: var(--text);
    font-size: 12px;
    font-weight: 650;
}

.auth-label-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
}

.auth-label-row a {
    color: var(--link);
    font-size: 11px;
    font-weight: 650;
    text-decoration: none;
}

.auth-label-row a:hover {
    text-decoration: underline;
}

.auth-input-wrap {
    position: relative;
    display: flex;
    height: 52px;
    align-items: center;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--input);
    color: var(--muted);
    transition: border-color 150ms ease, box-shadow 150ms ease, background-color 220ms ease;
}

.auth-input-wrap:focus-within {
    border-color: var(--focus);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 18%, transparent);
}

.auth-input-wrap > svg {
    width: 18px;
    height: 18px;
    flex: 0 0 18px;
    margin-left: 15px;
}

.auth-input-wrap input {
    width: 100%;
    min-width: 0;
    height: 100%;
    border: 0;
    outline: 0;
    padding: 0 13px;
    background: transparent;
    color: var(--text);
    font-size: 14px;
}

.auth-input-wrap input::placeholder {
    color: var(--muted);
    opacity: 1;
}

.auth-input-wrap input:autofill,
.auth-input-wrap input:-webkit-autofill,
.auth-input-wrap input:-webkit-autofill:hover,
.auth-input-wrap input:-webkit-autofill:focus,
.auth-input-wrap input:-webkit-autofill:active {
    border-radius: 0 7px 7px 0;
    -webkit-box-shadow: 0 0 0 1000px var(--input) inset;
    box-shadow: 0 0 0 1000px var(--input) inset;
    -webkit-text-fill-color: var(--text);
    caret-color: var(--text);
}

.password-toggle {
    display: grid;
    width: 46px;
    height: 46px;
    flex: 0 0 46px;
    place-items: center;
    border: 0;
    padding: 12px;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
}

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

.password-toggle svg {
    width: 19px;
    height: 19px;
}

.auth-primary {
    display: flex;
    width: 100%;
    min-height: 52px;
    align-items: center;
    justify-content: center;
    margin-top: 25px;
    border: 1px solid var(--button);
    border-radius: 8px;
    padding: 0 20px;
    gap: 10px;
    background: var(--button);
    color: #ffffff;
    font-size: 14px;
    font-weight: 680;
    text-decoration: none;
    cursor: pointer;
    transition: background-color 160ms ease, border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

:root[data-theme="dark"] .auth-primary {
    color: #0b1a2b;
}

.auth-primary:hover {
    border-color: var(--button-hover);
    background: var(--button-hover);
    box-shadow: 0 8px 24px color-mix(in srgb, var(--button) 24%, transparent);
    transform: translateY(-1px);
}

.auth-primary:active {
    box-shadow: none;
    transform: scale(0.985);
}

.auth-primary:disabled {
    cursor: wait;
    opacity: 0.7;
}

.auth-primary svg {
    width: 16px;
    height: 16px;
}

.auth-link-button svg {
    margin-right: 2px;
}

.account-note {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 22px;
    gap: 8px;
    color: var(--muted);
    font-size: 11px;
    line-height: 1.5;
}

.account-note svg {
    width: 15px;
    height: 15px;
    flex: 0 0 15px;
}

.recovery-note {
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 15px;
    background: var(--subtle);
    color: var(--muted);
    font-size: 13px;
    line-height: 1.7;
}

.password-change-panel {
    width: 100%;
    max-width: 460px;
}

.password-change-panel .login-form,
.password-change-panel .signout-form {
    max-width: none;
}

.signout-form {
    width: 100%;
    margin: 12px 0 0;
    text-align: center;
}

.signout-form button {
    min-height: 44px;
    border: 0;
    border-radius: 8px;
    padding: 0 16px;
    background: transparent;
    color: var(--link);
    cursor: pointer;
    font-size: 12px;
    transition: background-color 160ms ease, color 160ms ease;
}

.signout-form button:hover {
    background: var(--subtle);
    color: var(--text);
}

.login-panel-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    color: var(--muted);
    font-size: 11px;
}

.login-panel-footer svg {
    width: 15px;
    height: 15px;
    flex: 0 0 15px;
}

@keyframes auth-icon-swap {
    from {
        opacity: 0;
        transform: rotate(-40deg) scale(0.65);
    }
    to {
        opacity: 1;
        transform: rotate(0) scale(1);
    }
}

@media (max-width: 1000px) {
    .login-shell {
        grid-template-columns: 43% 57%;
    }

    .login-brand {
        padding-right: 30px;
        padding-left: 30px;
    }

    .login-product {
        font-size: 32px;
    }

    .login-product-mark {
        width: 44px;
        height: 44px;
        flex-basis: 44px;
    }

    .login-brand-copy h1 {
        font-size: 38px;
    }

    .brand-contours {
        right: -145px;
    }
}

@media (max-width: 760px) {
    .login-shell {
        grid-template-columns: minmax(0, 1fr);
    }

    .login-brand {
        min-height: 300px;
        padding: 24px 24px 23px;
    }

    .login-company-logo {
        width: 185px;
    }

    .login-product {
        margin-top: 42px;
        gap: 11px;
        font-size: 27px;
    }

    .login-product-mark {
        width: 40px;
        height: 40px;
        flex-basis: 40px;
        border-radius: 8px;
    }

    .login-product-mark svg {
        width: 22px;
        height: 22px;
    }

    .login-brand-copy {
        margin-top: 25px;
    }

    .login-brand-copy h1 {
        font-size: 30px;
    }

    .login-brand-copy p {
        display: none;
    }

    .brand-contours {
        right: -98px;
        bottom: -115px;
        width: 290px;
        height: 290px;
    }

    .login-company-footer {
        display: none;
    }

    .login-form-panel {
        min-height: 590px;
        padding: 21px 23px 25px;
    }

    .auth-theme-toggle {
        width: 42px;
        height: 42px;
        padding: 10px;
    }

    .login-form-wrap {
        padding: 40px 0;
    }

    .login-form h2 {
        font-size: 30px;
    }

    .login-panel-footer {
        justify-content: flex-start;
    }
}

@media (max-width: 420px) {
    .login-brand {
        min-height: 270px;
    }

    .login-brand-copy h1 {
        font-size: 28px;
    }

    .login-form-panel {
        padding-right: 17px;
        padding-left: 17px;
    }

    .login-panel-header {
        font-size: 10px;
    }

    .account-note {
        align-items: flex-start;
        justify-content: flex-start;
    }
}

@media (max-height: 760px) and (min-width: 761px) {
    .login-brand,
    .login-form-panel {
        padding-top: 24px;
        padding-bottom: 24px;
    }

    .login-product {
        margin-top: 45px;
    }

    .login-brand-copy {
        margin-top: 30px;
    }

    .login-brand-copy h1 {
        font-size: 36px;
    }

    .login-brand-copy p {
        margin-top: 17px;
    }

    .login-form-wrap {
        padding: 30px 0;
    }

    .form-intro {
        margin-bottom: 23px;
    }

    .auth-field {
        margin-top: 20px;
    }

    .auth-input-wrap,
    .auth-primary {
        min-height: 48px;
        height: 48px;
    }

    .auth-primary {
        margin-top: 23px;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
