/* 登录页 — 本地样式，无外链字体/CDN */

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    background-color: #1a1628;
}

body.login-page {
    margin: 0;
    min-height: 100vh;
    min-height: 100dvh;
    min-height: -webkit-fill-available;
    color: #f3f4f6;
    font-family: "PingFang SC", "Microsoft YaHei", "Segoe UI", system-ui, -apple-system, sans-serif;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: max(1rem, env(safe-area-inset-top, 0px)) max(1rem, env(safe-area-inset-right, 0px)) max(1.25rem, env(safe-area-inset-bottom, 0px)) max(1rem, env(safe-area-inset-left, 0px));
    position: relative;
    overflow-x: hidden;
    background: #1a1628;
    background-image:
        radial-gradient(ellipse 120% 80% at 50% -20%, rgba(99, 102, 241, 0.42), transparent 55%),
        radial-gradient(ellipse 90% 60% at 100% 50%, rgba(147, 51, 234, 0.2), transparent 50%),
        radial-gradient(ellipse 70% 50% at 0% 80%, rgba(37, 99, 235, 0.22), transparent 45%);
}

body.login-page::before {
    content: "";
    position: fixed;
    inset: 0;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.04'/%3E%3C/svg%3E");
    pointer-events: none;
    z-index: 0;
}

.login-card {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 420px;
    min-height: min(100vh, 640px);
    min-height: min(100dvh, 640px);
    min-height: min(-webkit-fill-available, 640px);
    background: linear-gradient(165deg, rgba(36, 32, 52, 0.95) 0%, rgba(22, 20, 34, 0.98) 100%);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 2rem 1.75rem 2.25rem;
    border-radius: 1.5rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow:
        0 0 0 1px rgba(0, 0, 0, 0.4) inset,
        0 32px 64px -12px rgba(0, 0, 0, 0.65),
        0 0 80px -20px rgba(99, 102, 241, 0.25);
}

/* 手机：避免整屏纯黑块，略提亮并随内容增高，留出安全区 */
@media (max-width: 639px) {
    html {
        background-color: #252042;
    }

    body.login-page {
        align-items: flex-start;
        padding-top: max(1.25rem, env(safe-area-inset-top, 0px));
        background: #252042;
        background-image:
            radial-gradient(ellipse 140% 70% at 50% 0%, rgba(129, 140, 248, 0.35), transparent 50%),
            radial-gradient(ellipse 80% 50% at 100% 100%, rgba(167, 139, 250, 0.18), transparent 45%),
            radial-gradient(ellipse 60% 40% at 0% 100%, rgba(56, 189, 248, 0.12), transparent 40%);
    }

    .login-card {
        min-height: auto;
        margin-top: 0.5rem;
        margin-bottom: max(1rem, env(safe-area-inset-bottom, 0px));
        padding: 1.75rem 1.35rem 2rem;
        border-radius: 1.35rem;
        background: linear-gradient(165deg, rgba(45, 40, 68, 0.97) 0%, rgba(30, 27, 48, 0.99) 100%);
        border-color: rgba(255, 255, 255, 0.12);
        box-shadow:
            0 0 0 1px rgba(255, 255, 255, 0.06) inset,
            0 24px 48px -8px rgba(0, 0, 0, 0.5),
            0 0 60px -12px rgba(129, 140, 248, 0.2);
    }

    .login-header {
        margin-bottom: 1.5rem;
    }
}

@media (min-width: 640px) {
    .login-card {
        min-height: auto;
        padding: 2.5rem 2.25rem;
        border-radius: 1.75rem;
        max-height: none;
        box-shadow:
            0 0 0 1px rgba(255, 255, 255, 0.06) inset,
            0 40px 80px -16px rgba(0, 0, 0, 0.75),
            0 0 100px -24px rgba(139, 92, 246, 0.2);
    }
}

.login-header {
    text-align: center;
    margin-bottom: 2rem;
}

.login-logo {
    width: 4.5rem;
    height: 4.5rem;
    margin: 0 auto 1.25rem;
    border-radius: 1.25rem;
    background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 45%, #2563eb 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow:
        0 12px 40px rgba(79, 70, 229, 0.45),
        0 0 0 1px rgba(255, 255, 255, 0.12) inset;
    transform: rotate(10deg);
}

.login-logo svg {
    width: 2rem;
    height: 2rem;
    color: #fff;
    transform: rotate(-10deg);
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
}

.login-title {
    margin: 0;
    font-size: clamp(1.35rem, 4vw, 1.65rem);
    font-weight: 800;
    letter-spacing: 0.12em;
    background: linear-gradient(90deg, #e5e7eb 0%, #fff 40%, #c7d2fe 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    text-shadow: 0 0 40px rgba(99, 102, 241, 0.15);
}

.login-version {
    margin: 0.65rem 0 0;
    color: #6b7280;
    font-size: 0.8125rem;
    font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
    letter-spacing: 0.08em;
}

.login-build-tag {
    font-size: 0.85em;
    opacity: 0.55;
    font-weight: 600;
}

.login-tabs {
    display: flex;
    background: rgba(15, 23, 42, 0.65);
    padding: 0.35rem;
    border-radius: 999px;
    margin-bottom: 1.75rem;
    gap: 0.25rem;
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.tab-btn {
    flex: 1;
    padding: 0.65rem 0.5rem;
    border-radius: 999px;
    font-size: 0.875rem;
    font-weight: 600;
    border: none;
    background: transparent;
    color: #9ca3af;
    cursor: pointer;
    transition: background 0.25s ease, color 0.25s ease, box-shadow 0.25s ease;
}

.tab-btn.tab-active {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.35), rgba(99, 102, 241, 0.25));
    color: #e0e7ff;
    box-shadow: 0 2px 12px rgba(59, 130, 246, 0.2);
}

