/* ========== 77Bot AI 多页面公共样式 ==========
   顶栏 / 首页 / 模型广场 / 个人资料页
   与 style.css 配套使用（style.css 提供基础变量与控件） */

/* ---------- 可滚动页面覆盖聊天页的全屏锁定 ----------
   style.css 里 html,body 是 height:100% + overflow:hidden（聊天页需要），
   文档类页面（首页/模型广场/个人资料）必须恢复滚动。
   html.doc-html 由各页 JS 在 <html> 上加。 */
html.doc-html, body.doc-page {
    height: auto !important;
    overflow: visible !important;
    overscroll-behavior: auto;
}

/* =========================================================
   顶栏
   ========================================================= */
.topbar {
    position: sticky;
    top: 0;
    z-index: 200;
    background: rgba(15, 17, 21, 0.92);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
}
.topbar-in {
    max-width: 1200px;
    margin: 0 auto;
    height: 52px;
    padding: 0 16px;
    display: flex;
    align-items: center;
    gap: 18px;
}
.topbar-brand {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
    font-size: 16px;
    color: var(--text);
    text-decoration: none;
    white-space: nowrap;
    flex-shrink: 0;
}
.logo-dot {
    width: 10px; height: 10px;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 8px var(--accent);
    flex-shrink: 0;
}
/* 站点名（标题）右侧的模型广场入口 */
.topbar-models {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    margin-left: -6px;
    padding: 5px 10px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--bg-panel-2);
    color: var(--text-dim);
    font-size: 12.5px;
    text-decoration: none;
    white-space: nowrap;
    flex-shrink: 0;
    transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.topbar-models .ic { width: 14px; height: 14px; }
.topbar-models:hover { border-color: var(--accent); color: var(--accent); background: var(--bg-hover); }
.topbar-nav {
    display: flex;
    align-items: center;
    gap: 4px;
    flex: 1;
    min-width: 0;
}
.topbar-nav a {
    color: var(--text-dim);
    text-decoration: none;
    font-size: 14px;
    padding: 7px 12px;
    border-radius: var(--radius-sm);
    white-space: nowrap;
    transition: color 0.15s, background 0.15s;
}
.topbar-nav a:hover { color: var(--text); background: var(--bg-hover); }
.topbar-nav a.on { color: var(--accent); font-weight: 600; }

.topbar-right {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-left: auto;
    flex-shrink: 0;
}

/* 余额胶囊：点击去充值 */
.balance-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 999px;
    background: var(--accent-soft);
    color: var(--accent);
    font-size: 13px;
    text-decoration: none;
    white-space: nowrap;
    transition: background 0.15s;
}
.balance-chip:hover { background: rgba(79, 140, 255, 0.28); }
.balance-chip b { font-variant-numeric: tabular-nums; }
.balance-plus {
    width: 16px; height: 16px;
    border-radius: 50%;
    background: var(--accent);
    color: #fff;
    font-size: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

/* 头像按钮/下拉统一样式已统一收进 css/avatar.css（tb-* 系列） */

.tb-login-btn {
    padding: 7px 18px;
    border-radius: var(--radius-sm);
    background: var(--accent);
    color: #fff !important;
    font-size: 13px;
    text-decoration: none;
    white-space: nowrap;
}
.tb-login-btn:hover { background: var(--accent-hover); }

/* 汉堡按钮：站点名左侧，控制侧边栏 */
.tb-burger {
    display: inline-flex;
    flex-shrink: 0;
    width: 34px; height: 34px;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    color: var(--text-dim);
    background: transparent;
    border: none;
    cursor: pointer;
}
body:not(.has-sidebar) .tb-burger { display: none; }
.tb-burger:hover { background: var(--bg-hover); color: var(--text); }

/* SPA 外壳：顶栏固定，内容区独立滚动（与后台一致） */
body.spa-shell {
    height: 100dvh !important;
    overflow: hidden !important;
    display: flex;
    flex-direction: column;
}
body.spa-shell #site-topbar { position: relative; top: auto; z-index: 200; flex: 0 0 auto; }
body.spa-shell #spa-view { flex: 1 1 auto; min-height: 0; overflow-y: auto; overflow-x: hidden; }
body.spa-shell .sidebar-mask { inset: 0; }

/* SPA 内容区下拉刷新提示 */
#spa-ptr {
    position: fixed;
    top: 58px;
    left: 50%;
    transform: translate(-50%, -44px);
    background: var(--bg-panel);
    color: var(--text-dim);
    border: 1px solid var(--border);
    padding: 6px 14px;
    border-radius: 999px;
    font-size: 12px;
    z-index: 300;
    opacity: 0;
    pointer-events: none;
    transition: opacity .15s ease, transform .15s ease;
}
#spa-ptr.on { opacity: 1; transform: translate(-50%, 0); }

/* =========================================================
   侧边栏（工作中心/用量/工单/密钥/资料/充值等页）
   电脑端常驻可收起；手机端抽屉
   ========================================================= */.sidebar {
    position: fixed;
    top: 52px;
    left: 0;
    bottom: 0;
    width: 220px;
    z-index: 190;
    background: var(--bg-panel);
    border-right: 1px solid var(--border);
    overflow-y: auto;
    transform: translateX(0);
    transition: transform .22s ease;
}
.sidebar-nav { padding: 4px 10px 24px; }
.sidebar-group-title {
    padding: 12px 10px 6px;
    font-size: 11px;
    color: var(--text-faint);
    letter-spacing: .5px;
}
/* 分组（可折叠，与后台一致） */
.sidebar .nav-group { margin-bottom: 2px; }
.sidebar .nav-group-title {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 10px;
    border-radius: var(--radius-sm);
    color: var(--text-dim);
    font-size: 14px;
    cursor: pointer;
    user-select: none;
    transition: background .15s, color .15s;
}
.sidebar .nav-group-title:hover { background: var(--bg-hover); color: var(--text); }
.sidebar .nav-group-title .nav-arrow {
    margin-left: auto;
    font-size: 16px;
    line-height: 1;
    color: var(--text-faint);
    transition: transform .18s;
}
.sidebar .nav-group.expanded > .nav-group-title .nav-arrow { transform: rotate(90deg); }
.sidebar .nav-sub { display: none; padding-left: 8px; }
.sidebar .nav-group.expanded > .nav-sub { display: block; }
.sidebar .nav-sub .sidebar-item { padding-left: 14px; }
.sidebar-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 10px;
    margin-bottom: 2px;
    border-radius: var(--radius-sm);
    color: var(--text-dim);
    text-decoration: none;
    font-size: 14px;
    white-space: nowrap;
    transition: background .15s, color .15s;
}
.sidebar-item:hover { background: var(--bg-hover); color: var(--text); }
.sidebar-item.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.sidebar-ic { display: inline-flex; width: 18px; height: 18px; flex-shrink: 0; }
.sidebar-ic svg, .sidebar-ic img { width: 18px; height: 18px; }

/* 内容区让出侧边栏宽度（仅电脑端且展开时）；顶栏保持整宽，避免左上角缺角 */
@media (min-width: 901px) {
    body.has-sidebar.sidebar-open .page-wrap { margin-left: 220px; }
    body.has-sidebar:not(.sidebar-open) .sidebar { transform: translateX(-100%); }
}

/* 手机端：抽屉 + 遮罩 */
.sidebar-mask {
    position: fixed; inset: 52px 0 0 0;
    z-index: 189;
    background: rgba(0,0,0,.42);
    opacity: 0; transition: opacity .2s;
}
.sidebar-mask.on { opacity: 1; }
@media (max-width: 900px) {
    .sidebar { top: 52px; transform: translateX(-100%); box-shadow: 6px 0 24px rgba(0,0,0,.18); }
    body.sidebar-drawer .sidebar { transform: translateX(0); }
    body.sidebar-drawer .sidebar-mask { opacity: 1; }
    body.has-sidebar .topbar-in { padding-left: 16px; }
    body.has-sidebar .page-wrap { padding-left: 12px; }
}

/* =========================================================
   对话页接入顶栏：顶栏 + 主体纵向排布
   ========================================================= */
