/* =========================================================
   AIAPI 中转平台 - 全局样式
   风格：专业 · 简洁 · 白色为主
   ========================================================= */

:root {
    --bg: #f5f6f8;
    --surface: #ffffff;
    --border: #e4e7ec;
    --border-strong: #d0d5dd;
    --text: #1c2430;
    --text-2: #5b6472;
    --text-3: #98a2b3;
    --accent: #2f6fed;
    --accent-dark: #1f5ad1;
    --accent-soft: #eef4ff;
    --green: #12b76a;
    --green-soft: #eafbf3;
    --red: #f04438;
    --red-soft: #fef3f2;
    --amber: #f79009;
    --amber-soft: #fff8e6;
    --gray-soft: #f2f4f7;
    --radius: 8px;
    --radius-sm: 6px;
    --shadow-sm: 0 1px 2px rgba(16, 24, 40, .05);
    --shadow: 0 1px 3px rgba(16, 24, 40, .08), 0 1px 2px rgba(16, 24, 40, .04);
    --shadow-md: 0 6px 24px rgba(16, 24, 40, .12);
    --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
            "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
    font-family: var(--font);
    font-size: 14px;
    line-height: 1.6;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-dark); }

h1, h2, h3, h4 { margin: 0; font-weight: 600; line-height: 1.35; }

/* ---------- 按钮 ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 7px 14px;
    font-size: 13.5px;
    font-weight: 500;
    font-family: inherit;
    line-height: 1.4;
    color: var(--text-2);
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    cursor: pointer;
    white-space: nowrap;
    transition: background .15s, border-color .15s, color .15s, box-shadow .15s;
    user-select: none;
}
.btn:hover { color: var(--text); border-color: #b6bcc7; background: var(--gray-soft); }
.btn:active { box-shadow: inset 0 1px 2px rgba(16,24,40,.08); }
.btn:disabled { opacity: .55; cursor: not-allowed; }

.btn-primary {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}
.btn-primary:hover { background: var(--accent-dark); border-color: var(--accent-dark); color: #fff; }

.btn-danger { color: var(--red); border-color: #f3b4ae; }
.btn-danger:hover { background: var(--red-soft); border-color: var(--red); color: var(--red); }

.btn-success { color: var(--green); border-color: #a8e6c8; }
.btn-success:hover { background: var(--green-soft); border-color: var(--green); color: var(--green); }

.btn-sm { padding: 4px 10px; font-size: 12.5px; }
.btn-lg { padding: 10px 20px; font-size: 15px; }
.btn-block { width: 100%; }

/* ---------- 表单 ---------- */
.form-group { margin-bottom: 16px; }
.form-label {
    display: block;
    margin-bottom: 6px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-2);
}
.form-control {
    width: 100%;
    padding: 8px 12px;
    font-size: 14px;
    font-family: inherit;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    outline: none;
    transition: border-color .15s, box-shadow .15s;
}
.form-control:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(47, 111, 237, .12);
}
.form-control::placeholder { color: var(--text-3); }
textarea.form-control { resize: vertical; min-height: 80px; }
select.form-control { appearance: auto; }
.form-hint { margin-top: 5px; font-size: 12px; color: var(--text-3); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 640px) { .form-row { grid-template-columns: 1fr; } }

.input-group { display: flex; }
.input-group .form-control { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.input-group .btn { border-top-left-radius: 0; border-bottom-left-radius: 0; }

/* ---------- 卡片 / 面板 ---------- */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}
.card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 20px;
    border-bottom: 1px solid var(--border);
}
.card-head h3 { font-size: 15px; }
.card-body { padding: 20px; }
.card-body-flush { padding: 0; }

