/* WorkLog 门户 — 登录弹窗（单栏，令牌对齐 doorway-portal.css） */

html.wlmg-login-modal-open,
body.wlmg-login-modal-open {
    overflow: hidden;
    height: 100%;
}

body.wlmg-login-modal-open {
    position: fixed;
    width: 100%;
    left: 0;
    right: 0;
}

.wlmg-login-modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    visibility: hidden;
    pointer-events: none;
}

.wlmg-login-modal.is-open {
    visibility: visible;
    pointer-events: auto;
}

.wlmg-login-modal[hidden] {
    display: none !important;
}

.wlmg-login-modal:not([hidden]).is-open {
    display: flex;
}

.wlmg-login-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.42);
    backdrop-filter: blur(4px);
    opacity: 0;
    transition: opacity 0.38s cubic-bezier(0.22, 1, 0.36, 1);
}

.wlmg-login-modal.is-open .wlmg-login-modal__backdrop {
    opacity: 1;
}

.wlmg-login-modal__root {
    position: relative;
    z-index: 1;
    width: min(420px, 100%);
    max-height: min(520px, calc(100vh - 48px));
    padding: 28px 32px 24px;
    display: flex;
    flex-direction: column;
    background: var(--spa-bg-surface, #fff);
    /* 左上、右上、左下圆角；右下直角 */
    border-radius: 20px 20px 0 20px;
    box-shadow: 0 24px 48px rgba(15, 23, 42, 0.16), 0 0 0 1px rgba(226, 232, 240, 0.85);
    opacity: 0;
    transform: translateY(18px) scale(0.97);
    transition:
        opacity 0.42s cubic-bezier(0.22, 1, 0.36, 1),
        transform 0.42s cubic-bezier(0.22, 1, 0.36, 1);
    overflow-y: auto;
    overscroll-behavior: contain;
}

.wlmg-login-modal.is-open .wlmg-login-modal__root {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.wlmg-login-modal__close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: var(--spa-text-muted, #64748b);
    font-size: 1.35rem;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, color 0.15s;
}

.wlmg-login-modal__close:hover {
    background: var(--spa-nav-hover-bg, #f8fafc);
    color: var(--spa-text, #0f172a);
}

.wlmg-login-modal__tabs {
    display: flex;
    gap: 24px;
    margin-bottom: 28px;
    padding-right: 36px;
    border-bottom: 1px solid var(--spa-border-soft, #f1f5f9);
}

.wlmg-login-modal__tab {
    padding: 0 0 12px;
    margin-bottom: -1px;
    border: none;
    background: none;
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--spa-text-muted, #64748b);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: color 0.15s, border-color 0.15s;
    text-decoration: none;
}

.wlmg-login-modal__tab:hover {
    color: var(--spa-text-secondary, #475569);
}

.wlmg-login-modal__tab.is-active {
    color: var(--spa-accent, #4f46e5);
    font-weight: 600;
    border-bottom-color: var(--spa-accent, #4f46e5);
}

.wlmg-login-modal__form {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0;
}

.wlmg-login-modal__field {
    margin-bottom: 18px;
}

.wlmg-login-modal__field input {
    width: 100%;
    height: 44px;
    padding: 0 14px;
    border: 1px solid var(--spa-border, #e2e8f0);
    border-radius: 10px;
    font-family: inherit;
    font-size: 0.95rem;
    color: var(--spa-text, #0f172a);
    background: var(--spa-bg-surface, #fff);
    transition: border-color 0.15s, box-shadow 0.15s;
}

.wlmg-login-modal__field input::placeholder {
    color: #94a3b8;
}

.wlmg-login-modal__field input:focus {
    outline: none;
    border-color: #818cf8;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.wlmg-login-modal__err {
    display: block;
    margin-top: 6px;
    font-size: 0.8rem;
    color: #dc2626;
    min-height: 1.1em;
}

.wlmg-login-modal__submit {
    width: 100%;
    height: 44px;
    margin-top: 8px;
    border: none;
    border-radius: 10px;
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 600;
    color: #fff;
    cursor: pointer;
    background: var(--spa-btn-primary-bg, linear-gradient(135deg, #6366f1, #8b5cf6));
    box-shadow: var(--spa-btn-primary-shadow, 0 4px 10px rgba(99, 102, 241, 0.2));
    transition: transform 0.15s, box-shadow 0.15s, opacity 0.15s;
}

.wlmg-login-modal__submit:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: var(--spa-btn-primary-shadow-hover, 0 6px 14px rgba(99, 102, 241, 0.25));
}

.wlmg-login-modal__submit:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.wlmg-login-modal__footer {
    margin-top: auto;
    padding-top: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    font-size: 0.85rem;
    color: var(--spa-text-muted, #64748b);
}

.wlmg-login-modal__remember {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    user-select: none;
}

.wlmg-login-modal__remember input {
    width: 16px;
    height: 16px;
    accent-color: var(--spa-accent, #4f46e5);
}

.wlmg-login-modal__links a {
    color: var(--spa-accent, #4f46e5);
    text-decoration: none;
    font-weight: 500;
}

.wlmg-login-modal__links a:hover {
    text-decoration: underline;
}

.wlmg-login-modal__msg {
    min-height: 1.25em;
    margin-top: 12px;
    font-size: 0.875rem;
    text-align: center;
}

.wlmg-login-modal__msg.is-ok {
    color: #059669;
}

.wlmg-login-modal__msg.is-err {
    color: #dc2626;
}

@media (prefers-reduced-motion: reduce) {
    .wlmg-login-modal__backdrop,
    .wlmg-login-modal__root {
        transition: none;
    }
}