body.chat-page {
    display: flex;
    flex-direction: column;
    /* --app-h 由 app.js 的 initViewportHeight 跟随 visualViewport 实时更新，
       软键盘弹起时整个页面（顶栏+主体）一起收缩，输入框不被遮挡 */
    height: var(--app-h, 100dvh);
}
body.chat-page #app-view {
    flex: 1;
    min-height: 0;
    height: auto;
}
/* 登录态之前不显示顶栏（登录页自带布局） */
body.chat-page:not(.is-logged) #site-topbar { display: none; }
/* 移动端对话页用自己的 #mobile-bar，隐藏公共顶栏 */
@media (max-width: 900px) {
    body.chat-page #site-topbar { display: none; }
}

/* =========================================================
   Toast（公共）
   ========================================================= */
#site-toast-wrap {
    position: fixed;
    top: 64px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9000;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    pointer-events: none;
}
.site-toast {
    padding: 10px 20px;
    border-radius: var(--radius);
    background: var(--bg-panel-2);
    border: 1px solid var(--border);
    color: var(--text);
    font-size: 13px;
    box-shadow: var(--shadow);
    animation: siteToastIn 0.25s ease;
    max-width: 86vw;
}
.site-toast.success { border-color: rgba(62, 207, 142, 0.5); }
.site-toast.error { border-color: rgba(255, 92, 92, 0.55); }
.site-toast.out { opacity: 0; transform: translateY(-8px); transition: 0.3s; }
@keyframes siteToastIn { from { opacity: 0; transform: translateY(-10px); } }

/* =========================================================
   页面公共组件：卡片 / 按钮 / 表格 / 徽章
   ========================================================= */
.page-wrap {
    max-width: 1140px;
    margin: 0 auto;
    padding: 28px 16px 80px;
}
.page-head { margin-bottom: 24px; }
.page-head h1 { font-size: 26px; margin-bottom: 6px; }
.page-head p { color: var(--text-dim); font-size: 14px; margin: 0; }

.pg-card {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 12px;
    margin-bottom: 18px;
    overflow: hidden;
}
.pg-card-head {
    display: flex;
    align-items: baseline;
    gap: 10px;
    flex-wrap: wrap;
    padding: 14px 18px;
    border-bottom: 1px solid var(--border);
    font-weight: 600;
    font-size: 15px;
}
.pg-card-head .hint {
    font-weight: 400;
    font-size: 12px;
    color: var(--text-faint);
    margin: 0;
}
.pg-card-head .head-right { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.pg-card-body { padding: 18px; }

.pg-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    text-decoration: none;
    border: 1px solid transparent;
    transition: background 0.15s, opacity 0.15s;
    white-space: nowrap;
}
.pg-btn svg { width: 15px; height: 15px; }
.pg-btn-primary { background: var(--accent); color: #fff; }
.pg-btn-primary:hover { background: var(--accent-hover); }
.pg-btn-ghost { background: var(--bg-hover); color: var(--text); }
.pg-btn-ghost:hover { background: var(--bg-active); }
.pg-btn-danger { background: rgba(255, 92, 92, 0.14); color: var(--danger); }
.pg-btn-danger:hover { background: rgba(255, 92, 92, 0.26); }
.pg-btn-sm { padding: 5px 11px; font-size: 12px; }
.pg-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.pg-table-wrap { overflow-x: auto; }
.pg-table { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 560px; }
.pg-table th {
    text-align: left;
    padding: 10px 14px;
    color: var(--text-dim);
    font-weight: 600;
    background: var(--bg-panel-2);
    white-space: nowrap;
    border-bottom: 1px solid var(--border);
}
.pg-table td {
    padding: 11px 14px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}
.pg-table tr:last-child td { border-bottom: none; }
.pg-table .nowrap { white-space: nowrap; }
/* API 密钥 / SK 卡密 列表：文字单行不换行（溢出由外层横向滚动） */
#sk-table td, #key-table td, #sk-table th, #key-table th { white-space: nowrap; }

/* SK 卡密「余额使用」进度条（双色：橙=已用、绿=剩余） */
.sk-bal-bar { width: 150px; max-width: 100%; }
.sk-bal-track {
    position: relative; display: flex; height: 16px;
    border-radius: 999px; overflow: hidden; background: var(--bg-hover);
}
.sk-bal-used { background: #f59e0b; }
.sk-bal-left { background: transparent; }
.sk-bal-inbar {
    position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
    font-size: 10px; font-weight: 700; color: #fff; letter-spacing: 0.2px;
    text-shadow: 0 1px 2px rgba(0,0,0,0.45);
}
html.light .sk-bal-inbar { color: #111; text-shadow: 0 1px 1px rgba(255,255,255,0.35); }
.sk-bal-txt {
    display: flex; justify-content: space-between;
    font-size: 11px; margin-top: 3px; line-height: 1.4; white-space: nowrap;
}
.sk-bal-u { color: #f59e0b; }
.sk-bal-t { color: var(--text-dim); }

/* 无限余额卡密：用「无限」徽标 + 已用金额替代进度条 */
.sk-bal-inf { display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.sk-inf-badge {
    display: inline-block; padding: 1px 8px; border-radius: 999px;
    font-size: 11px; font-weight: 700; line-height: 1.7;
    background: rgba(62, 207, 142, 0.15); color: var(--success);
    border: 1px solid rgba(62, 207, 142, 0.35);
}
.sk-inf-used { font-size: 11px; color: var(--text-dim); }

.badge {
    display: inline-block;
    padding: 2px 9px;
    border-radius: 999px;
    font-size: 12px;
    line-height: 1.6;
}
.badge-ok { background: rgba(62, 207, 142, 0.15); color: var(--success); }
.badge-warn { background: rgba(255, 176, 32, 0.16); color: #ffb020; }
.badge-dim { background: var(--bg-hover); color: var(--text-dim); }

.empty-tip {
    padding: 26px 10px;
    text-align: center;
    color: var(--text-faint);
    font-size: 13px;
}

/* API 接入地址卡片（个人中心） */
.endpoint-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
}
.endpoint-chip {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    padding: 9px 12px;
    border-radius: 8px;
    background: var(--accent-soft);
    border: 1px solid rgba(79, 140, 255, 0.26);
    cursor: pointer;
    transition: border-color .15s, background .15s;
}
.endpoint-chip:hover { border-color: rgba(79, 140, 255, 0.5); background: rgba(79, 140, 255, 0.14); }
.endpoint-chip-ic { flex: none; width: 15px; height: 15px; color: var(--accent); display: inline-flex; }
.endpoint-chip-label {
    flex: none;
    font-size: 12px;
    font-weight: 600;
    color: var(--text);
    padding: 1px 8px;
    border-radius: 6px;
    background: var(--bg-panel-2);
    border: 1px solid var(--border);
    white-space: nowrap;
}
.endpoint-chip-ic svg { width: 100%; height: 100%; }
.endpoint-chip-text {
    flex: 1 1 auto;
    min-width: 0;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 13px;
    font-weight: 600;
    color: var(--accent);
    white-space: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
}
.endpoint-chip-text::-webkit-scrollbar { display: none; }
.endpoint-chip-cp {
    flex: none;
    font-size: 12px;
    color: var(--text-faint);
    padding: 2px 8px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--bg-panel-2);
    transition: color .15s, border-color .15s;
}
.endpoint-chip:hover .endpoint-chip-cp { color: var(--accent); border-color: rgba(79, 140, 255, 0.5); }
.endpoint-chip.copied .endpoint-chip-cp { color: var(--success); border-color: rgba(62, 207, 142, 0.5); }
.endpoint-hint {
    margin-top: 8px;
    font-size: 12px;
    color: var(--text-faint);
    line-height: 1.5;
}

@media (max-width: 640px) {
    .endpoint-chip { padding: 8px 10px; }
    .endpoint-chip-text { font-size: 12px; }
}

/* 明文结果框（密钥 / 卡密生成后只显示一次） */
.secret-result {
    margin-top: 14px;
    padding: 14px;
    border-radius: var(--radius);
    background: var(--accent-soft);
    border: 1px solid rgba(79, 140, 255, 0.35);
}
.secret-result-tip {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--accent);
    margin-bottom: 8px;
}
.secret-result-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.secret-result-row code {
    flex: 1;
    min-width: 200px;
    word-break: break-all;
    font-family: "SF Mono", Consolas, monospace;
    font-size: 13px;
    color: var(--text);
    background: var(--bg);
    padding: 8px 10px;
    border-radius: var(--radius-sm);
}

/* 分页器 */
.pg-pager {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding-top: 14px;
    flex-wrap: wrap;
}
.pg-pager .page-info { color: var(--text-dim); font-size: 13px; margin-right: 6px; }
.pg-pager .pg-num {
    min-width: 30px; height: 30px; padding: 0 8px;
    border: 1px solid var(--border); border-radius: 6px;
    background: var(--bg-panel); color: var(--text-dim);
    font-size: 13px; line-height: 1; cursor: pointer;
    transition: border-color 0.15s, color 0.15s;
}
.pg-pager .pg-num:hover { border-color: var(--accent); color: var(--text); }
.pg-pager .pg-num.on { background: var(--accent); border-color: var(--accent); color: #fff; cursor: default; }
.pg-pager .pg-dots { color: var(--text-dim); padding: 0 2px; user-select: none; }

/* =========================================================
   首页（落地页）
   ========================================================= */
.hero {
    text-align: center;
    padding: 64px 16px 40px;
    background: radial-gradient(ellipse 60% 50% at 50% 0%, rgba(79, 140, 255, 0.14) 0%, transparent 70%);
}
.hero h1 { font-size: 40px; letter-spacing: 1px; margin-bottom: 14px; }
.hero .hero-sub { color: var(--text-dim); font-size: 16px; margin-bottom: 26px; }
.hero-btns { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; margin-bottom: 22px; }
.hero .pg-btn { padding: 12px 30px; font-size: 15px; border-radius: 10px; }
.hero-notice {
    max-width: 640px;
    margin: 0 auto;
    text-align: left;
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 18px;
    font-size: 13px;
    color: var(--text-dim);
    white-space: pre-line;
    line-height: 1.8;
}

.site-stats {
    display: flex;
    justify-content: center;
    gap: 0;
    flex-wrap: wrap;
    padding: 8px 16px 30px;
}
.stat-item { text-align: center; padding: 10px 42px; }
.stat-item .stat-v { font-size: 30px; font-weight: 700; color: var(--accent); }
.stat-item .stat-k { color: var(--text-dim); font-size: 13px; margin-top: 4px; }

.feat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 16px;
    margin-bottom: 40px;
}
.feat-card {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 22px;
    transition: border-color 0.2s, transform 0.2s;
}
.feat-card:hover { border-color: rgba(79, 140, 255, 0.5); transform: translateY(-2px); }
.feat-icon {
    width: 42px; height: 42px;
    border-radius: 10px;
    background: var(--accent-soft);
    color: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 14px;
}
.feat-icon svg { width: 22px; height: 22px; }
.feat-card h3 { font-size: 16px; margin-bottom: 8px; }
.feat-card p { color: var(--text-dim); font-size: 13px; line-height: 1.7; margin: 0; }

.dl-row { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; margin-bottom: 48px; }
.dl-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 11px 24px;
    border-radius: 10px;
    background: var(--bg-panel);
    border: 1px solid var(--border);
    color: var(--text);
    text-decoration: none;
    font-size: 14px;
    transition: border-color 0.15s, background 0.15s;
}
.dl-btn:hover { border-color: var(--accent); background: var(--bg-hover); }
.dl-btn svg { width: 17px; height: 17px; color: var(--accent); }

.site-footer {
    border-top: 1px solid var(--border);
    padding: 26px 16px 34px;
    text-align: center;
    color: var(--text-faint);
    font-size: 13px;
    line-height: 2;
}
.site-footer a { color: var(--text-dim); text-decoration: none; margin: 0 8px; }
.site-footer a:hover { color: var(--accent); }

/* =========================================================
   模型广场
   ========================================================= */
.models-toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 18px;
}
.models-search { flex: 1; min-width: 200px; max-width: 380px; }
.model-group-bar { display: flex; flex-wrap: wrap; gap: 8px; width: 100%; }
/* 模型广场筛选：模型/分组 下拉（同一行） */
.model-filter-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.mfb-lbl { font-size: 12.5px; color: var(--text-dim); }
.mfb-sel {
    height: 34px; padding: 0 10px; border: 1px solid var(--border); border-radius: 8px;
    background: var(--bg-panel); color: var(--text); font-size: 12.5px; font-family: var(--sans);
    cursor: pointer; max-width: 200px;
}
.mfb-sel:focus { outline: none; border-color: var(--text-dim); }
.mg-pill { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 14px; border: 1px solid var(--border); border-radius: 999px; font-size: 12.5px; color: var(--text); background: var(--bg-panel); cursor: pointer; transition: .15s; }
.mg-pill:hover { border-color: var(--text-dim); }
.mg-pill.on { background: var(--text); color: var(--bg-panel); border-color: var(--text); }
.mg-pill .c { font-family: var(--mono); opacity: .6; }
.models-search input {
    width: 100%;
    padding: 9px 14px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--bg-panel);
    color: var(--text);
    font-size: 14px;
    outline: none;
    transition: border-color 0.15s;
}
.models-search input:focus { border-color: var(--accent); }

