:root {
    --login-primary: #5F86A6;
    --login-text: #2E333A;
    --login-accent: #8FB6D8;
    --login-bg: #EDF4FA;
    --login-line: #CFE3F1;
    --login-white: #ffffff;
    --login-muted: #6b7785;
    --login-danger: #d45555;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html,
body.login-body {
    height: 100%;
}

body.login-body {
    font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", sans-serif;
    color: var(--login-text);
    background: var(--login-bg);
    -webkit-font-smoothing: antialiased;
}

.login-page {
    min-height: 100%;
    display: flex;
    flex-direction: column;
}

.login-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 24px 40px 0;
}

.login-brand-link {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: var(--login-text);
}

.login-logo {
    width: 40px;
    height: 40px;
    object-fit: contain;
    display: block;
    border-radius: 8px;
}

.login-brand-name {
    font-size: 18px;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.login-main {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 40px 24px;
    gap: 72px;
}

.login-icp {
    text-align: center;
    padding: 12px 16px 24px;
}

.login-icp a {
    font-size: 12px;
    color: var(--login-muted);
    text-decoration: none;
}

.login-icp a:hover {
    color: var(--login-primary);
}

.login-hero {
    width: 420px;
    flex-shrink: 0;
    text-align: center;
}

.login-hero img {
    width: 240px;
    height: 240px;
    object-fit: contain;
    display: block;
    margin: 0 auto 24px;
    border-radius: 24px;
}

.login-hero h1 {
    font-size: 28px;
    font-weight: 600;
    line-height: 1.4;
    margin-bottom: 8px;
}

.login-hero p {
    font-size: 15px;
    color: var(--login-muted);
    line-height: 1.7;
}

.login-card {
    width: 400px;
    min-height: 468px;
    background: var(--login-white);
    border-radius: 16px;
    box-shadow: 0 12px 40px rgba(95, 134, 166, 0.12);
    padding: 28px 32px 24px;
    position: relative;
}

.login-switch,
.login-tab,
.login-code-btn,
.login-eye,
.login-submit {
    font-family: inherit;
}

.login-switch {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 10px;
    background: var(--login-bg);
    color: var(--login-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-switch:hover {
    background: var(--login-line);
}

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

.login-panel {
    display: none;
    padding-top: 8px;
}

.login-panel.is-active {
    display: block;
}

.login-title {
    font-size: 20px;
    font-weight: 600;
    text-align: center;
    margin: 12px 0 20px;
}

.login-qr {
    min-height: 280px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

#login_container {
    width: 220px;
    height: 240px;
    overflow: hidden;
}

#login_container iframe {
    width: 100%;
    height: 100%;
    border: none;
}

.login-hint {
    margin-top: 4px;
    font-size: 13px;
    color: var(--login-muted);
    text-align: center;
}

.login-tabs {
    display: flex;
    justify-content: center;
    gap: 28px;
    margin: 8px 0 24px;
    border-bottom: 1px solid var(--login-line);
}

.login-tab {
    appearance: none;
    background: none;
    border: none;
    padding: 0 0 12px;
    font-size: 15px;
    color: var(--login-muted);
    cursor: pointer;
    position: relative;
}

.login-tab.is-active {
    color: var(--login-primary);
    font-weight: 600;
}

.login-tab.is-active::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: -1px;
    height: 2px;
    background: var(--login-primary);
    border-radius: 1px;
}

.login-form {
    display: none;
}

.login-form.is-active {
    display: block;
}

.login-field {
    display: flex;
    align-items: center;
    height: 48px;
    border: 1px solid var(--login-line);
    border-radius: 8px;
    background: var(--login-bg);
    margin-bottom: 16px;
    overflow: hidden;
}

.login-field:focus-within {
    border-color: var(--login-primary);
    background: var(--login-white);
}

.login-prefix {
    flex-shrink: 0;
    padding: 0 12px 0 14px;
    font-size: 14px;
    color: var(--login-muted);
    border-right: 1px solid var(--login-line);
    height: 100%;
    display: flex;
    align-items: center;
}

.login-field input {
    flex: 1;
    height: 100%;
    border: none;
    outline: none;
    background: transparent;
    padding: 0 12px;
    font-size: 16px;
    color: var(--login-text);
    min-width: 0;
    font-family: inherit;
}

.login-field input::placeholder {
    color: #9aa7b3;
}

.login-code-btn {
    flex-shrink: 0;
    height: 100%;
    border: none;
    background: none;
    color: var(--login-primary);
    font-size: 14px;
    padding: 0 14px;
    cursor: pointer;
    white-space: nowrap;
}

.login-code-btn:disabled {
    color: #9aa7b3;
    cursor: not-allowed;
}

.login-eye {
    flex-shrink: 0;
    width: 44px;
    height: 100%;
    border: none;
    background: none;
    color: var(--login-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-submit {
    width: 100%;
    height: 48px;
    margin-top: 8px;
    border: none;
    border-radius: 8px;
    background: var(--login-primary);
    color: var(--login-white);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
}

.login-submit:hover {
    background: #4e7391;
}

.login-submit:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.login-note {
    margin-top: 12px;
    font-size: 12px;
    color: var(--login-muted);
    text-align: center;
}

.login-foot {
    margin-top: 28px;
    font-size: 12px;
    color: var(--login-muted);
    text-align: center;
    line-height: 1.6;
}

.login-terms-link {
    color: var(--login-primary);
    text-decoration: none;
}

.login-terms-link:hover {
    text-decoration: underline;
}

.login-toast {
    position: fixed;
    top: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(-12px);
    background: rgba(46, 51, 58, 0.92);
    color: #fff;
    padding: 10px 18px;
    border-radius: 8px;
    font-size: 14px;
    opacity: 0;
    pointer-events: none;
    z-index: 1000;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.login-toast.is-show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.login-toast.is-error {
    background: var(--login-danger);
}

@media (max-width: 960px) {
    .login-hero {
        display: none;
    }

    .login-main {
        padding: 16px;
    }

    .login-top {
        padding: 16px 16px 0;
    }
}

@media (max-width: 480px) {
    .login-card {
        width: 100%;
        min-height: auto;
        padding: 24px 20px 20px;
        box-shadow: none;
    }

    .login-title {
        margin-top: 20px;
    }
}
