/* ================================================================
   认证：登录 / 注册 / 找回密码 / 个人资料 / 修改密码
   ================================================================ */
body.auth-locked .top-header,
body.auth-locked .app-container,
body.auth-locked .bottom-io {
    display: block !important;
}

/* ---------- 登录主界面 ---------- */
#authScreen {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 99999;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: #eef2f7;
}
#authScreen.auth-open { display: flex; }

#authScreen .auth-box {
    width: min(420px, 100%);
    background: #fff;
    border-radius: 18px;
    padding: 28px 24px 24px;
    box-shadow: 0 12px 40px rgba(30,55,80,.12);
}
#authScreen h2 {
    color: #1a2a3a;
    font-size: 1.15rem;
    margin-bottom: 8px;
    text-align: center;
}
#authScreen .auth-desc {
    color: #8899aa;
    font-size: .62rem;
    text-align: center;
    margin-bottom: 22px;
}
#authScreen label {
    display: block;
    color: #445566;
    font-size: .62rem;
    margin: 10px 0 6px;
}
#authScreen input {
    width: 100%;
    padding: 11px 13px;
    border: 1px solid #dce4ec;
    border-radius: 10px;
    outline: none;
    font-size: .72rem;
    box-sizing: border-box;
    background: #fbfcfe;
}
#authScreen input:focus { border-color: #2a7de1; background: #fff; }

.auth-actions { display: flex; gap: 10px; margin-top: 18px; }
.auth-actions .btn { flex: 1; }

#authMessage {
    min-height: 20px;
    margin-top: 12px;
    font-size: .6rem;
    line-height: 1.5;
    text-align: center;
    color: #e67e22;
}

/* ---------- 顶部用户条 ---------- */
#authUserBar {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #f5f8fc;
    border: 1px solid #e3eaf1;
    border-radius: 20px;
    padding: 4px 6px 4px 10px;
    font-size: .55rem;
    color: #556677;
    box-sizing: border-box;
    min-width: 0;
    max-width: 100%;
    flex-shrink: 1;
    white-space: nowrap;
    overflow: hidden;
}
#authUserEmail {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
#authUserBar .guest-login-btn { display: inline-flex; }
body.logged-in #authUserBar .guest-login-btn { display: none; }

/* ---------- 个人资料 ---------- */
#profilePanel {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 99990;
    background: rgba(238,242,247,.96);
    align-items: center;
    justify-content: center;
    padding: 20px;
}
#profilePanel.show { display: flex; }

.profile-box {
    width: min(430px, 100%);
    background: #fff;
    border-radius: 18px;
    padding: 22px;
    box-shadow: 0 12px 40px rgba(30,55,80,.16);
}
.profile-box h3 { font-size: .95rem; color: #1a2a3a; margin-bottom: 8px; }
.profile-desc { font-size: .6rem; color: #7b8a9a; line-height: 1.6; margin-bottom: 14px; }
.profile-input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #dce4ec;
    border-radius: 10px;
    font-size: .68rem;
    outline: none;
    background: #fbfcfe;
    box-sizing: border-box;
}
.profile-actions { display: flex; gap: 8px; margin-top: 12px; }
.profile-actions .btn { flex: 1; }

/* ---------- 修改密码 ---------- */
#passwordPanel {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 99990;
    background: rgba(238,242,247,.96);
    align-items: center;
    justify-content: center;
    padding: 20px;
}
#passwordPanel.show { display: flex; }

