:root {
    --blue-50: #eff6ff;
    --blue-100: #dbeafe;
    --blue-300: #93c5fd;
    --blue-500: #3b82f6;
    --blue-600: #2563eb;
    --blue-700: #1d4ed8;
    --green-500: #22c55e;
    --red-50: #fef2f2;
    --red-200: #fecaca;
    --red-600: #dc2626;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --shadow: 0 24px 60px rgba(15, 23, 42, 0.16);
    --transition: 0.2s ease;
}

* {
    box-sizing: border-box;
}

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

body.auth-login-page {
    margin: 0;
    color: var(--gray-800);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
    background:
        radial-gradient(circle at 12% 20%, rgba(37, 99, 235, 0.14), transparent 26%),
        radial-gradient(circle at 88% 12%, rgba(20, 184, 166, 0.15), transparent 24%),
        linear-gradient(135deg, #f8fafc 0%, #eef4ff 45%, #f8fbf7 100%);
}

button,
input {
    font: inherit;
}

button {
    cursor: pointer;
}

.login-shell {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 28px;
}

.login-card {
    width: min(430px, 100%);
    padding: 44px 42px 36px;
    border: 1px solid rgba(148, 163, 184, 0.24);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.94);
    box-shadow: var(--shadow);
    backdrop-filter: blur(16px);
}

.brand {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 30px;
}

.brand-icon {
    width: 52px;
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    color: #fff;
    background: linear-gradient(135deg, var(--blue-600), #14b8a6);
    box-shadow: 0 12px 24px rgba(37, 99, 235, 0.28);
}

.brand-icon svg {
    width: 27px;
    height: 27px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.7;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.brand-text h1 {
    margin: 0;
    font-size: 22px;
    line-height: 1.25;
    font-weight: 700;
    letter-spacing: 0;
}

.brand-text p {
    margin: 4px 0 0;
    color: var(--gray-500);
    font-size: 12px;
}

.headline {
    font-size: 25px;
    line-height: 1.25;
    font-weight: 700;
    margin-bottom: 8px;
}

.subhead {
    color: var(--gray-500);
    font-size: 14px;
    margin-bottom: 22px;
}

.error-msg {
    display: none;
    align-items: center;
    gap: 8px;
    min-height: 42px;
    margin-bottom: 18px;
    padding: 10px 12px;
    border: 1px solid var(--red-200);
    border-radius: 8px;
    color: var(--red-600);
    background: var(--red-50);
    font-size: 13px;
}

.error-msg.show {
    display: flex;
}

.error-msg svg {
    width: 17px;
    height: 17px;
    flex: 0 0 auto;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
}

.field {
    margin-bottom: 18px;
}

.field label {
    display: block;
    margin-bottom: 8px;
    color: var(--gray-700);
    font-size: 13px;
    font-weight: 600;
}

.input-box {
    position: relative;
}

.input-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    width: 19px;
    height: 19px;
    color: var(--gray-400);
    transform: translateY(-50%);
    pointer-events: none;
}

.input-box input,
.captcha-input {
    width: 100%;
    height: 46px;
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    outline: none;
    color: var(--gray-800);
    background: var(--gray-50);
    transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
}

.input-box input {
    padding: 0 46px 0 44px;
}

.captcha-input {
    padding: 0 14px;
}

.input-box input:focus,
.captcha-input:focus {
    border-color: var(--blue-500);
    background: #fff;
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.12);
}

.pwd-toggle {
    position: absolute;
    right: 11px;
    top: 50%;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 8px;
    color: var(--gray-400);
    background: transparent;
    transform: translateY(-50%);
    transition: color var(--transition), background var(--transition);
}

.pwd-toggle:hover {
    color: var(--blue-600);
    background: var(--blue-50);
}

.pwd-toggle svg {
    width: 17px;
    height: 17px;
}

.captcha-row {
    display: grid;
    grid-template-columns: 1fr 112px 44px;
    gap: 10px;
    align-items: center;
    margin-bottom: 18px;
}

.captcha-display,
.captcha-refresh {
    height: 46px;
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    background: #fff;
}

.captcha-display {
    padding: 0;
    overflow: hidden;
}

.captcha-display img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.captcha-refresh {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--gray-400);
    transition: color var(--transition), border-color var(--transition), background var(--transition);
}

.captcha-refresh:hover {
    color: var(--blue-600);
    border-color: var(--blue-300);
    background: var(--blue-50);
}