/* ---------- 表格 ---------- */
.table-wrap { overflow-x: auto; }
.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13.5px;
}
.table th {
    padding: 10px 14px;
    text-align: left;
    font-size: 12.5px;
    font-weight: 500;
    color: var(--text-3);
    background: var(--gray-soft);
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
.table td {
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: #fafbfc; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table .mono { font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace; font-size: 12.5px; }
.table .actions { white-space: nowrap; text-align: right; }
.table .actions .btn { margin-left: 6px; }

/* ---------- 徽章 ---------- */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 2px 9px;
    font-size: 12px;
    font-weight: 500;
    line-height: 1.6;
    border-radius: 999px;
    white-space: nowrap;
}
.badge-gray { background: var(--gray-soft); color: var(--text-2); }
.badge-green { background: var(--green-soft); color: #0a7a4c; }
.badge-red { background: var(--red-soft); color: var(--red); }
.badge-amber { background: var(--amber-soft); color: #b54708; }
.badge-blue { background: var(--accent-soft); color: var(--accent-dark); }

/* ---------- 提示框 ---------- */
.alert {
    padding: 10px 14px;
    margin-bottom: 16px;
    font-size: 13.5px;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
}
.alert-danger { background: var(--red-soft); color: var(--red); border-color: #f8d2cf; }
.alert-success { background: var(--green-soft); color: #0a7a4c; border-color: #c3efd8; }
.alert-info { background: var(--accent-soft); color: var(--accent-dark); border-color: #d6e4ff; }

/* ---------- 分页 ---------- */
.pagination {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    border-top: 1px solid var(--border);
}
.pagination .page-btn {
    min-width: 30px;
    height: 30px;
    padding: 0 8px;
    font-size: 13px;
    color: var(--text-2);
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    cursor: pointer;
}
.pagination .page-btn:hover { color: var(--accent); border-color: var(--accent); }
.pagination .page-btn.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.pagination .page-info { margin-left: auto; font-size: 12.5px; color: var(--text-3); }

/* ---------- 统计卡片 ---------- */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}
@media (max-width: 1100px) { .stat-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 640px) { .stat-grid { grid-template-columns: 1fr; } }
.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px 20px;
    box-shadow: var(--shadow-sm);
}
.stat-card .label { font-size: 13px; color: var(--text-3); margin-bottom: 6px; }
.stat-card .value { font-size: 24px; font-weight: 600; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.stat-card .sub { margin-top: 4px; font-size: 12.5px; color: var(--text-3); }
.stat-card .value.accent { color: var(--accent); }
.stat-card .value.green { color: var(--green); }
.stat-card .value.red { color: var(--red); }

/* ---------- 布局：后台 ---------- */
.layout { display: flex; min-height: 100vh; }

.sidebar {
    width: 224px;
    flex-shrink: 0;
    background: var(--surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
}
.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 18px 20px;
    border-bottom: 1px solid var(--border);
}
.sidebar-brand .logo-mark {
    width: 32px; height: 32px;
    display: flex; align-items: center; justify-content: center;
    background: var(--accent);
    color: #fff;
    font-weight: 700;
    font-size: 15px;
    border-radius: 8px;
}
.sidebar-brand .brand-name { font-size: 15px; font-weight: 600; }
.sidebar-brand .brand-sub { font-size: 11.5px; color: var(--text-3); }

.sidebar-nav { flex: 1; padding: 12px 10px; overflow-y: auto; }
.nav-group-title { padding: 10px 12px 6px; font-size: 11.5px; font-weight: 600; color: var(--text-3); text-transform: uppercase; letter-spacing: .04em; }
.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    margin-bottom: 2px;
    font-size: 13.5px;
    color: var(--text-2);
    border-radius: var(--radius-sm);
    cursor: pointer;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    font-family: inherit;
    transition: background .15s, color .15s;
}
.nav-item:hover { background: var(--gray-soft); color: var(--text); }
.nav-item.active { background: var(--accent-soft); color: var(--accent-dark); font-weight: 500; }
.nav-item .nav-ico { width: 18px; text-align: center; opacity: .9; }

.sidebar-foot { padding: 14px 20px; border-top: 1px solid var(--border); font-size: 12px; color: var(--text-3); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 24px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 20;
}
.topbar .page-title { font-size: 16px; font-weight: 600; }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.topbar-user { display: flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--text-2); }
.avatar {
    width: 30px; height: 30px;
    display: flex; align-items: center; justify-content: center;
    background: var(--accent-soft); color: var(--accent-dark);
    font-size: 13px; font-weight: 600;
    border-radius: 50%;
}

.content { padding: 24px; flex: 1; }
.content h2.page { font-size: 18px; margin-bottom: 4px; }
.content .page-desc { color: var(--text-3); font-size: 13px; margin-bottom: 20px; }

.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.toolbar .grow { flex: 1; }
.toolbar .form-control { width: auto; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 960px) { .grid-2 { grid-template-columns: 1fr; } }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
@media (max-width: 960px) { .grid-3 { grid-template-columns: 1fr; } }

/* ---------- 图表 ---------- */
.chart-box { padding: 8px 8px 4px; }
.chart-legend { display: flex; gap: 16px; padding: 8px 16px 12px; font-size: 12.5px; color: var(--text-3); }
.chart-legend .dot { display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-right: 5px; }

/* ---------- 模态框 ---------- */
.modal-mask {
    position: fixed;
    inset: 0;
    background: rgba(16, 24, 40, .45);
    display: none;
    align-items: flex-start;
    justify-content: center;
    padding: 60px 16px;
    z-index: 100;
    overflow-y: auto;
}
.modal-mask.open { display: flex; }
.modal {
    background: var(--surface);
    border-radius: 10px;
    box-shadow: var(--shadow-md);
    width: 100%;
    max-width: 520px;
    animation: modal-in .16s ease-out;
}
.modal-lg { max-width: 720px; }
@keyframes modal-in { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }
.modal-head {
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px 20px; border-bottom: 1px solid var(--border);
}
.modal-head h3 { font-size: 16px; }
.modal-close {
    border: none; background: none; cursor: pointer;
    font-size: 20px; color: var(--text-3); line-height: 1;
}
.modal-close:hover { color: var(--text); }
.modal-body { padding: 20px; }
.modal-foot {
    display: flex; justify-content: flex-end; gap: 10px;
    padding: 14px 20px; border-top: 1px solid var(--border);
}

/* ---------- 日志上下文查看 ---------- */
.modal-xl { max-width: 880px; }
.ctx-meta {
    display: flex; flex-wrap: wrap; gap: 8px 0;
    background: var(--gray-soft);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    margin-bottom: 14px;
}
.ctx-meta-item { flex: 1 1 25%; min-width: 190px; display: flex; gap: 8px; align-items: baseline; }
.ctx-meta-label { color: var(--text-3); font-size: 12.5px; white-space: nowrap; }
.ctx-meta-value { font-size: 13px; color: var(--text); word-break: break-all; }
.ctx-toolbar { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.ctx-msg { border: 1px solid var(--border); border-radius: var(--radius-sm); margin-bottom: 10px; overflow: hidden; }
.ctx-msg-role {
    padding: 6px 12px;
    font-size: 12.5px; font-weight: 600;
    background: var(--gray-soft); color: var(--text-2);
    border-bottom: 1px solid var(--border);
}
.ctx-msg-body { padding: 10px 12px; }
.ctx-text { white-space: pre-wrap; word-break: break-word; font-size: 13.5px; }
.ctx-msg.user .ctx-msg-role { background: var(--accent-soft); color: var(--accent-dark); }
.ctx-msg.assistant .ctx-msg-role { background: var(--green-soft); color: #067647; }
.ctx-msg.tool .ctx-msg-role { background: var(--amber-soft); color: #b54708; }
.ctx-final { border-color: var(--green); box-shadow: var(--shadow-sm); }
.ctx-callout {
    background: var(--gray-soft);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 8px 10px;
    margin-top: 8px;
    font-size: 12.5px;
}
.ctx-callout pre {
    white-space: pre-wrap; word-break: break-all;
    margin: 6px 0 0; padding: 0;
    font-size: 12.5px; color: var(--text-2);
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.ctx-raw {
    white-space: pre-wrap; word-break: break-all;
    background: #fafbfc; border: 1px solid var(--border); border-radius: var(--radius-sm);
    padding: 12px; margin: 0; max-height: 480px; overflow: auto;
    font-size: 12.5px; color: var(--text-2);
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.ctx-media { color: var(--text-3); font-size: 12.5px; font-style: italic; margin: 4px 0; }
.ctx-note {
    font-size: 12.5px; color: var(--text-3);
    background: var(--gray-soft); border-radius: var(--radius-sm);
    padding: 8px 12px; margin-bottom: 10px;
}

/* ---------- Toast ---------- */
.toast-wrap { position: fixed; top: 20px; right: 20px; z-index: 200; display: flex; flex-direction: column; gap: 10px; }
.toast {
    min-width: 240px;
    max-width: 380px;
    padding: 11px 16px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-left: 3px solid var(--accent);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-md);
    font-size: 13.5px;
    animation: toast-in .2s ease-out;
}
.toast.success { border-left-color: var(--green); }
.toast.error { border-left-color: var(--red); }
.toast.warn { border-left-color: var(--amber); }
@keyframes toast-in { from { opacity: 0; transform: translateX(12px); } to { opacity: 1; transform: none; } }

/* ---------- 空状态 ---------- */
.empty {
    padding: 48px 20px;
    text-align: center;
    color: var(--text-3);
    font-size: 13.5px;
}
.empty .empty-ico { font-size: 32px; margin-bottom: 8px; opacity: .5; }

/* ---------- 登录页 ---------- */
/* 背景复刻 sensetime news-feature.glass-panel 的动态着色器背景（assets/js/auth-bg.js） */
.auth-body {
    min-height: 100vh;
    display: flex; align-items: center; justify-content: center;
    background: #f8f7ff;
    padding: 24px;
}
.auth-bg {
    position: fixed; inset: 0;
    width: 100%; height: 100%;
    display: block;
    z-index: 0;
    pointer-events: none;
}
/* 无 WebGL 时的 CSS 渐变降级（近似 Swirl + ChromaFlow 的浅紫流光） */
.auth-body.auth-bg-fallback {
    background:
        radial-gradient(ellipse 62% 48% at 22% 18%, rgba(224, 221, 247, .55) 0%, rgba(224, 221, 247, 0) 68%),
        radial-gradient(ellipse 58% 44% at 82% 26%, rgba(191, 181, 229, .4) 0%, rgba(191, 181, 229, 0) 66%),
        radial-gradient(ellipse 70% 52% at 56% 88%, rgba(214, 208, 240, .45) 0%, rgba(214, 208, 240, 0) 70%),
        linear-gradient(118deg, #faf8ff 0%, #f8f7ff 38%, #f3f0fc 72%, #f8f7ff 100%);
}
@media (prefers-reduced-motion: no-preference) {
    .auth-body.auth-bg-fallback {
        background:
            radial-gradient(ellipse 62% 48% at 22% 18%, rgba(224, 221, 247, .55) 0%, rgba(224, 221, 247, 0) 68%),
            radial-gradient(ellipse 58% 44% at 82% 26%, rgba(191, 181, 229, .4) 0%, rgba(191, 181, 229, 0) 66%),
            radial-gradient(ellipse 70% 52% at 56% 88%, rgba(214, 208, 240, .45) 0%, rgba(214, 208, 240, 0) 70%),
            linear-gradient(118deg, #faf8ff 0%, #f8f7ff 38%, #f3f0fc 72%, #f8f7ff 100%);
        background-size: 200% 200%;
        animation: auth-bg-drift 26s ease-in-out infinite alternate;
    }
    @keyframes auth-bg-drift {
        from { background-position: 0% 0%, 100% 0%, 50% 100%, 0% 0%; }
        to   { background-position: 60% 40%, 20% 60%, 20% 40%, 100% 100%; }
    }
}
.auth-wrap { width: 100%; max-width: 400px; position: relative; z-index: 1; }
/* 玻璃卡片：与 news-feature.glass-panel 同款质感 */
.auth-card {
    position: relative;
    overflow: hidden;
    background: rgba(255, 255, 255, .55);
    border: 1px solid rgba(255, 255, 255, .65);
    border-radius: 20px;
    backdrop-filter: blur(18px) saturate(1.15);
    -webkit-backdrop-filter: blur(18px) saturate(1.15);
    box-shadow: 0 10px 28px rgba(43, 52, 77, .055);
    padding: 32px;
}
.auth-card::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    pointer-events: none;
    box-shadow:
        inset 0 0.9px 1.08px rgba(255, 255, 255, .87),
        inset 0 0 2px rgba(255, 255, 255, .7),
        inset 0 4px 16px rgba(255, 255, 255, .2),
        inset 0 16px 32px rgba(255, 255, 255, .13);
}
.auth-card > * { position: relative; z-index: 1; }
.auth-logo {
    width: 44px; height: 44px;
    display: flex; align-items: center; justify-content: center;
    background: var(--accent); color: #fff;
    font-weight: 700; font-size: 18px;
    border-radius: 10px;
    margin-bottom: 18px;
}
.auth-title { font-size: 20px; margin-bottom: 6px; }
.auth-sub { color: var(--text-3); font-size: 13.5px; margin-bottom: 24px; }
.auth-foot { margin-top: 20px; text-align: center; font-size: 12.5px; color: var(--text-3); }

/* ---------- 落地页 ---------- */
.landing {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--surface);
}
.landing-head {
    position: sticky; top: 0; z-index: 20;
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 32px;
    background: rgba(255,255,255,.92);
    backdrop-filter: blur(6px);
    border-bottom: 1px solid var(--border);
}
.landing-brand { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 15.5px; }
.landing-brand .logo-mark {
    width: 30px; height: 30px;
    display: flex; align-items: center; justify-content: center;
    background: var(--accent); color: #fff; font-weight: 700; border-radius: 7px;
}
.landing-nav { display: flex; align-items: center; gap: 20px; font-size: 13.5px; color: var(--text-2); }
.landing-nav a { color: var(--text-2); }
.landing-nav a:hover { color: var(--accent); }
.landing-hero {
    text-align: center;
    padding: 96px 24px 72px;
    max-width: 860px;
    margin: 0 auto;
}
.landing-hero .eyebrow {
    display: inline-block;
    padding: 4px 12px;
    font-size: 12.5px;
    color: var(--accent-dark);
    background: var(--accent-soft);
    border-radius: 999px;
    margin-bottom: 20px;
}
.landing-hero h1 { font-size: 40px; font-weight: 700; letter-spacing: -.02em; line-height: 1.25; }
.landing-hero p { margin: 18px auto 28px; font-size: 16px; color: var(--text-2); max-width: 620px; }
.landing-cta { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.landing-section { padding: 56px 32px; border-top: 1px solid var(--border); }
.landing-section .sec-title { text-align: center; font-size: 24px; margin-bottom: 8px; }
.landing-section .sec-sub { text-align: center; color: var(--text-3); margin-bottom: 40px; }
.features {
    max-width: 1080px; margin: 0 auto;
    display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px;
}
@media (max-width: 900px) { .features { grid-template-columns: 1fr 1fr; } }
@media (max-width: 620px) { .features { grid-template-columns: 1fr; } }
.feature {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 24px;
}
.feature .feat-ico {
    width: 38px; height: 38px;
    display: flex; align-items: center; justify-content: center;
    background: var(--gray-soft);
    border-radius: 8px;
    font-size: 18px;
    margin-bottom: 14px;
}
.feature h3 { font-size: 15.5px; margin-bottom: 8px; }
.feature p { font-size: 13.5px; color: var(--text-2); margin: 0; }

.base-strip {
    max-width: 1080px; margin: 0 auto;
    background: var(--gray-soft);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 20px 24px;
    display: flex; align-items: center; justify-content: space-between; gap: 20px; flex-wrap: wrap;
}
.base-strip .bs-label { font-size: 13px; color: var(--text-3); margin-bottom: 4px; }
.base-strip code { font-size: 15px; font-weight: 600; color: var(--accent-dark); }
.landing-foot {
    margin-top: auto;
    padding: 24px 32px;
    border-top: 1px solid var(--border);
    text-align: center;
    font-size: 13px;
    color: var(--text-3);
}

/* ---------- 文档页 ---------- */
.docs { max-width: 860px; margin: 0 auto; padding: 40px 24px 80px; }
.docs h1 { font-size: 28px; margin: 8px 0 6px; }
.docs h2 { font-size: 20px; margin: 36px 0 12px; padding-bottom: 8px; border-bottom: 1px solid var(--border); }
.docs h3 { font-size: 15.5px; margin: 24px 0 8px; }
.docs p, .docs li { color: var(--text-2); }
.docs table { width: 100%; border-collapse: collapse; margin: 12px 0; font-size: 13.5px; }
.docs th, .docs td { padding: 8px 12px; border: 1px solid var(--border); text-align: left; }
.docs th { background: var(--gray-soft); font-weight: 500; }
.code-block {
    position: relative;
    background: #1b222c;
    color: #e6eaf0;
    border-radius: 8px;
    padding: 14px 16px;
    margin: 10px 0;
    overflow-x: auto;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 13px;
    line-height: 1.65;
}
.code-block code { white-space: pre; }
.code-copy { position: absolute; top: 10px; right: 10px; font-size: 12px; }

/* ---------- 密钥展示 ---------- */
.key-cell { display: flex; align-items: center; gap: 8px; }
.key-text { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; color: var(--text); background: var(--gray-soft); border: 1px solid var(--border); border-radius: 5px; padding: 3px 8px; }

/* ---------- 工具 ---------- */
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mb-16 { margin-bottom: 16px; }
.muted { color: var(--text-3); }
.small { font-size: 12.5px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.text-right { text-align: right; }
.w-100 { width: 100%; }

::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-thumb { background: #cbd1da; border-radius: 9px; }
::-webkit-scrollbar-track { background: transparent; }

@media (max-width: 860px) {
    .sidebar { position: fixed; left: 0; top: 0; z-index: 50; transform: translateX(-100%); transition: transform .2s; }
    .sidebar.open { transform: none; box-shadow: var(--shadow-md); }
    .topbar .page-title { font-size: 15px; }
    .content { padding: 16px; }
    .landing-hero h1 { font-size: 30px; }
    .menu-toggle { display: inline-flex; }
}
.menu-toggle { display: none; }

/* ---------- API 测试（Playground） ---------- */
.pg-layout {
    display: grid;
    grid-template-columns: 320px minmax(0, 1fr);
    gap: 16px;
    align-items: stretch;
}
@media (max-width: 960px) { .pg-layout { grid-template-columns: 1fr; } }
.pg-side .card-body { font-size: 13.5px; }

.pg-chat {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 120px);
    min-height: 480px;
}
.pg-msgs {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    background: #fafbfc;
}
.pg-empty {
    margin: auto;
    text-align: center;
    color: var(--text-3);
    font-size: 13px;
    max-width: 320px;
}
.pg-empty .empty-ico { font-size: 34px; margin-bottom: 8px; opacity: .55; }

.pg-msg { display: flex; flex-direction: column; max-width: 86%; }
.pg-msg.user { align-self: flex-end; align-items: flex-end; }
.pg-msg.assistant { align-self: flex-start; align-items: flex-start; }
.pg-bubble {
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 13.5px;
    line-height: 1.65;
    white-space: pre-wrap;
    word-break: break-word;
    box-shadow: var(--shadow-sm);
}
.pg-msg.user .pg-bubble { background: var(--accent); color: #fff; border-bottom-right-radius: 3px; }
.pg-msg.assistant .pg-bubble { background: var(--surface); border: 1px solid var(--border); border-bottom-left-radius: 3px; }
.pg-msg.pg-err .pg-bubble { background: var(--red-soft); border-color: #f8d2cf; color: var(--red); }

.pg-reasoning {
    display: none;
    font-size: 12.5px;
    color: var(--text-3);
    background: var(--gray-soft);
    border-radius: 6px;
    padding: 8px 10px;
    margin-bottom: 8px;
    max-height: 200px;
    overflow-y: auto;
    white-space: pre-wrap;
    word-break: break-word;
}
.pg-meta {
    margin-top: 6px;
    font-size: 11.5px;
    color: var(--text-3);
    white-space: pre-wrap;
}
.pg-msg.user .pg-meta { color: rgba(255, 255, 255, .75); }

.pg-input {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    padding: 12px 14px;
    border-top: 1px solid var(--border);
    background: var(--surface);
    border-radius: 0 0 var(--radius) var(--radius);
}
.pg-input textarea.form-control {
    flex: 1;
    resize: none;
    min-height: 40px;
    max-height: 160px;
    line-height: 1.5;
}
.pg-input .btn { flex-shrink: 0; }

/* ---------- 可排序表头 ---------- */
.th-sort { cursor: pointer; user-select: none; }
.th-sort:hover { color: var(--accent); }
.th-sort:hover::after { content: '⇅'; margin-left: 3px; opacity: .5; font-size: 10px; }