.password-box {
    width: min(430px, 100%);
    background: #fff;
    border-radius: 18px;
    padding: 22px;
    box-shadow: 0 12px 40px rgba(30,55,80,.16);
}
.password-box h3 { font-size: .95rem; color: #1a2a3a; margin-bottom: 8px; }
.password-desc { font-size: .6rem; color: #7b8a9a; line-height: 1.6; margin-bottom: 14px; }
.password-box label { display: block; color: #445566; font-size: .62rem; margin: 10px 0 3px; }
.password-input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #dce4ec;
    border-radius: 10px;
    font-size: .68rem;
    outline: none;
    background: #fbfcfe;
    box-sizing: border-box;
    margin-top: 5px;
}
.password-input:focus { border-color: #2a7de1; background: #fff; }
.password-actions { display: flex; gap: 8px; margin-top: 14px; }
.password-actions .btn { flex: 1; }

#passwordMsg,
.inline-msg {
    font-size: .6rem;
    line-height: 1.6;
    min-height: 20px;
    margin-top: 10px;
    color: #e67e22;
}

/* ---------- 忘记密码 / 注册面板 ---------- */
#forgotPasswordPanel .auth-box {
    width: min(420px, 100%);
    background: #fff;
    border-radius: 18px;
    padding: 28px 24px 24px;
    box-shadow: 0 12px 40px rgba(30,55,80,.16);
    box-sizing: border-box;
}

.auth-modal-box {
    width: min(460px, 94vw);
    background: #fff;
    border-radius: 20px;
    padding: 30px 28px 26px;
    box-shadow: 0 18px 55px rgba(25,55,90,.18);
    box-sizing: border-box;
}
.auth-modal-box label {
    display: block;
    color: #445566;
    font-size: .64rem;
    margin: 11px 0 6px;
}
.auth-modal-box input {
    width: 100%;
    height: 46px;
    min-height: 46px;
    padding: 0 13px;
    border: 1px solid #dce4ec;
    border-radius: 10px;
    outline: none;
    font-size: .76rem;
    box-sizing: border-box;
    background: #fbfcfe;
}
.auth-modal-box input:focus {
    border-color: #77aee8;
    box-shadow: 0 0 0 3px rgba(40,120,216,.08);
    background: #fff;
}

.otp-row { display: flex; gap: 8px; align-items: center; }
.otp-row input { flex: 1; min-width: 0; letter-spacing: .16em; }
.otp-send-btn {
    flex: 0 0 auto !important;
    width: auto !important;
    white-space: nowrap;
    font-size: .62rem !important;
    padding: 0 13px !important;
    height: 46px !important;
}

.auth-inline-msg {
    min-height: 22px;
    margin-top: 10px;
    font-size: .61rem;
    line-height: 1.55;
    text-align: center;
    color: #e67e22;
}

.auth-logo {
    font-size: 1.22rem;
    font-weight: 800;
    color: #1f6fd1;
    text-align: center;
    letter-spacing: .02em;
}
.auth-subtitle {
    color: #8a98a8;
    font-size: .62rem;
    text-align: center;
    margin: 7px 0 20px;
    line-height: 1.6;
}
.auth-form { display: block; }
.auth-main-box { box-sizing: border-box; }

.auth-secondary-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 10px;
    padding: 0 2px;
    font-size: .68rem;
}
.auth-secondary-actions a {
    color: #2878d8;
    text-decoration: none;
    cursor: pointer;
}
.auth-secondary-actions a:hover { text-decoration: underline; }

@media (max-width: 520px) {
    .auth-modal-box {
        width: calc(100vw - 24px);
        padding: 26px 20px 22px;
        border-radius: 18px;
    }
    .otp-row { gap: 6px; }
    .otp-send-btn { font-size: .56rem !important; padding: 0 9px !important; }
    .auth-logo { font-size: 1.1rem; }
    #authScreen .auth-box { padding: 24px 18px 20px; border-radius: 16px; }
    #authScreen h2 { font-size: 1rem; }
}



/* ================================================================
   未登录状态：显示"📴 离线模式"小灰字 + 蓝色"登录"按钮
   ================================================================ */
body:not(.logged-in) #authUserBar {
    background: transparent;
    border: none;
    padding: 0;
    box-shadow: none;
    gap: 10px;
}

body:not(.logged-in) #authUserEmail {
    color: #8899aa;
    font-size: 0.58rem;
    font-weight: 500;
}

body:not(.logged-in) .guest-login-btn {
    padding: 5px 16px;
    font-size: 0.65rem;
    border-radius: 20px;
    box-shadow: 0 3px 12px rgba(42, 125, 225, 0.22);
}

/* 已登录状态：保持原有胶囊灰底样式 */
body.logged-in #authUserBar {
    background: #f5f8fc;
    border: 1px solid #e3eaf1;
    padding: 4px 6px 4px 10px;
}