.price-cell { font-variant-numeric: tabular-nums; white-space: nowrap; }
.price-num { white-space: nowrap; }
.price-zero { color: var(--text-faint); }
.price-unit { font-size: 11px; color: var(--text-faint); margin-left: 2px; white-space: nowrap; }
/* 模型广场：每行单行显示，模型名过长时省略号截断，价格列完整展示不换行 */
.models-table { table-layout: auto; }
.models-table td, .models-table th { white-space: nowrap; }
.models-table .model-display {
    font-weight: 600;
    display: inline-block;
    max-width: 320px;
    overflow: hidden;
    text-overflow: ellipsis;
    vertical-align: middle;
}
.model-display { font-weight: 600; }
.model-vision-badge {
    display: inline-block;
    margin-left: 8px;
    padding: 1px 8px;
    border-radius: 999px;
    background: var(--accent-soft);
    color: var(--accent);
    font-size: 11px;
}
.model-name-cell { display: flex; align-items: center; gap: 8px; }
.model-name-text { color: var(--text-dim); font-family: "SF Mono", Consolas, monospace; font-size: 12px; word-break: break-all; }
.model-copy-btn {
    flex-shrink: 0;
    padding: 3px 10px;
    border-radius: var(--radius-sm);
    background: var(--bg-hover);
    color: var(--text-dim);
    font-size: 12px;
    transition: background 0.15s, color 0.15s;
}
.model-copy-btn:hover { background: var(--bg-active); color: var(--text); }
.model-copy-btn.copied { background: rgba(62, 207, 142, 0.18); color: var(--success); }

/* =========================================================
   个人资料页
   ========================================================= */
/* ---------- 个人资料页签（对齐 PHP profile.php 的 tab 导航） ---------- */
.pf-tabs {
    display: flex; gap: 4px; margin-bottom: 18px;
    border-bottom: 1px solid var(--border);
}
.pf-tab {
    padding: 10px 18px; border: none; background: none; cursor: pointer;
    color: var(--text-dim); font-size: 14px; font-weight: 500;
    border-bottom: 2px solid transparent; margin-bottom: -1px;
    transition: color .15s;
}
.pf-tab:hover { color: var(--text); }
.pf-tab.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }
.pf-panel { min-width: 0; }
.pf-stack { display: flex; flex-direction: column; gap: 18px; }
/* 密钥管理页签：SK 卡密管理 + API 密钥管理横排（宽屏并排，窄屏换行） */
.pf-stack-row { display: flex; flex-direction: row; flex-wrap: wrap; gap: 18px; align-items: flex-start; }
.pf-stack-row > .pg-card { flex: 1 1 520px; min-width: 0; margin-bottom: 0; }
@media (max-width: 1120px) {
    .pf-stack-row > .pg-card { flex-basis: 100%; }
}

.profile-grid { display: grid; grid-template-columns: 340px 1fr; gap: 18px; align-items: start; }
.profile-col-main { min-width: 0; }

/* 账号卡 */
.acct-top { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; }
/* .acct-avatar 样式已统一收进 css/avatar.css */
.acct-id b { font-size: 17px; display: block; margin-bottom: 3px; }
.acct-id small { color: var(--text-faint); font-size: 12px; display: block; margin-top: 3px; }
.role-badge { margin-left: 6px; vertical-align: 1px; }