.tab-btn.tab-inactive:hover {
    color: #d1d5db;
}

.fields {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.field-wrap {
    position: relative;
}

.field-icon {
    position: absolute;
    left: 1.05rem;
    top: 50%;
    transform: translateY(-50%);
    color: #6b7280;
    pointer-events: none;
    display: flex;
    align-items: center;
    transition: color 0.2s;
}

.field-wrap:focus-within .field-icon {
    color: #818cf8;
}

.field-icon svg {
    width: 1.125rem;
    height: 1.125rem;
}

.field-input {
    width: 100%;
    background: rgba(17, 24, 39, 0.75);
    color: #f9fafb;
    font-size: 0.9375rem;
    padding: 1rem 1rem 1rem 3rem;
    border-radius: 1rem;
    border: 1px solid rgba(55, 65, 81, 0.8);
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}

.field-input::placeholder {
    color: #4b5563;
}

.field-input:hover {
    border-color: rgba(75, 85, 99, 0.9);
}

.field-input:focus {
    border-color: rgba(129, 140, 248, 0.55);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
    background: rgba(17, 24, 39, 0.9);
}

.role-area {
    display: none;
    gap: 0.75rem;
    padding-top: 0.35rem;
}

.role-area.visible {
    display: flex;
}

.role-label {
    position: relative;
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    background: rgba(17, 24, 39, 0.65);
    padding: 0.85rem 0.65rem;
    border-radius: 1rem;
    border: 1px solid rgba(55, 65, 81, 0.7);
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s, transform 0.15s;
}

.role-label:active {
    transform: scale(0.98);
}

.role-label svg {
    width: 1.05rem;
    height: 1.05rem;
    color: #9ca3af;
    flex-shrink: 0;
}

.role-label span {
    color: #d1d5db;
    font-size: 0.8125rem;
    font-weight: 600;
}

.role-label input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.role-label:has(input:checked) {
    border-color: rgba(129, 140, 248, 0.65);
    background: rgba(79, 70, 229, 0.12);
    box-shadow: 0 0 20px rgba(99, 102, 241, 0.12);
}

.role-label:has(input:checked) svg {
    color: #a5b4fc;
}

.agreement-row {
    display: flex;
    align-items: flex-start;
    gap: 0.65rem;
    margin-top: 1rem;
    padding: 0.65rem 0.75rem;
    border-radius: 0.85rem;
    background: rgba(17, 24, 39, 0.45);
    border: 1px solid rgba(55, 65, 81, 0.5);
    text-align: left;
}

.agreement-check-label {
    display: flex;
    flex-shrink: 0;
    padding-top: 0.1rem;
    cursor: pointer;
}

.agreement-check {
    width: 1.15rem;
    height: 1.15rem;
    margin: 0;
    flex-shrink: 0;
    accent-color: #6366f1;
    cursor: pointer;
}

.agreement-text {
    flex: 1;
    min-width: 0;
    font-size: 0.8125rem;
    line-height: 1.5;
    color: #9ca3af;
}

.agreement-text a {
    color: #a5b4fc;
    text-decoration: none;
    position: relative;
    z-index: 1;
}

.agreement-text a:hover {
    text-decoration: underline;
}

.error-msg {
    min-height: 1.5rem;
    margin-top: 0.75rem;
    text-align: center;
    color: #f87171;
    font-size: 0.8125rem;
    font-weight: 600;
    opacity: 0;
    transition: opacity 0.2s;
}

.error-msg.visible {
    opacity: 1;
}

.btn-action {
    width: 100%;
    margin-top: 1.25rem;
    padding: 1rem 1.25rem;
    border: none;
    border-radius: 1rem;
    font-size: 1.05rem;
    font-weight: 700;
    color: #fff;
    cursor: pointer;
    letter-spacing: 0.02em;
    background: linear-gradient(105deg, #4f46e5 0%, #2563eb 50%, #0ea5e9 100%);
    background-size: 200% 100%;
    box-shadow:
        0 4px 16px rgba(37, 99, 235, 0.35),
        0 0 0 1px rgba(255, 255, 255, 0.1) inset;
    transition: box-shadow 0.25s, transform 0.2s, filter 0.2s;
}

.btn-action:hover {
    box-shadow:
        0 8px 28px rgba(59, 130, 246, 0.45),
        0 0 0 1px rgba(255, 255, 255, 0.12) inset;
    transform: translateY(-2px);
    filter: brightness(1.05);
}

.btn-action:active {
    transform: translateY(0);
    filter: brightness(0.98);
}

.btn-action:disabled {
    opacity: 0.75;
    cursor: wait;
    transform: none;
}

.btn-action .btn-icon {
    display: inline-block;
    margin-left: 0.35rem;
    vertical-align: middle;
    transition: transform 0.2s;
}

.btn-action:hover:not(:disabled) .btn-icon {
    transform: translateX(3px);
}

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

.btn-action .spinner {
    display: inline-block;
    width: 1rem;
    height: 1rem;
    border: 2px solid rgba(255, 255, 255, 0.25);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.65s linear infinite;
    vertical-align: middle;
    margin-right: 0.4rem;
}
