html {
    width: 100%;
    min-height: 100%;
    margin: 0;
}

body.rs-login-page,
body {
    min-height: var(--app-vh, 100dvh);
    margin: 0;
    background: #CCCCCC;
    color: #434A54;
    font-family: Roboto, Arial, sans-serif;
}

button,
input {
    font: inherit;
}

button {
    border: 0;
}

[hidden] {
    display: none !important;
}

#login-root {
    min-height: var(--app-vh, 100dvh);
}

body.rs-app-login,
body.rs-login-page {
    background: #F2F2F2;
}

body.rs-app-login #login-root,
body.rs-login-page #login-root {
    width: 100dvw;
    min-height: var(--app-vh, 100dvh);
    overflow-x: hidden;
}

body.rs-app-login #container {
    width: 100dvw;
    max-width: none;
    min-height: var(--app-vh, 100dvh);
}

#container {
    display: flex;
    align-items: stretch;
    justify-content: center;
    flex-wrap: wrap;
    min-height: var(--app-vh, 100dvh);
    width: 100%;
}

#logo_wrap {
    display: flex;
    flex: 1 1 40%;
    min-width: 320px;
    max-width: 480px;
    background: #004B96;
    padding: 6rem 4rem;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
}

#logo_wrap img {
    width: 100%;
    max-width: 200px;
    max-height: 20dvh;
}

#form_wrap {
    flex: 1 1 60%;
    min-width: 320px;
    background: #F2F2F2;
    padding: 3rem 4rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    position: relative;
    box-sizing: border-box;
}

#form_wrap h1 {
    color: #004B96;
    font-size: 1.6rem;
    margin: 0 0 1rem;
    text-align: center;
    font-weight: 600;
}

#login_form {
    max-width: 430px;
    width: 100%;
    margin: 0 auto;
}

.login_inputWrap {
    position: relative;
    margin: 1rem 0;
}

.login_inputWrap i {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: #004B96;
    font-size: 1.1rem;
    pointer-events: none;
}

.login_inputWrap .input {
    width: 100%;
    min-width: 10rem;
    box-sizing: border-box;
    padding: 0.7rem 1rem 0.7rem 2.6rem;
    border: 0.1rem solid #FFFFFF;
    border-radius: 0;
    background: #FFFFFF;
    color: #434A54;
    font-size: 1.05rem;
}

.login_inputWrap .input:focus,
.lang-btn:focus,
.btn:focus,
.form_bottom button:focus,
.lang-option:focus {
    outline: 2px solid #89B8E8;
    outline-offset: 2px;
}

.login_inputWrap .code-input {
    letter-spacing: 0.24em;
    text-align: center;
    font-variant-numeric: tabular-nums;
}

.info-wrap {
    margin-top: 0;
    margin-bottom: 0.5rem;
}

.infoMessage {
    margin: 0;
    text-align: center;
    white-space: pre-line;
    font-weight: 600;
    color: #004B96;
}

.infoMessage.err,
.infoMessage.error,
.message.error {
    color: #C40000;
}

.infoMessage.success,
.message.success {
    color: #027A48;
}

.btn {
    display: block;
    width: 100%;
    box-sizing: border-box;
    padding: 0.75rem 1rem;
    border: 0.1rem solid #004B96;
    background: #004B96;
    color: #FFFFFF;
    font-size: 1.08rem;
    font-weight: 600;
    text-align: center;
    cursor: pointer;
}

.btn.is-loading {
    opacity: 0.75;
    cursor: progress;
}

.btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.form_bottom {
    max-width: 430px;
    width: 100%;
    margin: 0 auto;
    text-align: center;
}

.form_bottom button {
    display: block;
    width: 100%;
    margin-top: 1rem;
    padding: 0;
    background: transparent;
    color: #004B96;
    font-weight: 500;
    text-align: center;
    cursor: pointer;
}

.form_bottom button:hover,
.copyright:hover {
    text-decoration: underline;
}

.copyright {
    display: block;
    margin-top: 1.5rem;
    color: #004B96;
    font-size: 0.9rem;
    font-weight: 500;
    text-align: center;
    text-decoration: none;
}

.app-version {
    display: block;
    min-height: 1rem;
    margin-top: 0.35rem;
    color: #64748B;
    font-size: 0.78rem;
    text-align: center;
}

.lang-btn {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    box-sizing: border-box;
    padding: 0.7rem 1rem;
    border: 0.1rem solid #FFFFFF;
    background: #FFFFFF;
    color: #434A54;
    font-size: 1.05rem;
    cursor: pointer;
}

.lang-btn-flag,
.lang-flag {
    flex: 0 0 auto;
    background-size: cover;
    background-position: center;
    border: 1px solid #004B96;
}

.lang-btn-flag {
    width: 24px;
    height: 16px;
}