.pf-form { display: flex; flex-direction: column; gap: 12px; }
.pf-form label { font-size: 13px; color: var(--text-dim); display: block; margin-bottom: 6px; }
.pf-form input {
    width: 100%;
    padding: 9px 12px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--bg);
    color: var(--text);
    outline: none;
    font-size: 14px;
    transition: border-color 0.15s;
}
.pf-form input:focus { border-color: var(--accent); }
.pf-form .pf-row { display: flex; gap: 10px; align-items: flex-end; }
.pf-form .pf-row > div:first-child { flex: 1; }
/* .pf-avatar-preview 样式已统一收进 css/avatar.css */
.pf-divider { border: none; border-top: 1px solid var(--border); margin: 18px 0; }
.pf-sub-title { font-size: 14px; font-weight: 600; margin-bottom: 12px; }

/* 余额卡 */
.balance-big { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.balance-big .bal-v { font-size: 34px; font-weight: 700; color: var(--accent); font-variant-numeric: tabular-nums; }
.balance-big .bal-label { color: var(--text-dim); font-size: 13px; margin-bottom: 4px; }
.bal-split { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 6px; font-size: 12.5px; color: var(--text-dim); font-variant-numeric: tabular-nums; }
.bal-split-item { display: inline-flex; align-items: center; gap: 5px; }
.bal-split-item b { color: var(--text); font-weight: 600; }
.bal-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.bal-dot-wd { background: var(--accent); }
.bal-dot-gift { background: var(--text-faint, #8a8a8a); }
.pf-stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    margin-top: 16px;
}
/* 我的用量：5 张统计卡（含总缓存率），宽屏一行五列 */
.pf-stats.pf-stats-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.pf-stat {
    min-width: 0;
    background: var(--bg-panel-2);
    border-radius: var(--radius);
    padding: 12px 14px;
}
.pf-stat .v {
    font-size: 18px; font-weight: 700;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.pf-stat .k { color: var(--text-faint); font-size: 12px; margin-top: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* 可点击统计卡：点击看完整内容（小屏数值被省略时尤其有用） */
.pf-stat-click { cursor: pointer; transition: background .15s, box-shadow .15s; }
.pf-stat-click:hover { background: var(--bg-hover, var(--bg-panel-2)); box-shadow: inset 0 0 0 1px var(--border); }
.pf-stat-click:active { transform: scale(.985); }

@media (max-width: 640px) {
    .pf-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
    .pf-stats.pf-stats-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 5px; }
    .pf-stat { padding: 10px 8px; text-align: center; }
    .pf-stats.pf-stats-5 .pf-stat { padding: 8px 3px; }
    .pf-stat .v { font-size: 14px; }
    .pf-stat .k { font-size: 11px; margin-top: 4px; }
    .pf-stats.pf-stats-5 .pf-stat .v { font-size: 12px; }
    .pf-stats.pf-stats-5 .pf-stat .k { font-size: 10px; }
}
@media (max-width: 400px) {
    .pf-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .pf-stats.pf-stats-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 4px; }
    .pf-stat { padding: 9px 6px; }
    .pf-stats.pf-stats-5 .pf-stat { padding: 7px 2px; }
    .pf-stat .v { font-size: 13px; }
    .pf-stat .k { font-size: 10px; }
    .pf-stats.pf-stats-5 .pf-stat .v { font-size: 11px; }
    .pf-stats.pf-stats-5 .pf-stat .k { font-size: 9px; }
}

/* 统计卡详情弹窗（点击卡片弹出，显示完整数值） */
.stat-detail-list { display: flex; flex-direction: column; gap: 10px; }
.stat-detail-row {
    display: flex; align-items: baseline; justify-content: space-between; gap: 14px;
    padding: 10px 12px; border-radius: 8px; background: var(--bg-panel-2);
}
.stat-detail-row .kk { font-size: 13px; color: var(--text-dim); flex: none; }
.stat-detail-row .vv {
    font-size: 15px; font-weight: 700; color: var(--text);
    word-break: break-all; text-align: right;
}

/* SK 卡密 / API 密钥表格内联操作 */
.row-actions { display: flex; gap: 6px; }

/* SK 生成弹窗里的表单 */
.sk-form-grid { display: flex; flex-direction: column; gap: 13px; }
.sk-form-grid label { font-size: 13px; color: var(--text-dim); display: block; margin-bottom: 5px; }
.sk-form-grid input, .sk-form-grid select {
    width: 100%;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--bg);
    color: var(--text);
    outline: none;
    font-size: 14px;
}
.sk-form-grid input:focus { border-color: var(--accent); }
.sk-adv-toggle {
    color: var(--accent);
    font-size: 13px;
    cursor: pointer;
    user-select: none;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.sk-model-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.sk-model-tag {
    padding: 4px 11px;
    border-radius: 999px;
    background: var(--bg-hover);
    color: var(--text-dim);
    font-size: 12px;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all 0.15s;
}
.sk-model-tag.on { background: var(--accent-soft); color: var(--accent); border-color: rgba(79, 140, 255, 0.5); }
.sk-hint { font-size: 12px; color: var(--text-faint); line-height: 1.7; }

/* 余额记录行 */
.log-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
}
.log-item:last-child { border-bottom: none; }
.log-main { flex: 1; min-width: 0; }
.log-type { font-size: 13px; }
.log-note { color: var(--text-faint); font-size: 12px; margin-left: 8px; }
.log-time { color: var(--text-faint); font-size: 12px; margin-top: 2px; }
.log-amount { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.log-amount.plus { color: var(--success); }
.log-amount.minus { color: var(--danger); }

/* =========================================================
   移动端
   ========================================================= */
@media (max-width: 900px) {
    /* 窄屏顶栏空间紧张：模型广场收成图标 */
    .topbar-models { padding: 6px; border-radius: 50%; }
    .topbar-models .ic { width: 16px; height: 16px; }
    .topbar-models-text { display: none; }
    .tb-name { display: none; }
    .topbar-in { gap: 8px; }
    .balance-chip { font-size: 12px; padding: 5px 10px; }

    .hero { padding: 44px 14px 30px; }
    .hero h1 { font-size: 30px; }
    .stat-item { padding: 8px 22px; }
    .stat-item .stat-v { font-size: 24px; }

    .profile-grid { grid-template-columns: 1fr; }
    .pf-tabs { overflow-x: auto; }
    .pf-tab { padding: 9px 14px; white-space: nowrap; }
    .page-wrap { padding: 20px 12px 60px; }
    .page-head h1 { font-size: 22px; }
}

/* ---------- AFF 推介中心 ---------- */
.aff-stats { margin-bottom: 16px; }
.aff-link-box label { display: block; font-size: 12px; color: var(--text-dim, #9aa0a6); margin: 10px 0 5px; }
.aff-copy-row { display: flex; gap: 8px; }
.aff-copy-row input {
    flex: 1; padding: 8px 12px; border-radius: 6px; border: 1px solid var(--border, #2a2d33);
    background: var(--bg, #14161a); color: var(--text, #e8eaed); font-size: 13px;
}
.aff-copy-row input.mono { font-family: monospace; letter-spacing: 2px; max-width: 220px; flex: 0 0 auto; }

/* ===== 我的收藏 ===== */
.fav-list { padding: 4px 18px 18px; }
.fav-item {
    border: 1px solid var(--border, #2a2d33);
    border-radius: 10px;
    padding: 12px 14px;
    margin-top: 12px;
    background: var(--bg-card, #16181d);
}
.fav-item-head {
    display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
    margin-bottom: 8px;
}
.fav-conv-link { color: var(--primary, #4f8cff); font-size: 13px; text-decoration: none; word-break: break-all; }
.fav-conv-link:hover { text-decoration: underline; }
.fav-date { color: var(--text-faint, #6b7280); font-size: 12px; margin-left: auto; }
.fav-preview {
    color: var(--text-dim, #a6adbb);
    font-size: 13px; line-height: 1.7;
    white-space: pre-wrap; word-break: break-word;
}
.fav-full {
    color: var(--text, #e8eaed);
    font-size: 13px; line-height: 1.7;
    white-space: pre-wrap; word-break: break-word;
    margin-top: 8px;
}
.fav-preview p, .fav-full p { margin: 0; }

/* ===== 余额提现 ===== */
.wd-quota {
    display: flex; gap: 14px; flex-wrap: wrap;
    margin-bottom: 14px;
}
.wd-quota-stat {
    background: var(--bg-hover, #1b1e23);
    border-radius: 10px;
    padding: 12px 18px;
    text-align: center;
    flex: 1; min-width: 120px;
}
.wd-quota-stat .v { font-size: 20px; font-weight: 600; color: var(--success, #3ecf8e); }
.wd-quota-stat .k { font-size: 12px; color: var(--text-faint, #6b7280); margin-top: 4px; }
.wd-tip {
    background: rgba(79, 140, 255, 0.08);
    border: 1px solid rgba(79, 140, 255, 0.2);
    border-radius: 8px;
    color: var(--text-dim, #a6adbb);
    font-size: 12px; line-height: 1.7;
    padding: 10px 12px;
    margin-bottom: 16px;
}
#wd-form .wd-grid {
    display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px;
}
#wd-form label { display: block; font-size: 13px; color: var(--text-dim, #a6adbb); margin-bottom: 6px; }
#wd-form input, #wd-form select, #wd-form textarea {
    width: 100%; padding: 9px 12px;
    border-radius: 6px; border: 1px solid var(--border, #2a2d33);
    background: var(--bg, #14161a); color: var(--text, #e8eaed); font-size: 13px;
    box-sizing: border-box;
}
#wd-form textarea { resize: vertical; }
#wd-form .wd-full { grid-column: 1 / -1; }
#wd-form input[type="file"] { padding: 7px; }
.wd-qr-preview { display: flex; align-items: center; gap: 12px; margin-top: 8px; }
.wd-qr-preview img { width: 90px; height: 90px; object-fit: cover; border-radius: 8px; border: 1px solid var(--border, #2a2d33); }
.wd-actions { margin-top: 18px; }
@media (max-width: 640px) {
    #wd-form .wd-grid { grid-template-columns: 1fr; }
}

/* ===== 提现弹窗（余额卡片「提现」按钮） ===== */
.modal-wide { width: 640px; max-width: 100%; }
.balance-btns { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.wd-modal-tabs {
    display: flex; align-items: center; gap: 6px;
    border-bottom: 1px solid var(--border, #2a2d33);
    margin: -4px 0 16px; padding-bottom: 10px;
}
.wd-modal-tab {
    appearance: none; border: none; background: transparent;
    color: var(--text-faint, #6b7280); font-size: 14px;
    padding: 6px 14px; border-radius: 8px; cursor: pointer;
}
.wd-modal-tab:hover { color: var(--text, #e8eaed); }
.wd-modal-tab.active {
    color: var(--accent, #4f8cff);
    background: rgba(79, 140, 255, 0.12);
    font-weight: 600;
}
.modal-close {
    margin-left: auto; appearance: none; border: none; background: transparent;
    color: var(--text-faint, #6b7280); font-size: 22px; line-height: 1;
    cursor: pointer; padding: 2px 8px; border-radius: 6px;
}
.modal-close:hover { color: var(--text, #e8eaed); background: var(--bg-panel-2, #1b1e24); }
.wd-modal-pane .pg-table-wrap { border-radius: 8px; }

/* ===== 提示横幅（我的服务器安全说明） ===== */
.notice {
    border: 1px solid var(--border, #2a2d33);
    background: var(--bg-panel, #171a21);
    border-radius: 12px;
    padding: 14px 16px;
    margin-bottom: 16px;
    font-size: 13px;
    line-height: 1.7;
    color: var(--text-dim, #9aa4b2);
}
.notice-warn {
    border-color: rgba(245, 158, 11, 0.35);
    background: rgba(245, 158, 11, 0.06);
}
.notice-warn strong {
    color: var(--text, #e8eaed);
    display: block;
    margin-bottom: 6px;
}
.notice ul {
    margin: 0;
    padding-left: 20px;
    color: var(--text-dim, #9aa4b2);
}
.notice ul li { margin: 3px 0; }
.notice b { color: var(--text, #e8eaed); }

/* ===== 弱化文字 ===== */
.dim { color: var(--text-faint, #6b7280); }

/* ===== 工作中心：输入框 ===== */
.pg-input {
    background: var(--bg, #0f1115);
    color: var(--text, #e8eaed);
    border: 1px solid var(--border, #2a2d33);
    border-radius: 8px;
    padding: 7px 11px;
    font-size: 13px;
    outline: none;
    box-sizing: border-box;
}
.pg-input:focus { border-color: var(--accent, #4f8cff); }
.pg-input::placeholder { color: var(--text-faint, #6b7280); }

/* ===== 分页 ===== */
.pager {
    display: flex; align-items: center; gap: 6px;
    padding: 14px 4px 4px; flex-wrap: wrap;
}
.pager a {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 30px; height: 30px; padding: 0 8px;
    border-radius: 8px; background: var(--bg-hover, #1a1d24);
    color: var(--text-dim, #9aa4b2); font-size: 13px;
    text-decoration: none; cursor: pointer;
}
.pager a:hover { color: var(--text, #e8eaed); background: var(--bg-active, #242832); }
.pager a.on {
    color: #fff; background: var(--accent, #4f8cff); font-weight: 600;
}

/* ===== 工作中心：左右分栏 ===== */
.ws-split {
    display: grid; grid-template-columns: 320px 1fr;
    gap: 14px; min-height: 380px;
}
@media (max-width: 820px) { .ws-split { grid-template-columns: 1fr; } }
@media (max-width: 640px) {
    /* 顶栏工具区：整行换行，筛选/搜索自适应，按钮平分整行 */
    .pg-card-head { align-items: center; padding: 12px 14px; }
    .pg-card-head .hint { display: none; }
    .pg-card-head .head-right {
        margin-left: 0; width: 100%; flex-wrap: wrap; gap: 8px;
    }
    .pg-card-head .head-right .pg-input { flex: 1 1 140px; max-width: none !important; }
    .pg-card-head .head-right .pg-btn { flex: 1 1 auto; justify-content: center; min-height: 38px; }

    /* 单列时列表过高会淹没详情区：限制高度，点开文件后自动滚到预览 */
    .ws-split { gap: 10px; min-height: 0; }
    .ws-list { max-height: 46vh; }
    .ws-view { min-height: 0; padding: 12px; }

    /* 触控目标加大 */
    .ws-item { padding: 11px 10px; gap: 12px; }
    .ws-thumb { width: 48px; height: 48px; }
    .ws-ico { width: 48px; font-size: 24px; line-height: 48px; }
    .ws-item-name { font-size: 14px; }

    /* 编辑/预览头部按钮：整行平分，避免挤出屏幕 */
    .ws-editor-head { gap: 8px; }
    .ws-editor-head b { flex: 1 1 100%; min-width: 0; }
    .ws-editor-head .hint { flex: 1 1 100%; }
    .ws-editor-head .head-right { margin-left: 0; width: 100%; flex-wrap: wrap; gap: 8px; }
    .ws-editor-head .head-right .pg-btn { flex: 1 1 auto; justify-content: center; min-height: 38px; }
    #ws-edit-text { font-size: 12.5px; }

    /* 大图查看留边、按钮更大 */
    #wsViewer .modal { padding: 0; }
    #wsViewerImg { max-height: 70vh; }
    #wsViewerClose { width: 100%; min-height: 40px; }
}
.ws-list {
    border: 1px solid var(--border, #2a2d33);
    border-radius: 10px;
    background: var(--bg-panel, #171a21);
    overflow-y: auto;
    max-height: 560px;
    padding: 6px;
}
.ws-view {
    border: 1px solid var(--border, #2a2d33);
    border-radius: 10px;
    background: var(--bg-panel, #171a21);
    padding: 14px;
    min-height: 380px;
    box-sizing: border-box;
    overflow-x: auto;
}
.ws-item {
    display: flex; gap: 10px; align-items: center;
    padding: 9px 10px; border-radius: 8px; cursor: pointer;
    transition: background 0.12s;
}
.ws-item:hover { background: var(--bg-hover, #1a1d24); }
.ws-item.on { background: rgba(79, 140, 255, 0.12); }
.ws-item-left { flex: none; }
.ws-thumb {
    width: 42px; height: 42px; object-fit: cover;
    border-radius: 6px; border: 1px solid var(--border, #2a2d33);
    display: block;
}
.ws-ico { font-size: 22px; line-height: 42px; text-align: center; display: block; width: 42px; }
.ws-item-main { min-width: 0; flex: 1; }
.ws-item-name {
    font-size: 13px; font-weight: 600; color: var(--text, #e8eaed);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ws-item-meta { font-size: 12px; color: var(--text-faint, #6b7280); margin-top: 3px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.ws-editor-head {
    display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
    margin-bottom: 12px;
}
.ws-editor-head b { font-size: 14px; color: var(--text, #e8eaed); }
.ws-editor-head .head-right { display: flex; gap: 8px; margin-left: auto; }

/* ===== 工作中心：项目代码仓 ===== */
.ws-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border, #2a2d33); margin-bottom: 18px; }
.ws-tab {
    background: none; border: none; cursor: pointer;
    color: var(--text-faint, #6b7280); font-size: 14px;
    padding: 9px 14px; border-bottom: 2px solid transparent;
    transition: color 0.12s;
}
.ws-tab:hover { color: var(--text, #e8eaed); }
.ws-tab.on { color: var(--primary, #4f8cff); border-bottom-color: var(--primary, #4f8cff); font-weight: 600; }
.ws-tab-n {
    display: inline-block; min-width: 18px; padding: 0 5px; margin-left: 5px;
    font-size: 11px; line-height: 18px; text-align: center; border-radius: 9px;
    background: var(--bg-hover, #1a1d24); color: var(--text-faint, #6b7280);
}
.ws-tab.on .ws-tab-n { background: rgba(79, 140, 255, 0.15); color: var(--primary, #4f8cff); }

.repo-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 16px; }
@media (max-width: 860px) { .repo-stats { grid-template-columns: repeat(2, 1fr); } }
.repo-stat {
    background: var(--bg-card, #15181d); border: 1px solid var(--border, #2a2d33);
    border-radius: 10px; padding: 14px 16px;
}
.repo-stat .v { font-size: 20px; font-weight: 700; color: var(--text, #e8eaed); }
.repo-stat .k { font-size: 12px; color: var(--text-faint, #6b7280); margin-top: 3px; }

.repo-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.repo-bar .hint { font-size: 12px; color: var(--text-faint, #6b7280); }

.repo-split { display: grid; grid-template-columns: 320px 1fr; gap: 14px; min-height: 380px; }
@media (max-width: 860px) { .repo-split { grid-template-columns: 1fr; } }
.repo-list {
    background: var(--bg-card, #15181d); border: 1px solid var(--border, #2a2d33);
    border-radius: 10px; overflow-y: auto; max-height: 560px;
}
.repo-item {
    display: flex; align-items: center; gap: 8px;
    padding: 8px 12px; cursor: pointer; border-bottom: 1px solid var(--border-soft, rgba(42,45,51,0.5));
    font-size: 13px; color: var(--text, #e8eaed); transition: background 0.12s;
}
.repo-item:hover { background: var(--bg-hover, #1a1d24); }
.repo-item.on { background: rgba(79, 140, 255, 0.12); }
.repo-item .rp-path { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.repo-item .rp-size { font-size: 11px; color: var(--text-faint, #6b7280); flex: none; }
.badge { display: inline-block; font-size: 11px; line-height: 1; padding: 3px 6px; border-radius: 4px; }
.badge-edit { background: rgba(255, 170, 0, 0.15); color: #ffaa00; }
.badge-new { background: rgba(62, 207, 142, 0.15); color: #3ecf8e; }
.badge-gone { background: rgba(255, 90, 90, 0.15); color: #ff5a5a; }
.badge-dim { background: var(--bg-hover, #1a1d24); color: var(--text-faint, #6b7280); }
.badge-ok { background: rgba(62, 207, 142, 0.15); color: #3ecf8e; }

.repo-view {
    background: var(--bg-card, #15181d); border: 1px solid var(--border, #2a2d33);
    border-radius: 10px; padding: 14px; display: flex; flex-direction: column; min-width: 0;
}
.repo-view-h { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.repo-view-h b { font-size: 14px; color: var(--text, #e8eaed); word-break: break-all; }
.repo-view-h .hint { font-size: 12px; color: var(--text-faint, #6b7280); margin: 0; }
.repo-view-h .head-right { display: flex; gap: 8px; margin-left: auto; }
.repo-empty { padding: 40px 20px; text-align: center; color: var(--text-faint, #6b7280); font-size: 13px; }
.repo-versions { margin-top: 10px; border-top: 1px solid var(--border-soft, rgba(42,45,51,0.5)); padding-top: 10px; }
.repo-versions details { font-size: 12px; color: var(--text-faint, #6b7280); }
.repo-versions summary { cursor: pointer; padding: 4px 0; }
.repo-ver-item { display: flex; gap: 8px; align-items: center; padding: 3px 0; color: var(--text, #e8eaed); }
.repo-ver-item button { margin-left: auto; }

/* SK 密钥复制图标按钮：与掩码同行对齐，复制成功短暂变绿 */
.sk-copy-btn { display: inline-flex; align-items: center; justify-content: center; padding: 3px 6px; margin-left: 6px; vertical-align: middle; }
.sk-copy-btn svg { display: block; }
.sk-copy-btn.is-copied { color: #16a34a; }
.sk-copy-btn.is-copied svg { stroke: #16a34a; }

/* MODAL-FORM-DARK：弹窗内表单控件统一跟随主题（修复黑底主题下下拉框白底/文字不清） */
.modal select,
.modal input[type="text"],
.modal input[type="number"],
.modal input[type="password"],
.modal textarea {
    background: var(--bg);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm, 6px);
    padding: 8px 12px;
    font-size: 14px;
    width: 100%;
    box-sizing: border-box;
    outline: none;
}
.modal select:focus,
.modal input:focus,
.modal textarea:focus { border-color: var(--accent); }
.modal select option { background: var(--bg); color: var(--text); }

/* 通用确认弹窗（替代浏览器原生 confirm） */
.modal.pf-confirm { width: 380px; max-width: 100%; }
.pf-confirm-text {
    font-size: 13.5px;
    line-height: 1.75;
    color: var(--text-dim);
    word-break: break-word;
}
.pf-confirm-text > div + div { margin-top: 2px; }
.pf-confirm .modal-actions { margin-top: 20px; }

/* =========================================================
   我的工单（前台）
   ========================================================= */
.tk-filter { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.tk-chip {
    padding: 6px 13px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--bg-panel-2);
    color: var(--text-dim);
    font-size: 12.5px;
    cursor: pointer;
    transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.tk-chip:hover { color: var(--text); border-color: var(--accent); }
.tk-chip.active { background: var(--accent); border-color: var(--accent); color: #fff; }

.tk-table { min-width: 620px; }
.tk-td-title { font-weight: 500; max-width: 340px; }
.tk-td-reply { color: var(--text-dim); }

.tk-badge {
    display: inline-flex; align-items: center;
    padding: 2px 9px;
    border-radius: 999px;
    font-size: 12px;
    white-space: nowrap;
    border: 1px solid transparent;
}
.tk-st-pending    { background: rgba(255, 176, 32, 0.15); color: #ffb020; border-color: rgba(255, 176, 32, 0.3); }
.tk-st-processing { background: rgba(79, 140, 255, 0.15); color: var(--accent); border-color: rgba(79, 140, 255, 0.3); }
.tk-st-done       { background: rgba(52, 199, 123, 0.15); color: #34c77b; border-color: rgba(52, 199, 123, 0.3); }
.tk-st-closed     { background: var(--bg-active); color: var(--text-dim); border-color: var(--border); }

/* 详情弹窗 */
.tk-modal { width: 520px; max-width: 100%; }
.tk-modal-lg { width: 680px; }
.tk-detail-body { max-height: 52vh; overflow-y: auto; }
.tk-meta {
    display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
    padding-bottom: 12px; margin-bottom: 4px;
    border-bottom: 1px solid var(--border);
}

/* 对话区：聊天式气泡 */
.tk-chat {
    display: flex; flex-direction: column; gap: 16px;
    padding: 14px 2px 4px;
}
.tk-msg { display: flex; gap: 10px; align-items: flex-start; }
.tk-msg.is-me { flex-direction: row-reverse; }

.tk-msg-avatar { flex: none; }
.tk-msg-avatar .tk-avatar { width: 32px; height: 32px; font-size: 14px; }

.tk-msg-main { min-width: 0; max-width: 78%; display: flex; flex-direction: column; }
.tk-msg.is-me .tk-msg-main { align-items: flex-end; }

.tk-msg-meta {
    display: flex; align-items: baseline; gap: 8px;
    margin-bottom: 5px; font-size: 12px;
}
.tk-msg-meta b { font-weight: 600; font-size: 12.5px; }
.tk-msg.is-me .tk-msg-meta { flex-direction: row-reverse; }

.tk-bubble {
    padding: 10px 14px;
    border-radius: 12px;
    background: var(--bg-panel-2);
    border: 1px solid var(--border);
    font-size: 13.5px;
    line-height: 1.7;
    word-break: break-word;
    white-space: normal;
}
/* 我方：主色气泡，右下角收角；处理人：面板色，左下角收角 */
.tk-msg.is-me .tk-bubble {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
    border-bottom-right-radius: 4px;
}
.tk-msg.is-other .tk-bubble { border-bottom-left-radius: 4px; }

.tk-reply-foot {
    display: flex; gap: 10px; align-items: flex-end;
    margin-top: 14px; padding-top: 14px;
    border-top: 1px solid var(--border);
}
.tk-reply-foot textarea {
    flex: 1; min-width: 0;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 8px 10px;
    color: var(--text);
    outline: none;
    resize: vertical;
    font-family: inherit;
    font-size: 16px;
}
.tk-reply-foot textarea:focus { border-color: var(--accent); }

@media (max-width: 640px) {
    #tk-detail-body { max-height: 60vh; }
    .tk-td-title { max-width: none; }
}

.tk-hint { color: var(--text-faint); font-size: 12px; margin: 4px 0 0; }
.tk-err { color: var(--danger); }

/* =========================================================
   我的用量：时间范围筛选（原 usage.html 内联样式，SPA 化后并入）
   ========================================================= */
.usage-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.usage-time-btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 8px 14px; border-radius: 8px; cursor: pointer;
    border: 1px solid var(--border); background: var(--bg-panel);
    color: var(--text); font-size: 13px; white-space: nowrap;
}
.usage-time-btn:hover { border-color: var(--accent); }
.time-quick { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.time-quick button {
    padding: 5px 12px; border-radius: 999px; cursor: pointer;
    background: var(--bg-panel-2, var(--bg-panel)); color: var(--text);
    border: 1px solid var(--border); font-size: 12.5px;
}
.time-quick button:hover { border-color: var(--accent); color: var(--accent); }
.time-field { margin-bottom: 12px; }
.time-field label { display: block; font-size: 12px; color: var(--text-dim); margin-bottom: 5px; }
.time-field input {
    width: 100%; padding: 8px 12px; border-radius: 6px;
    border: 1px solid var(--border); background: var(--bg); color: var(--text); font-size: 13px;
}
.usage-metrics { display: flex; flex-direction: column; gap: 1px; font-size: 12.5px; line-height: 1.5; white-space: nowrap; }
.usage-metrics .m { display: flex; align-items: baseline; gap: 6px; }
.usage-metrics .mk { color: var(--text-faint); font-size: 11px; min-width: 28px; }
.usage-metrics .mv { color: var(--text); font-variant-numeric: tabular-nums; }
.usage-metrics .mv.na { color: var(--text-faint); }
.usage-speed { font-size: 12px; color: var(--text-dim); }

/* =========================================================
   模型广场 · 卡片网格 + 详情抽屉（2026-09-23）
   ========================================================= */
.model-card-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
}
@media (max-width: 1024px) { .model-card-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px)  { .model-card-grid { grid-template-columns: 1fr; gap: 12px; } }

.mc-card {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 16px 18px;
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: var(--radius-md, 12px);
    cursor: pointer;
    transition: border-color .18s, box-shadow .18s, transform .18s;
    outline: none;
}
.mc-card:hover { border-color: var(--accent); box-shadow: 0 4px 16px rgba(0,0,0,.08); }
.mc-card:focus-visible { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.mc-card.is-selected { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }

.mc-card-top { display: flex; align-items: center; gap: 10px; min-width: 0; }
.mc-avatar {
    flex-shrink: 0;
    width: 30px; height: 30px;
    border-radius: 9px;
    display: inline-flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 14px;
    color: hsl(var(--h) 72% 34%);
    background: hsl(var(--h) 72% 92%);
}
html:not(.light) .mc-avatar, html.dark .mc-avatar {
    color: hsl(var(--h) 80% 78%);
    background: hsl(var(--h) 60% 22%);
}
.mc-avatar-sm { width: 24px; height: 24px; font-size: 12px; border-radius: 7px; }
.mc-name {
    flex: 1; min-width: 0;
    font-weight: 600; font-size: 15px; color: var(--text);
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.mc-badges { display: inline-flex; gap: 6px; flex-shrink: 0; }
.mc-tag {
    padding: 1px 8px; border-radius: 999px;
    font-size: 11px; white-space: nowrap;
    background: var(--bg-hover); color: var(--text-dim);
}
.mc-tag-accent { background: var(--accent-soft); color: var(--accent); }

.mc-vendor {
    font-size: 12px; color: var(--text-faint);
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.mc-price-row {
    display: flex; align-items: baseline; gap: 12px;
    padding-top: 12px; margin-top: auto;
    border-top: 1px solid var(--border-soft, var(--border));
}
.mc-price-row.dual { flex-direction: column; gap: 8px; align-items: stretch; }
.mc-price-line { display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; }
.mc-price-line em { font-style: normal; font-size: 11px; color: var(--text-faint); min-width: 28px; }
.mc-price-item { display: inline-flex; align-items: baseline; gap: 4px; }
.mc-price-item em { font-style: normal; font-size: 11px; color: var(--text-faint); }
.mc-price-num { font-size: 14px; font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; }
.mc-price-unit { font-size: 11px; color: var(--text-faint); }
.mc-price-zero { color: var(--text-faint); }
.mc-price-sep { flex: 1; }
.mc-price-tag {
    display: inline-block; padding: 0 6px; border-radius: 5px;
    font-size: 10px; line-height: 16px; font-style: normal;
    background: var(--bg-hover); color: var(--text-faint);
}
.mc-price-tag.low { background: var(--accent-soft); color: var(--accent); }

/* ---------- 详情抽屉 ---------- */
.model-drawer-mask {
    position: fixed; inset: 0; z-index: 90;
    background: rgba(0,0,0,.42);
    opacity: 0; transition: opacity .22s;
}
.model-drawer-mask.on { opacity: 1; }
.model-drawer {
    position: fixed; top: 0; right: 0; z-index: 91;
    width: 420px; max-width: 92vw; height: 100%;
    background: var(--bg-panel);
    border-left: 1px solid var(--border);
    box-shadow: -8px 0 32px rgba(0,0,0,.14);
    display: flex; flex-direction: column;
    transform: translateX(100%);
    transition: transform .24s ease;
}
.model-drawer.on { transform: translateX(0); }
.model-drawer-head {
    display: flex; align-items: center; gap: 10px;
    padding: 18px 20px;
    border-bottom: 1px solid var(--border);
}
.model-drawer-title { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; font-size: 16px; }
.model-drawer-close {
    flex-shrink: 0; width: 30px; height: 30px;
    border: none; border-radius: 8px; cursor: pointer;
    background: var(--bg-hover); color: var(--text-dim);
    font-size: 20px; line-height: 1;
    transition: background .15s, color .15s;
}
.model-drawer-close:hover { background: var(--bg-active, var(--bg-hover)); color: var(--text); }
.model-drawer-body { flex: 1; overflow-y: auto; padding: 18px 20px 28px; }

.md-specs { display: flex; flex-direction: column; }
.md-row {
    display: flex; align-items: center; justify-content: space-between;
    gap: 12px; padding: 11px 0;
    border-bottom: 1px solid var(--border-soft, var(--border));
}
.md-label { font-size: 13px; color: var(--text-dim); flex-shrink: 0; }
.md-value {
    display: inline-flex; align-items: center; gap: 8px;
    font-size: 13px; color: var(--text);
    text-align: right; min-width: 0;
    overflow: hidden; text-overflow: ellipsis;
}
.md-value > span, .md-value > .md-per { white-space: nowrap; }
.md-empty { color: var(--text-faint); }
.md-per { font-size: 11px; color: var(--text-faint); }
.md-copy {
    flex-shrink: 0; padding: 2px 8px;
    border: none; border-radius: 6px; cursor: pointer;
    background: var(--bg-hover); color: var(--text-dim);
    font-size: 11px; transition: background .15s, color .15s;
}
.md-copy:hover { background: var(--bg-active, var(--bg-hover)); color: var(--text); }

.md-price-panel {
    margin-top: 18px; padding: 4px 16px;
    background: var(--accent-soft);
    border: 1px solid var(--accent-soft);
    border-radius: var(--radius-md, 12px);
}
.md-price-panel .md-row { border-bottom-color: rgba(127,127,127,.18); }
.md-price-panel .md-row:last-child { border-bottom: none; }
.md-price-panel .md-value { font-weight: 600; }

/* 价格对比表：高峰 / 低谷 两列 */
.md-price-panel { padding: 6px 14px; }
.md-prow {
    display: grid;
    grid-template-columns: 1fr auto auto;
    align-items: center;
    gap: 14px;
    padding: 10px 0;
    border-bottom: 1px solid rgba(127,127,127,.18);
}
.md-prow:last-child { border-bottom: none; }
.md-phead { padding: 6px 0 4px; border-bottom: 1px solid rgba(127,127,127,.18); }
.md-pcell { display: inline-flex; align-items: baseline; gap: 3px; justify-content: flex-end; white-space: nowrap; }
.md-pcell-label { justify-content: flex-start; font-size: 13px; color: var(--text-dim); }
.md-phead .md-pcell { font-size: 11px; }
.md-ptag {
    font-style: normal; font-size: 11px; padding: 0 6px; border-radius: 5px;
    background: var(--bg-hover); color: var(--text-faint); margin-right: 2px;
}
.md-ptag.low { background: rgba(127,127,127,.18); color: var(--text); }
.md-pcell .mc-price-num { font-size: 13px; font-weight: 600; }
.md-price-panel .md-pcell { font-weight: 600; }
.md-note { margin: 12px 0 0; font-size: 12px; color: var(--text-faint); }

@media (max-width: 640px) {
    .model-drawer {
        top: auto; bottom: 0; right: 0; left: 0;
        width: 100%; max-width: 100%; height: 82vh;
        border-left: none; border-top: 1px solid var(--border);
        border-radius: 18px 18px 0 0;
        transform: translateY(100%);
    }
    .model-drawer.on { transform: translateY(0); }
}

/* ===== 站内消息铃铛与抽屉 ===== */
.tb-bell {
    position: relative;
    width: 34px; height: 34px;
    display: inline-flex; align-items: center; justify-content: center;
    border: none; background: transparent; cursor: pointer;
    color: var(--text); border-radius: 50%;
    transition: background 0.15s;
}
.tb-bell:hover { background: var(--bg-hover); }
.tb-bell-dot {
    position: absolute; top: -2px; right: -2px;
    min-width: 16px; height: 16px; padding: 0 4px;
    border-radius: 999px; background: #e5484d; color: #fff;
    font-size: 10px; line-height: 16px; text-align: center;
    font-variant-numeric: tabular-nums;
    box-sizing: border-box;
}
.msg-mask {
    position: fixed; inset: 0; z-index: 900;
    background: rgba(0, 0, 0, 0.35);
}
.msg-drawer {
    position: fixed; top: 0; right: 0; z-index: 901;
    width: 380px; max-width: 92vw; height: 100%;
    background: var(--bg-panel); color: var(--text);
    border-left: 1px solid var(--border);
    box-shadow: -8px 0 32px rgba(0, 0, 0, 0.12);
    display: flex; flex-direction: column;
}
.msg-head {
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px 18px; border-bottom: 1px solid var(--border);
    font-size: 15px;
}
.msg-head-act { display: flex; align-items: center; gap: 10px; }
.msg-readall {
    border: none; background: transparent; cursor: pointer;
    color: var(--accent); font-size: 12px; padding: 4px 6px; border-radius: 6px;
}
.msg-readall:hover { background: var(--bg-hover); }
.msg-close {
    border: none; background: transparent; cursor: pointer;
    font-size: 22px; line-height: 1; color: var(--text-faint);
    width: 28px; height: 28px; border-radius: 6px;
}
.msg-close:hover { background: var(--bg-hover); color: var(--text); }
.msg-list { flex: 1; overflow-y: auto; padding: 8px 0; }
.msg-empty { padding: 40px 18px; text-align: center; color: var(--text-faint); font-size: 13px; }
.msg-item {
    padding: 12px 18px; border-bottom: 1px solid var(--border);
    cursor: pointer; transition: background 0.15s;
}
.msg-item:hover { background: var(--bg-hover); }
.msg-item.is-unread { background: rgba(79, 140, 255, 0.06); }
.msg-item.is-unread::before {
    content: ''; display: inline-block;
    width: 6px; height: 6px; border-radius: 50%;
    background: #e5484d; margin-right: 6px; vertical-align: middle;
}
.msg-item-head {
    display: flex; align-items: center; gap: 8px;
    font-size: 14px; margin-bottom: 4px;
}
.msg-item-head b { flex: 1; font-weight: 600; }
.msg-item-head time { font-size: 11px; color: var(--text-faint); font-weight: 400; }
.msg-kind {
    font-size: 11px; padding: 1px 6px; border-radius: 4px;
    background: var(--bg-hover); color: var(--text-faint); flex-shrink: 0;
}
.msg-kind-warn { background: rgba(229, 72, 77, 0.12); color: #e5484d; }
.msg-item-body { font-size: 13px; color: var(--text-faint); line-height: 1.6; padding-left: 0; }

/* 模型广场：可用率格子条 */
.uptime-gran { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; }
.uptime-gran select { padding: 4px 8px; border-radius: 8px; border: 1px solid var(--border); background: var(--bg-panel); color: var(--text); font-size: 12.5px; }
.mc-uptime { margin-top: 10px; }
.mc-uptime-head { display: flex; justify-content: space-between; align-items: center; font-size: 12px; color: var(--text-dim); margin-bottom: 5px; }
.mc-uptime-bar { display: flex; gap: 2px; align-items: stretch; }
.mc-ucell { flex: 1 1 0; min-width: 0; height: 16px; border-radius: 2px; background: var(--border-soft); display: block; }
.mc-ucell.u-100 { background: #22c55e; }   /* 100% */
.mc-ucell.u-95  { background: #84cc16; }   /* ≥95% */
.mc-ucell.u-80  { background: #eab308; }   /* ≥80% */
.mc-ucell.u-50  { background: #f59e0b; }   /* ≥50% */
.mc-ucell.u-low { background: #ef4444; }   /* >0% */
.mc-ucell.u-zero { background: #b91c1c; }  /* 全失败 */
.mc-ucell.none { background: var(--border-soft); opacity: .5; }

/* 可用率粒度：自定义下拉 */
.ug-select { position: relative; display: inline-block; }
.ug-btn { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 8px;
    border: 1px solid var(--border); background: var(--bg-panel); color: var(--text); font-size: 12.5px; cursor: pointer; }
.ug-btn:hover { border-color: var(--accent); }
.ug-arrow { font-size: 10px; color: var(--text-dim); }
.ug-menu { position: absolute; top: calc(100% + 6px); left: 0; min-width: 180px; z-index: 30;
    background: var(--bg-panel); border: 1px solid var(--border); border-radius: 10px; overflow: hidden;
    box-shadow: 0 8px 24px rgba(0,0,0,.18); }
.ug-item { padding: 9px 14px; font-size: 13px; color: var(--text-dim); cursor: pointer; }
.ug-item:hover { background: var(--bg-hover); color: var(--text); }
.ug-item.on { color: var(--accent); font-weight: 600; background: var(--accent-soft); }
