/* ---------- 固定顶栏：标语 + 账号入口，左右分布，不随页面滚动 ---------- */
.topbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    min-height: 72px;
    background: #fff;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 28px;
    z-index: 100;
    box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}

.topbar-slogan {
    font-size: 1.8em;
    font-weight: 700;
    color: #1a73e8;
    white-space: nowrap;
}

/* ---------- 顶栏右侧整体：常驻导航紧挨着账号区（登录按钮/头像） ---------- */
.topbar-right {
    display: flex;
    align-items: center;
    gap: 28px;
}

/* ---------- 顶栏常驻导航：文档中心/使用反馈/消息中心/我的数据，无论登录与否都显示 ---------- */
.topbar-links {
    display: flex;
    align-items: center;
    gap: 28px;
}
.topbar-links a {
    position: relative;
    font-size: 17px;
    color: #2b2b2b;
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
}
.topbar-links a:hover { color: #1a73e8; }
.unread-badge {
    display: inline-block;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    margin-left: 4px;
    border-radius: 8px;
    background: #e53935;
    color: #fff;
    font-size: 11px;
    line-height: 16px;
    text-align: center;
    vertical-align: top;
}

/* 页面主体内容整体下移，避免被固定顶栏遮住 */
.page-content {
    padding-top: 72px;
}

/* ---------- 账号入口（现在是topbar内部的一部分，不再需要fixed定位） ---------- */
.account-corner {
    display: flex;
    align-items: center;
    gap: 14px;
}

.login-btn {
    padding: 8px 20px;
    background: #1a73e8;
    color: #fff;
    border: none;
    border-radius: 20px;
    font-size: 13px;
    cursor: pointer;
}
.login-btn:hover { background: #1765cc; }


.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, #1a73e8, #6a3ddf);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    user-select: none;
    overflow: hidden;
}
.user-avatar:hover { opacity: 0.85; }
.user-avatar img { width: 100%; height: 100%; object-fit: cover; }

/* 移动端顶栏适配：标语字号缩小，间距收紧 */
@media (max-width: 768px) {
    .topbar {
        padding: 8px 16px;
        min-height: 60px;
    }
    .topbar-slogan {
        font-size: 1.2em;
    }
    .page-content {
        padding-top: 60px;
    }
    .side-panel {
        margin-top: 60px;
        height: calc(100% - 60px);
    }
}

/* ---------- 右侧滑出面板：使用反馈 / 消息中心 ---------- */
.side-panel-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.35);
    justify-content: flex-end;
    align-items: flex-start;
    z-index: 210;
}
.side-panel-backdrop.show { display: flex; }

.side-panel {
    background: #fff;
    color: #1d1d1f;
    width: 400px;
    max-width: 92vw;
    /* 顶栏高度72px，紧贴在顶栏(账号图标)下沿展开，而不是从视口最顶端盖下来 */
    margin-top: 72px;
    height: calc(100% - 72px);
    box-shadow: -4px 4px 24px rgba(0,0,0,0.15);
    display: flex;
    flex-direction: column;
    font-family: -apple-system, "Segoe UI", "PingFang SC", sans-serif;
}