.lang-btn-text {
    flex: 1;
    text-align: left;
}

.lang-overlay {
    position: fixed;
    inset: 0;
    z-index: 999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    background: rgba(0, 0, 0, 0.6);
    box-sizing: border-box;
}

.lang-panel {
    width: 100%;
    max-width: 420px;
    max-height: 90dvh;
    overflow: auto;
    box-sizing: border-box;
    padding: 1.5rem;
    border-radius: 8px;
    background: #F2F2F2;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.15);
}

.lang-title {
    margin: 0 0 1rem;
    color: #004B96;
    text-align: center;
}

.lang-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.lang-option {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    box-sizing: border-box;
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid #E0E0E0;
    background: #FFFFFF;
    cursor: pointer;
}

.lang-option:hover {
    border-color: #004B96;
}

.lang-option .lang-flag {
    width: 32px;
    height: 20px;
}

.lang-option .lang-name {
    color: #434A54;
    font-weight: 600;
}

.password-strength {
    max-width: 430px;
    margin: 0.75rem auto 1rem;
    color: #434A54;
}

.password-strength-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 0.45rem;
    font-size: 0.9rem;
    font-weight: 600;
}

.password-strength-label {
    color: #004B96;
}

.password-strength-bar {
    width: 100%;
    height: 0.5rem;
    overflow: hidden;
    background: #D7DCE2;
}

.password-strength-bar-fill {
    display: block;
    width: 8%;
    height: 100%;
    background: #C40000;
    transition: width 160ms ease, background 160ms ease;
}

.password-strength-bar-fill[data-score="2"],
.password-strength-bar-fill[data-score="3"] {
    background: #B7791F;
}

.password-strength-bar-fill[data-score="4"],
.password-strength-bar-fill[data-score="5"] {
    background: #027A48;
}

.password-rules {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.35rem 1rem;
    margin: 0.65rem 0 0;
    padding: 0;
    list-style: none;
    font-size: 0.82rem;
}

.password-rules li {
    display: flex;
    align-items: flex-start;
    gap: 0.4rem;
    color: #6A717C;
}

.password-rules li::before {
    content: "";
    flex: 0 0 auto;
    width: 0.45rem;
    height: 0.45rem;
    margin-top: 0.35rem;
    border-radius: 50%;
    background: #B8C0C9;
}

.password-rules li.passed {
    color: #027A48;
}

.password-rules li.passed::before {
    background: #027A48;
}

.password-rules li.failed {
    color: #8A1F1F;
}

@media (max-width: 860px) {
    body.rs-app-login,
    body.rs-login-page {
        width: 100dvw;
        min-height: var(--app-vh, 100dvh);
        overflow-x: hidden;
    }

    body.rs-app-login #login-root,
    body.rs-login-page #login-root {
        background: #F2F2F2;
    }

    #container {
        flex-direction: column;
        justify-content: flex-start;
        width: 100dvw;
        max-width: none;
        min-height: var(--app-vh, 100dvh);
    }

    #logo_wrap,
    #form_wrap {
        max-width: none;
        min-width: 0;
        width: 100dvw;
    }

    #logo_wrap {
        flex: 1 1 auto;
        min-height: clamp(9.5rem, 28dvh, 16rem);
        padding: 1.25rem;
    }

    #form_wrap {
        flex: 0 0 auto;
        min-height: 0;
        padding: 1.4rem 1.25rem calc(1.4rem + env(safe-area-inset-bottom, 0px));
        justify-content: flex-start;
    }

    #logo_wrap img {
        max-width: clamp(11rem, 24dvh, 13rem);
        max-height: min(8.5rem, 72%);
    }

    #login_form,
    .form_bottom,
    .password-strength {
        max-width: 28rem;
    }
}

@media (max-width: 520px) {
    #logo_wrap {
        min-height: clamp(8.5rem, 25dvh, 15rem);
        padding: 1rem;
    }

    #logo_wrap img {
        max-width: clamp(9.75rem, 23dvh, 12rem);
        max-height: min(8rem, 72%);
    }

    #form_wrap {
        padding: 1.1rem 1rem calc(1.1rem + env(safe-area-inset-bottom, 0px));
    }

    #form_wrap h1 {
        font-size: 1.35rem;
    }

    .password-rules {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 860px) and (max-height: 620px) {
    body.rs-app-login #logo_wrap {
        display: none;
    }

    body.rs-app-login #form_wrap {
        min-height: var(--app-vh, 100dvh);
        padding-top: 1rem;
    }
}

body.rs-app-login.rs-login-compact #logo_wrap {
    display: none;
}

body.rs-app-login.rs-login-compact #form_wrap {
    min-height: var(--app-vh, 100dvh);
    padding-top: 1rem;
}