.captcha-refresh svg {
    width: 18px;
    height: 18px;
    transition: transform 0.3s ease;
}

.captcha-refresh:hover svg {
    transform: rotate(90deg);
}

.opts {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 22px;
}

.remember {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--gray-600);
    font-size: 13px;
    user-select: none;
}

.remember input {
    width: 15px;
    height: 15px;
    accent-color: var(--blue-600);
}

.btn-submit,
.btn-wechat {
    width: 100%;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border-radius: 8px;
    font-weight: 700;
    transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition), background var(--transition);
}

.btn-submit {
    border: 0;
    color: #fff;
    background: linear-gradient(135deg, var(--blue-600), var(--blue-700));
    box-shadow: 0 12px 24px rgba(37, 99, 235, 0.24);
}

.btn-submit:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 16px 28px rgba(37, 99, 235, 0.28);
}

.btn-submit:disabled {
    cursor: wait;
    opacity: 0.82;
}

.btn-submit svg {
    width: 19px;
    height: 19px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.spinner {
    display: none;
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.45);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

.divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 24px 0 18px;
    color: var(--gray-400);
    font-size: 12px;
}

.divider hr {
    flex: 1;
    border: 0;
    border-top: 1px solid var(--gray-200);
}

.btn-wechat {
    border: 1px solid var(--gray-200);
    color: var(--gray-700);
    background: #fff;
}

.btn-wechat:hover {
    border-color: #86efac;
    background: #f0fdf4;
}

.btn-wechat svg {
    width: 22px;
    height: 22px;
}

.qr-overlay {
    position: fixed;
    inset: 0;
    z-index: 20;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 22px;
    background: rgba(15, 23, 42, 0.46);
}

.qr-overlay.show {
    display: flex;
}

.qr-modal {
    position: relative;
    width: min(380px, 100%);
    padding: 30px 28px 28px;
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 28px 80px rgba(15, 23, 42, 0.25);
    text-align: center;
}

.qr-close {
    position: absolute;
    right: 14px;
    top: 12px;
    width: 32px;
    height: 32px;
    border: 0;
    border-radius: 8px;
    color: var(--gray-400);
    background: transparent;
    font-size: 26px;
    line-height: 1;
}

.qr-close:hover {
    color: var(--gray-700);
    background: var(--gray-100);
}

.qr-title {
    font-size: 20px;
    font-weight: 700;
}

.qr-sub {
    margin-top: 8px;
    color: var(--gray-500);
    font-size: 13px;
}

.qr-frame {
    position: relative;
    width: min(300px, 100%);
    min-height: 340px;
    margin: 24px auto 16px;
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    background: #fff;
    overflow: hidden;
}

.wechat-login-mount {
    width: 100%;
    min-height: 340px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.wechat-login-mount iframe {
    width: 300px;
    max-width: 100%;
    height: 400px;
    border: 0;
}

.wechat-login-placeholder {
    width: 100%;
    padding: 0 18px;
    color: var(--gray-500);
    font-size: 13px;
    line-height: 1.6;
}

.qr-status {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: var(--gray-700);
    font-size: 13px;
}

.qr-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--green-500);
    box-shadow: 0 0 0 6px rgba(34, 197, 94, 0.12);
}

.qr-status.is-loading .qr-dot {
    animation: qrPulse 1s ease-in-out infinite;
}

.qr-status.is-error {
    color: var(--red-600);
}

.qr-status.is-error .qr-dot {
    background: var(--red-600);
    box-shadow: 0 0 0 6px rgba(220, 38, 38, 0.12);
}

@keyframes qrPulse {
    0%,
    100% {
        transform: scale(1);
        opacity: 0.75;
    }
    50% {
        transform: scale(1.35);
        opacity: 1;
    }
}

.qr-tip {
    margin-top: 16px;
    color: var(--gray-500);
    font-size: 12px;
    line-height: 1.7;
}

@media (max-width: 520px) {
    .login-shell {
        padding: 20px;
    }

    .login-card {
        padding: 36px 28px 32px;
    }

    .captcha-row {
        grid-template-columns: 1fr 98px 42px;
        gap: 8px;
    }

    .qr-overlay {
        padding: 16px;
    }

    .qr-modal {
        padding: 28px 18px 22px;
    }

    .qr-frame,
    .wechat-login-mount {
        min-height: 320px;
    }
}