.side-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid #e5e5e7;
}
.side-panel-header h3 { margin: 0; font-size: 16px; }
.side-panel-close {
    background: none;
    border: none;
    color: #86868b;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
}
.side-panel-close:hover { color: #1d1d1f; }

.side-panel-body { padding: 20px 24px; overflow-y: auto; flex: 1; }
.side-panel-body label {
    display: block;
    font-size: 13px;
    color: #6e6e73;
    margin-bottom: 6px;
    margin-top: 16px;
}
.side-panel-body label:first-child { margin-top: 0; }
.side-panel-body input,
.side-panel-body textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #d2d2d7;
    border-radius: 8px;
    font-size: 14px;
    color: #1d1d1f;
    font-family: inherit;
    resize: vertical;
}
.side-panel-body input:focus,
.side-panel-body textarea:focus { outline: none; border-color: #0071e3; }

.feedback-char-count { text-align: right; font-size: 12px; color: #86868b; margin-top: 4px; }
.feedback-result {
    margin-top: 16px;
    padding: 12px;
    border-radius: 8px;
    font-size: 13px;
    display: none;
}
.feedback-result.show { display: block; }
.feedback-result.success { background: #e8f8ed; color: #1a7f37; }
.feedback-result.error { background: #fdecea; color: #c0341d; }

.side-panel-submit {
    width: 100%;
    margin-top: 20px;
    padding: 12px;
    background: #1a73e8;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    cursor: pointer;
}
.side-panel-submit:hover { background: #1765cc; }

/* ---------- 消息中心 ---------- */
.message-section-header { display: flex; justify-content: space-between; align-items: center; }
.message-section-title { font-size: 13px; color: #6e6e73; font-weight: 600; }
.mark-all-read-link { font-size: 13px; color: #1a73e8; text-decoration: none; }
.mark-all-read-link:hover { text-decoration: underline; }
.message-list { display: flex; flex-direction: column; gap: 10px; margin-top: 10px; }
.message-item {
    padding: 12px 14px;
    border: 1px solid #e5e5e7;
    border-radius: 8px;
}
.message-item.unread { cursor: pointer; }
.message-item.unread:hover { background: #f5f6f7; }
.message-item-title { font-size: 14px; font-weight: 600; color: #1d1d1f; }
.message-item-content { font-size: 13px; color: #6e6e73; margin-top: 4px; }
.message-item-time { font-size: 12px; color: #86868b; margin-top: 6px; }

/* ---------- 弹层 ---------- */
.account-modal-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    align-items: flex-start;
    justify-content: flex-end;
    z-index: 200;
}
.account-modal-backdrop.show { display: flex; }

.account-modal {
    background: #fff;
    color: #1d1d1f;
    width: 360px;
    max-width: 92vw;
    margin: 70px 24px 0 0;
    border-radius: 14px;
    box-shadow: 0 12px 40px rgba(0,0,0,0.25);
    overflow: hidden;
    font-family: -apple-system, "Segoe UI", "PingFang SC", sans-serif;
}

.account-modal-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px;
    border-bottom: 1px solid #eee;
    position: relative;
}
.account-modal-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: #1a73e8;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 20px;
    flex-shrink: 0;
    overflow: hidden;
}
.account-modal-avatar img { width: 100%; height: 100%; object-fit: cover; }
.account-modal-phone { font-size: 20px; font-weight: 600; }
.account-modal-sub { font-size: 12px; color: #86868b; margin-top: 2px; }
.account-modal-close {
    position: absolute;
    right: 16px;
    top: 16px;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    border-radius: 50%;
    color: #86868b;
    font-size: 20px;
    cursor: pointer;
    line-height: 1;
    transition: background-color 0.15s, color 0.15s;
}
.account-modal-close:hover { color: #1d1d1f; background-color: rgba(0,0,0,0.06); }

.account-modal-body { padding: 20px; }

.balance-block {
    background: #f5f5f7;
    border-radius: 10px;
    padding: 16px;
    margin-bottom: 20px;
}
.balance-label { font-size: 12px; color: #86868b; margin-bottom: 6px; }
.balance-value { font-size: 24px; font-weight: 600; color: #1d1d1f; }
.balance-value span { font-variant-numeric: tabular-nums; }

.account-section { margin-bottom: 16px; }
.account-section-title {
    font-size: 12px;
    color: #86868b;
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.api-key-mini-list { display: flex; flex-direction: column; gap: 8px; }
.api-key-mini-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f5f5f7;
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 12px;
}
.api-key-mini-item .key-name { color: #1d1d1f; }
.api-key-mini-item .key-prefix {
    font-family: "SF Mono", Consolas, monospace;
    color: #86868b;
    font-size: 11px;
}

.empty-hint-small {
    font-size: 12px;
    color: #86868b;
    text-align: center;
    padding: 16px 0;
}

.account-modal-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid #eee;
}
.link-btn {
    color: #0071e3;
    font-size: 13px;
    text-decoration: none;
}
.link-btn:hover { text-decoration: underline; }
.logout-btn {
    background: none;
    border: 1px solid #d2d2d7;
    color: #86868b;
    padding: 6px 14px;
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
}
.logout-btn:hover { color: #1d1d1f; border-color: #86868b; }

/* ---------- 登录弹层：完整搬运 auth 服务 static/index.html 的登录卡片样式 ---------- */
.login-modal-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    align-items: center;
    justify-content: center;
    z-index: 200;
}
.login-modal-backdrop.show { display: flex; }
.login-modal-card {
    position: relative;
    width: 100%;
    max-width: 420px;
    margin: 20px;
    background: #fff;
    border-radius: 12px;
    padding: 32px 28px 24px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.25);
    color: #1d1d1f;
    font-family: -apple-system, "Segoe UI", "PingFang SC", sans-serif;
}
.login-modal-close {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 50%;
    background: none;
    color: #86868b;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    transition: background-color 0.15s, color 0.15s;
}
.login-modal-close:hover { color: #1d1d1f; background-color: rgba(0,0,0,0.06); }
.login-title { font-size: 20px; margin-bottom: 20px; font-weight: 700; text-align: center; }
.login-subtitle { color: #86868b; font-size: 13px; margin-bottom: 24px; }

.login-tabs {
    display: flex;
    gap: 24px;
    border-bottom: 1px solid #e5e5e7;
    margin-bottom: 20px;
}
.login-tab {
    padding-bottom: 10px;
    font-size: 14px;
    color: #86868b;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    user-select: none;
}
.login-tab.active {
    color: #0071e3;
    border-bottom-color: #0071e3;
    font-weight: 600;
}
.login-panel { display: none; }
.login-panel.active { display: block; }

.login-modal-card label {
    display: block;
    font-size: 13px;
    color: #6e6e73;
    margin-bottom: 6px;
    margin-top: 16px;
}
.login-modal-card label:first-child { margin-top: 0; }
.login-modal-card input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #d2d2d7;
    border-radius: 8px;
    font-size: 15px;
    color: #1d1d1f;
    background: #fff;
}
.login-modal-card input:focus { outline: none; border-color: #0071e3; }
.login-input-row { display: flex; gap: 8px; }
.login-input-row input { flex: 1; }
.login-country-code {
    flex: 0 0 auto;
    width: 100px;
    padding: 10px 8px;
    border: 1px solid #d2d2d7;
    border-radius: 8px;
    font-size: 14px;
    background: #fff;
    color: #1d1d1f;
}
.login-country-code:focus { outline: none; border-color: #0071e3; }
.login-modal-card button {
    padding: 10px 16px;
    border: none;
    border-radius: 8px;
    background: #0071e3;
    color: #fff;
    font-size: 14px;
    cursor: pointer;
    white-space: nowrap;
}
.login-modal-card button:hover { background: #0077ed; }
.login-modal-card button:disabled {
    background: #d2d2d7;
    cursor: not-allowed;
}
.login-full-btn { width: 100%; margin-top: 20px; padding: 12px; font-size: 15px; }
.login-result {
    margin-top: 20px;
    padding: 14px;
    border-radius: 8px;
    font-size: 13px;
    font-family: "SF Mono", Consolas, monospace;
    white-space: pre-wrap;
    word-break: break-all;
    display: none;
}
.login-result.show { display: block; }
.login-result.success { background: #e8f8ed; color: #1a7f37; }
.login-result.error { background: #fdecea; color: #c0341d; }
.login-hint {
    font-size: 12px;
    color: #86868b;
    margin-top: 6px;
}
.login-agreement {
    margin-top: 16px;
    font-size: 12px;
    line-height: 1.6;
    color: #86868b;
    text-align: center;
}
.login-agreement a {
    color: #0071e3;
    text-decoration: none;
}
.login-agreement a:hover { text-decoration: underline; }

/* ---------- 用户隐私及服务协议弹层 ---------- */
.agreement-modal-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    align-items: center;
    justify-content: center;
    z-index: 300;
}
.agreement-modal-backdrop.show { display: flex; }
.agreement-modal-card {
    position: relative;
    width: 100%;
    max-width: 560px;
    max-height: 80vh;
    margin: 20px;
    background: #fff;
    border-radius: 12px;
    padding: 32px 28px 24px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.25);
    color: #1d1d1f;
    font-family: -apple-system, "Segoe UI", "PingFang SC", sans-serif;
    display: flex;
    flex-direction: column;
}
.agreement-title { font-size: 18px; margin: 0 0 16px; font-weight: 700; }
.agreement-body {
    overflow-y: auto;
    font-size: 13px;
    line-height: 1.7;
    color: #3a3a3c;
}
.agreement-body h3 { font-size: 14px; margin: 16px 0 6px; color: #1d1d1f; }
.agreement-body h3:first-child { margin-top: 0; }
.agreement-body p { margin: 0 0 8px; }

/* ========== 移动端适配 ========== */
@media (max-width: 768px) {
    .topbar {
        padding: 8px 12px;
        min-height: 56px;
        flex-wrap: wrap;
    }

    .topbar-slogan {
        font-size: 1.1em;
        white-space: normal;
        line-height: 1.3;
    }

    .topbar-right {
        gap: 12px;
    }

    .topbar-links {
        gap: 6px;
        font-size: 0.85em;
        flex-wrap: wrap;
        justify-content: flex-end;
    }

    .page-content {
        padding-top: 62px;
    }

    /* 登录弹窗：全屏适配 */
    .login-modal-card {
        width: 94%;
        max-width: 400px;
        padding: 20px 16px;
        margin: 20px auto;
        max-height: 90vh;
        overflow-y: auto;
    }

    .login-title {
        font-size: 20px;
    }

    .login-input-row {
        flex-direction: row;
        gap: 6px;
    }

    .login-country-code {
        width: 90px;
        font-size: 13px;
    }

    /* 侧栏面板：全屏覆盖 */
    .side-panel {
        width: 100%;
        max-width: 100%;
    }

    .side-panel-body {
        padding: 16px;
    }

    /* 账号弹窗：手机端居中显示 */
    .account-modal-backdrop {
        justify-content: center;
        align-items: flex-start;
    }

    .account-modal {
        width: 94%;
        max-width: 420px;
        margin: 56px auto 20px;
    }

    /* 协议弹窗 */
    .agreement-modal-card {
        width: 94%;
        margin: 20px auto;
        max-height: 85vh;
    }

    .agreement-body {
        padding: 12px;
        font-size: 13px;
    }
}