:root {
    --login-primary: #1769e0;
    --login-primary-dark: #0f4fbd;
    --login-text: #172033;
    --login-muted: #758095;
    --login-border: #dfe5ef;
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
    background: #eaf1fb;
}

body.h5-login-page {
    display: flex;
    min-width: 320px;
    min-height: 100vh;
    min-height: 100dvh;
    margin: 0;
    padding: max(22px, env(safe-area-inset-top, 0px)) 22px max(22px, env(safe-area-inset-bottom, 0px));
    color: var(--login-text);
    /* 保留原登录页背景图，H5 布局只负责内容适配，不再使用重色遮罩覆盖 */
    background: url("../../img/ruiku_background_04.jpg") center/cover fixed no-repeat;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
    -webkit-tap-highlight-color: transparent;
}

.login-page-shell {
    display: grid;
    grid-template-columns: minmax(0, 1.12fr) minmax(390px, .88fr);
    width: min(1120px, 100%);
    min-height: min(720px, calc(100vh - 44px));
    min-height: min(720px, calc(100dvh - 44px));
    margin: auto;
    overflow: hidden;
    border: 0;
    border-radius: 28px;
    background: #fff;
    box-shadow: 0 28px 80px rgba(2, 23, 58, .3);
    backdrop-filter: blur(13px);
}

.login-brand-panel {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-width: 0;
    padding: 54px 58px;
    overflow: hidden;
    color: #fff;
    /* 原图右半部分自带文案，只截取左侧插画，避免与新表单标题重叠 */
    background-color: #f3f7ff;
    background-image: url("../../img/login_from.png");
    background-position: -2px -2px;
    /* 原图左侧插画约占 57%，按 175% 宽度铺放，只保留插画并屏蔽右侧自带文案 */
    background-size: calc(175% + 4px) calc(100% + 4px);
    background-repeat: no-repeat;
}

.login-brand-panel::before,
.login-brand-panel::after {
    position: absolute;
    border: 1px solid rgba(255, 255, 255, .15);
    border-radius: 50%;
    content: "";
}

.login-brand-panel::before {
    right: -180px;
    bottom: -160px;
    width: 500px;
    height: 500px;
}

.login-brand-panel::after {
    right: -70px;
    bottom: -70px;
    width: 280px;
    height: 280px;
    background: rgba(255, 255, 255, .04);
}

@media (min-width: 961px) {
    .login-brand-panel::before,
    .login-brand-panel::after,
    .login-brand-panel > .login-brand-copy,
    .login-brand-panel > .login-brand-points {
        display: none;
    }
}

.login-brand-logo {
    display: block;
    width: min(220px, 64%);
    height: auto;
    margin: 0 0 27px;
    object-fit: contain;
}

.login-brand-copy {
    position: relative;
    z-index: 1;
    max-width: 520px;
    margin: auto 0;
    padding: 60px 0 40px;
}

.login-brand-copy > span,
.login-card-header > span {
    display: inline-block;
    margin-bottom: 16px;
    color: #9bc7ff;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .18em;
}

.login-brand-copy h1 {
    margin: 0;
    font-size: clamp(34px, 4vw, 54px);
    font-weight: 750;
    line-height: 1.22;
    letter-spacing: -.03em;
}

.login-brand-copy p {
    margin: 22px 0 0;
    color: rgba(255, 255, 255, .74);
    font-size: 16px;
    line-height: 1.7;
}

.login-brand-points {
    position: relative;
    z-index: 1;
    display: flex;
    flex-wrap: wrap;
    gap: 12px 24px;
}

.login-brand-points div {
    display: flex;
    align-items: center;
    gap: 7px;
    color: rgba(255, 255, 255, .8);
    font-size: 13px;
}

.login-brand-points i {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    color: #dff1ff;
    background: rgba(255, 255, 255, .13);
    font-size: 9px;
}

.login-main-panel {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 44px;
    border-radius: 28px 0 0 28px;
    background: #fff;
}

.login-card {
    width: 100%;
    max-width: 390px;
}

.login-mobile-brand {
    display: none;
}

.login-card-header {
    margin-bottom: 29px;
}

.login-card-header > span {
    margin-bottom: 10px;
    color: var(--login-primary);
}

.login-card-header h2 {
    margin: 0;
    color: var(--login-text);
    font-size: 31px;
    font-weight: 750;
    line-height: 1.3;
}

.login-card-header p {
    margin: 8px 0 0;
    color: var(--login-muted);
    font-size: 13px;
    line-height: 1.6;
}

.login-field {
    position: relative;
    margin-bottom: 18px;
}

.login-field > label {
    display: block;
    margin: 0 0 7px;
    color: #394459;
    font-size: 13px;
    font-weight: 650;
}

.login-input-wrap {
    position: relative;
    display: flex;
    align-items: flex-start;
    flex-wrap: wrap;
    width: 100%;
    min-width: 0;
}

.login-input-wrap > i {
    position: absolute;
    z-index: 2;
    left: 16px;
    top: 18px;
    color: #9aa6b7;
    font-size: 16px;
    pointer-events: none;
}

.h5-login-page .login-input-wrap .form-control {
    width: 100%;
    height: 52px;
    margin: 0;
    padding: 0 47px 0 45px;
    border: 1px solid var(--login-border);
    border-radius: 12px;
    color: var(--login-text);
    background: #f8fafc;
    background-image: none;
    box-shadow: none;
    font-size: 16px;
    line-height: 52px;
    transition: border-color .16s ease, box-shadow .16s ease, background .16s ease;
    -webkit-appearance: none;
}

.h5-login-page .login-input-wrap .form-control:focus {
    border-color: #70a6ed;
    outline: 0;
    background: #fff;
    box-shadow: 0 0 0 4px rgba(23, 105, 224, .1);
}

.h5-login-page .login-input-wrap .form-control::placeholder {
    color: #a1abb9;
}

.h5-login-page input:-webkit-autofill,
.h5-login-page input:-webkit-autofill:hover,
.h5-login-page input:-webkit-autofill:focus {
    box-shadow: 0 0 0 1000px #f8fafc inset;
    -webkit-text-fill-color: var(--login-text);
}

.password-toggle {
    position: absolute;
    z-index: 3;
    top: 6px;
    right: 7px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0;
    border: 0;
    border-radius: 9px;
    color: #8793a5;
    background: transparent;
    font-size: 16px;
    cursor: pointer;
}

.password-toggle:active {
    background: #edf2f8;
}

.login-captcha-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 128px;
    gap: 10px;
}

.captcha-refresh {
    height: 52px;
    padding: 3px;
    overflow: hidden;
    border: 1px solid var(--login-border);
    border-radius: 12px;
    background: #f8fafc;
    cursor: pointer;
}

.captcha-refresh img {
    display: block;
    width: 100%;
    height: 100%;
    border-radius: 8px;
    object-fit: fill;
}

.login-options {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 28px;
    margin: 1px 0 18px;
}

.login-options-no-captcha {
    margin-top: 4px;
}

.login-remember {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    margin: 0;
    color: #566176;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    user-select: none;
}

.login-remember input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
}

.login-checkmark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border: 1px solid #c8d0dc;
    border-radius: 6px;
    color: transparent;
    background: #fff;
    font-size: 10px;
    transition: all .15s ease;
}

.login-remember input:checked + .login-checkmark {
    border-color: var(--login-primary);
    color: #fff;
    background: var(--login-primary);
}

.login-remember input:focus-visible + .login-checkmark {
    box-shadow: 0 0 0 4px rgba(23, 105, 224, .14);
}

.login-submit-button {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 52px;
    gap: 9px;
    padding: 0 18px;
    border: 0;
    border-radius: 12px;
    color: #fff;
    background: linear-gradient(135deg, var(--login-primary-dark), #2584f2);
    box-shadow: 0 10px 22px rgba(23, 105, 224, .23);
    font-size: 15px;
    font-weight: 750;
    cursor: pointer;
    transition: transform .15s ease, box-shadow .15s ease;
}

.login-submit-button:active {
    transform: translateY(1px);
    box-shadow: 0 6px 16px rgba(23, 105, 224, .22);
}

.login-submit-button i {
    font-size: 17px;
}

.login-card-footer {
    margin-top: 28px;
    color: #9aa4b3;
    text-align: center;
    font-size: 11px;
}

.h5-login-page label.error {
    flex: 0 0 100%;
    position: static;
    display: block;
    margin: 6px 0 0;
    color: #d9363e;
    font-size: 12px;
    font-weight: 500;
    line-height: 1.4;
}

.h5-login-page label.error i {
    margin-right: 2px;
}

button:focus-visible,
input:focus-visible {
    outline: 0;
}

@media (max-width: 900px) {
    body.h5-login-page {
        padding: max(16px, env(safe-area-inset-top, 0px)) 16px max(16px, env(safe-area-inset-bottom, 0px));
    }

    .login-page-shell {
        grid-template-columns: minmax(0, 1fr) minmax(370px, .9fr);
    }

    .login-brand-panel {
        padding: 44px 36px;
    }

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

    .login-main-panel {
        padding: 36px 30px;
    }
}

/* 浏览器放大后可用宽度会下降，提前切换单栏，避免双栏被硬挤变形 */
@media (max-width: 960px) {
    body.h5-login-page {
        display: block;
        min-height: 100vh;
        min-height: 100dvh;
        padding: max(14px, env(safe-area-inset-top, 0px)) 12px max(14px, env(safe-area-inset-bottom, 0px));
        background: url("../../img/ruiku_background_04.jpg") center/cover scroll no-repeat;
        background-attachment: scroll;
    }

    .login-page-shell {
        display: block;
        width: min(560px, 100%);
        min-height: calc(100vh - 28px);
        min-height: calc(100dvh - 28px);
        overflow: visible;
        border: 0;
        border-radius: 22px;
        background: transparent;
        box-shadow: none;
        backdrop-filter: none;
    }

    .login-brand-panel {
        display: none;
    }

    .login-brand-logo {
        display: none;
    }

    .login-main-panel {
        align-items: flex-start;
        min-height: calc(100vh - 28px);
        min-height: calc(100dvh - 28px);
        padding: 18px 13px 22px;
        border-radius: 22px;
        background: rgba(255, 255, 255, .97);
        box-shadow: 0 18px 50px rgba(3, 35, 78, .2);
    }

    .login-card {
        max-width: 430px;
        margin: 0 auto;
    }

    .login-mobile-brand {
        display: flex;
        align-items: center;
        justify-content: center;
        min-height: 70px;
        margin-bottom: 15px;
        padding: 0;
        overflow: hidden;
        border-radius: 13px;
        /* H5只保留品牌Logo，不加载桌面端登录底板。 */
        background: #fff;
    }

    .login-mobile-brand img {
        display: block;
        width: min(154px, 54%);
        height: auto;
        padding: 5px 8px;
        border: 1px solid rgba(218, 228, 242, .9);
        border-radius: 10px;
        background: rgba(255, 255, 255, .94);
        box-shadow: 0 7px 18px rgba(42, 74, 118, .1);
    }

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

    .login-card-header > span {
        margin-bottom: 7px;
        font-size: 10px;
    }

    .login-card-header h2 {
        font-size: 25px;
    }

    .login-field {
        margin-bottom: 15px;
    }

    .h5-login-page .login-input-wrap .form-control,
    .captcha-refresh,
    .login-submit-button {
        height: 50px;
    }

    .h5-login-page .login-input-wrap .form-control {
        line-height: 50px;
    }

    .login-card-footer {
        margin-top: 23px;
    }
}

@media (max-width: 360px) {
    body.h5-login-page {
        padding-right: 8px;
        padding-left: 8px;
    }

    .login-main-panel {
        padding-right: 12px;
        padding-left: 12px;
    }

    .login-captcha-row {
        grid-template-columns: minmax(0, 1fr) 112px;
        gap: 8px;
    }

    .login-mobile-brand {
        min-height: 64px;
    }
}

@media (max-height: 620px) and (orientation: landscape) {
    body.h5-login-page {
        display: block;
        padding: 10px;
    }

    .login-page-shell {
        min-height: auto;
    }

    .login-brand-panel {
        padding-top: 28px;
        padding-bottom: 28px;
    }

    .login-brand-copy {
        padding: 20px 0;
    }

    .login-main-panel {
        min-height: auto;
        padding-top: 24px;
        padding-bottom: 24px;
    }

    .login-mobile-brand {
        display: none;
    }
}

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