/* ============ AgentHub 智体坊 · 全局样式 ============ */
:root {
  color-scheme: light;
  --bg: #f6f7fb;
  --bg-soft: #eef0f6;
  --surface: #ffffff;
  --surface-2: #f9fafc;
  --border: #e4e6ee;
  --text: #14161f;
  --text-2: #4b5063;
  --muted: #8a8fa3;
  --primary: #5b5bf7;
  --primary-2: #8b5cf6;
  --primary-soft: #ececfe;
  --primary-text: #ffffff;
  --success: #0e9f4f;
  --warning: #d98a00;
  --danger: #dc3b3b;
  --shadow: 0 1px 2px rgba(16, 20, 40, .04), 0 4px 16px rgba(16, 20, 40, .06);
  --shadow-lg: 0 10px 40px rgba(16, 20, 40, .14);
  --radius: 14px;
  --radius-sm: 9px;
  --header-h: 64px;
  --font: system-ui, -apple-system, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  --mono: ui-monospace, "Cascadia Code", Consolas, monospace;

  /* 图表色（参照数据可视化规范的参考调色板） */
  --chart-surface: #fcfcfb;
  --chart-series: #2a78d6;
  --chart-grid: #e1e0d9;
  --chart-axis: #c3c2b7;
  --chart-muted: #898781;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0e0f14;
  --bg-soft: #15171e;
  --surface: #171920;
  --surface-2: #1c1f28;
  --border: #2a2d38;
  --text: #f1f2f6;
  --text-2: #b4b8c7;
  --muted: #7d8296;
  --primary: #7c7cff;
  --primary-2: #a78bfa;
  --primary-soft: #23244a;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 16px rgba(0, 0, 0, .25);
  --shadow-lg: 0 10px 40px rgba(0, 0, 0, .5);
  --chart-surface: #1a1a19;
  --chart-series: #3987e5;
  --chart-grid: #2c2c2a;
  --chart-axis: #383835;
  --chart-muted: #898781;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { font-family: var(--font); background: var(--bg); color: var(--text); font-size: 15px; line-height: 1.6; -webkit-font-smoothing: antialiased; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }
h1, h2, h3, h4 { line-height: 1.3; margin: 0 0 .5em; }
p { margin: 0 0 1em; }
hr { border: 0; border-top: 1px solid var(--border); margin: 20px 0; }
::selection { background: var(--primary-soft); }

.container { max-width: 1200px; margin: 0 auto; padding: 0 20px; }
.container.narrow { max-width: 820px; }
.muted { color: var(--muted); }
.text-2 { color: var(--text-2); }
.small { font-size: 13px; }
.center { text-align: center; }
.row { display: flex; align-items: center; gap: 12px; }
.row.wrap { flex-wrap: wrap; }
.between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
.stack > * + * { margin-top: 14px; }
.hidden { display: none !important; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.clamp2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.mt { margin-top: 20px; } .mb { margin-bottom: 20px; } .mt-s { margin-top: 10px; }
.gradient-text { background: linear-gradient(90deg, var(--primary), var(--primary-2), #ec4899); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* ---------- 按钮 ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 38px; padding: 0 16px; border-radius: var(--radius-sm); border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font: inherit; font-size: 14px; font-weight: 500; cursor: pointer; transition: .15s; white-space: nowrap; text-decoration: none !important; }
.btn:hover { border-color: var(--primary); color: var(--primary); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.primary { background: linear-gradient(135deg, var(--primary), var(--primary-2)); color: #fff; border-color: transparent; }
.btn.primary:hover { filter: brightness(1.08); color: #fff; }
.btn.danger { color: var(--danger); }
.btn.danger:hover { border-color: var(--danger); background: var(--danger); color: #fff; }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: var(--bg-soft); color: var(--text); }
.btn.sm { height: 30px; padding: 0 10px; font-size: 13px; }
.btn.lg { height: 48px; padding: 0 26px; font-size: 16px; border-radius: 12px; }
.btn.block { width: 100%; }
.icon-btn { width: 36px; height: 36px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; border: 0; background: transparent; color: var(--text-2); cursor: pointer; font-size: 18px; position: relative; }
.icon-btn:hover { background: var(--bg-soft); color: var(--text); }
.dot-badge { position: absolute; top: 4px; right: 4px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px; background: var(--danger); color: #fff; font-size: 10px; line-height: 16px; text-align: center; }

/* ---------- 表单 ---------- */
.field { display: block; margin-bottom: 16px; }
.field > span, .label { display: block; font-size: 13px; font-weight: 600; color: var(--text-2); margin-bottom: 6px; }
.input, select.input, textarea.input { width: 100%; height: 40px; padding: 0 12px; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit; font-size: 14px; outline: none; transition: .15s; }
textarea.input { height: auto; min-height: 96px; padding: 10px 12px; resize: vertical; line-height: 1.6; }
.input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.hint { font-size: 12px; color: var(--muted); margin-top: 4px; }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 14px; }
.check input { width: 16px; height: 16px; accent-color: var(--primary); }
.input-group { display: flex; gap: 8px; }
.switch { position: relative; width: 42px; height: 24px; display: inline-block; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch i { position: absolute; inset: 0; background: var(--border); border-radius: 12px; cursor: pointer; transition: .2s; }
.switch i::after { content: ""; position: absolute; width: 18px; height: 18px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .2s; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.switch input:checked + i { background: var(--primary); }
.switch input:checked + i::after { transform: translateX(18px); }

/* ---------- 卡片 / 徽标 ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); }
.card.flat { box-shadow: none; }
.card-title { font-size: 16px; font-weight: 700; margin-bottom: 14px; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 500; background: var(--bg-soft); color: var(--text-2); white-space: nowrap; }
.badge.primary { background: var(--primary-soft); color: var(--primary); }
.badge.success { background: rgba(14,159,79,.12); color: var(--success); }
.badge.warning { background: rgba(217,138,0,.14); color: var(--warning); }
.badge.danger { background: rgba(220,59,59,.12); color: var(--danger); }
.tag { display: inline-block; padding: 1px 8px; border-radius: 6px; background: var(--bg-soft); color: var(--text-2); font-size: 12px; margin: 0 4px 4px 0; }

.grid { display: grid; gap: 18px; }
.grid.c2 { grid-template-columns: repeat(2, 1fr); }
.grid.c3 { grid-template-columns: repeat(3, 1fr); }
.grid.c4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 960px) { .grid.c4, .grid.c3 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 640px) { .grid.c4, .grid.c3, .grid.c2 { grid-template-columns: 1fr; } }

/* ---------- 顶部导航 ---------- */
.header { position: sticky; top: 0; z-index: 50; height: var(--header-h); background: color-mix(in srgb, var(--surface) 85%, transparent); backdrop-filter: saturate(180%) blur(14px); border-bottom: 1px solid var(--border); }
.header .container { height: 100%; display: flex; align-items: center; gap: 24px; }
.logo { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 18px; color: var(--text) !important; text-decoration: none !important; white-space: nowrap; }
.logo-mark { width: 32px; height: 32px; border-radius: 9px; background: linear-gradient(135deg, var(--primary), var(--primary-2)); display: grid; place-items: center; color: #fff; font-size: 17px; }
.nav { display: flex; gap: 4px; flex: 1; }
.nav a { padding: 8px 12px; border-radius: 8px; color: var(--text-2); font-size: 14px; font-weight: 500; text-decoration: none; }
.nav a:hover { background: var(--bg-soft); color: var(--text); }
.nav a.active { color: var(--primary); background: var(--primary-soft); }
.header-right { display: flex; align-items: center; gap: 6px; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--bg-soft); display: grid; place-items: center; font-size: 18px; flex: none; border: 1px solid var(--border); }
.avatar.lg { width: 72px; height: 72px; font-size: 38px; }
.avatar.sq { border-radius: 12px; }
.menu-wrap { position: relative; }
.dropdown { position: absolute; right: 0; top: calc(100% + 8px); min-width: 220px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-lg); padding: 6px; display: none; z-index: 60; }
.dropdown.open { display: block; animation: pop .14s ease-out; }
.dropdown a, .dropdown button { display: flex; width: 100%; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 8px; color: var(--text); font: inherit; font-size: 14px; background: none; border: 0; cursor: pointer; text-align: left; text-decoration: none; }
.dropdown a:hover, .dropdown button:hover { background: var(--bg-soft); }
.dropdown .dd-head { padding: 10px 12px; border-bottom: 1px solid var(--border); margin-bottom: 6px; }
.mobile-toggle { display: none; }
@media (max-width: 860px) {
  .nav { display: none; position: absolute; top: var(--header-h); left: 0; right: 0; background: var(--surface); flex-direction: column; padding: 10px; border-bottom: 1px solid var(--border); box-shadow: var(--shadow-lg); }
  .nav.open { display: flex; }
  .mobile-toggle { display: inline-flex; }
  .header .container { gap: 10px; }
  .hide-m { display: none !important; }
  .notice-bar { padding: 7px 34px 7px 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .hero-stats { gap: 28px; }
}
@keyframes pop { from { opacity: 0; transform: translateY(-4px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- 公告条 ---------- */
.notice-bar { background: linear-gradient(90deg, var(--primary), var(--primary-2)); color: #fff; font-size: 13px; text-align: center; padding: 7px 40px; position: relative; }
.notice-bar a { color: #fff; text-decoration: underline; }
.notice-bar button { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); background: none; border: 0; color: #fff; cursor: pointer; font-size: 16px; opacity: .8; }

/* ---------- 页面 ---------- */
main { min-height: calc(100vh - var(--header-h) - 260px); animation: fade .25s ease-out; }
.page { padding: 36px 0 60px; }
.page-head { margin-bottom: 26px; }
.page-head h1 { font-size: 28px; margin-bottom: 6px; }
.section { padding: 70px 0; }
.section-title { text-align: center; margin-bottom: 40px; }
.section-title h2 { font-size: 32px; margin-bottom: 10px; }
.section-title p { color: var(--text-2); font-size: 16px; margin: 0; }

/* Hero */
.hero { position: relative; padding: 90px 0 70px; text-align: center; overflow: hidden; }
.hero::before { content: ""; position: absolute; inset: -40% -10% auto; height: 700px; background: radial-gradient(closest-side, color-mix(in srgb, var(--primary) 22%, transparent), transparent), radial-gradient(closest-side at 70% 40%, color-mix(in srgb, #ec4899 16%, transparent), transparent); z-index: -1; filter: blur(20px); }
.hero h1 { font-size: clamp(34px, 6vw, 60px); font-weight: 800; letter-spacing: -.02em; margin-bottom: 18px; }
.hero p.lead { font-size: clamp(16px, 2vw, 19px); color: var(--text-2); max-width: 680px; margin: 0 auto 30px; }
.hero-pill { display: inline-flex; align-items: center; gap: 8px; padding: 6px 14px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); font-size: 13px; color: var(--text-2); margin-bottom: 22px; box-shadow: var(--shadow); }
.hero-search { max-width: 620px; margin: 0 auto 26px; display: flex; gap: 8px; background: var(--surface); padding: 6px; border-radius: 14px; border: 1px solid var(--border); box-shadow: var(--shadow-lg); }
.hero-search input { flex: 1; border: 0; background: transparent; padding: 0 14px; font: inherit; font-size: 16px; color: var(--text); outline: none; min-width: 0; }
.hero-stats { display: flex; justify-content: center; gap: 48px; margin-top: 46px; flex-wrap: wrap; }
.hero-stats b { display: block; font-size: 30px; font-weight: 800; }
.hero-stats span { color: var(--muted); font-size: 13px; }

.feature { padding: 26px; }
.feature .ico { width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center; font-size: 24px; background: var(--primary-soft); margin-bottom: 14px; }
.feature h3 { font-size: 17px; }
.feature p { color: var(--text-2); margin: 0; font-size: 14px; }

.steps { counter-reset: s; }
.step { position: relative; padding-left: 58px; }
.step::before { counter-increment: s; content: counter(s); position: absolute; left: 0; top: 0; width: 40px; height: 40px; border-radius: 50%; background: linear-gradient(135deg, var(--primary), var(--primary-2)); color: #fff; display: grid; place-items: center; font-weight: 700; }

.testimonial p { color: var(--text-2); font-size: 14px; }
.cta { text-align: center; padding: 56px 24px; border-radius: 22px; background: linear-gradient(135deg, var(--primary), var(--primary-2)); color: #fff; }
.cta h2 { font-size: 30px; }
.cta .btn { background: #fff; color: var(--primary); border: 0; }

/* FAQ */
.faq details { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 16px 20px; margin-bottom: 10px; }
.faq summary { cursor: pointer; font-weight: 600; list-style: none; display: flex; justify-content: space-between; }
.faq summary::after { content: "+"; color: var(--muted); font-size: 20px; line-height: 1; }
.faq details[open] summary::after { content: "−"; }
.faq details p { margin: 10px 0 0; color: var(--text-2); }

/* ---------- 智能体卡片 ---------- */
.agent-card { display: flex; flex-direction: column; gap: 12px; padding: 20px; cursor: pointer; transition: .18s; color: var(--text); text-decoration: none !important; position: relative; }
.agent-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); border-color: color-mix(in srgb, var(--primary) 40%, var(--border)); }
.agent-card .head { display: flex; gap: 12px; align-items: center; }
.agent-ava { width: 50px; height: 50px; border-radius: 14px; display: grid; place-items: center; font-size: 26px; flex: none; }
.agent-ava.xl { width: 88px; height: 88px; font-size: 48px; border-radius: 22px; }
.agent-card h3 { font-size: 16px; margin: 0; }
.agent-card .desc { color: var(--text-2); font-size: 13.5px; margin: 0; min-height: 43px; }
.agent-card .meta { display: flex; gap: 14px; color: var(--muted); font-size: 12.5px; margin-top: auto; }
.featured-flag { position: absolute; top: 14px; right: 14px; }

.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 22px; }
.chip { padding: 6px 14px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--text-2); font-size: 13.5px; cursor: pointer; font-family: inherit; }
.chip:hover { border-color: var(--primary); color: var(--primary); }
.chip.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.toolbar { display: flex; gap: 10px; margin-bottom: 18px; flex-wrap: wrap; align-items: center; }
.toolbar .input { max-width: 320px; }

.pager { display: flex; justify-content: center; gap: 6px; margin-top: 30px; flex-wrap: wrap; }
.pager button { min-width: 36px; height: 36px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); color: var(--text); cursor: pointer; font: inherit; }
.pager button.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.pager button:disabled { opacity: .4; cursor: not-allowed; }

.empty { text-align: center; padding: 60px 20px; color: var(--muted); }
.empty .big { font-size: 50px; margin-bottom: 8px; }

/* 详情 */
.detail-hero { display: flex; gap: 26px; align-items: flex-start; }
@media (max-width: 640px) { .detail-hero { flex-direction: column; } }
.stars { color: #f5a524; letter-spacing: 1px; }
.star-input { display: inline-flex; gap: 4px; font-size: 26px; cursor: pointer; }
.star-input span { color: var(--border); transition: .1s; }
.star-input span.on { color: #f5a524; }
.review { padding: 14px 0; border-bottom: 1px solid var(--border); }
.review:last-child { border-bottom: 0; }

/* ---------- 价格 ---------- */
.plan { display: flex; flex-direction: column; position: relative; padding: 28px; }
.plan.hl { border: 2px solid var(--primary); box-shadow: 0 10px 40px color-mix(in srgb, var(--primary) 22%, transparent); }
.plan .ribbon { position: absolute; top: -12px; left: 50%; transform: translateX(-50%); background: linear-gradient(135deg, var(--primary), var(--primary-2)); color: #fff; font-size: 12px; padding: 3px 12px; border-radius: 999px; font-weight: 600; }
.plan .price { font-size: 40px; font-weight: 800; margin: 10px 0; }
.plan .price small { font-size: 14px; color: var(--muted); font-weight: 500; }
.plan ul { list-style: none; padding: 0; margin: 10px 0 24px; flex: 1; }
.plan li { padding: 6px 0; font-size: 14px; color: var(--text-2); }
.plan li::before { content: "✓"; color: var(--success); font-weight: 700; margin-right: 8px; }
.pay-methods { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.pay-method { border: 2px solid var(--border); border-radius: 12px; padding: 14px; text-align: center; cursor: pointer; background: var(--surface); font: inherit; color: var(--text); }
.pay-method.active { border-color: var(--primary); background: var(--primary-soft); }
.qr { width: 190px; height: 190px; margin: 10px auto; border-radius: 12px; background: #fff; padding: 10px; border: 1px solid var(--border); }

/* ---------- 认证页 ---------- */
.auth-wrap { min-height: calc(100vh - var(--header-h)); display: grid; place-items: center; padding: 40px 16px; }
.auth-card { width: 100%; max-width: 420px; padding: 34px; }
.auth-card h1 { font-size: 24px; text-align: center; }
.captcha { min-width: 110px; height: 40px; border-radius: var(--radius-sm); border: 1px dashed var(--border); background: var(--bg-soft); font-family: var(--mono); font-weight: 700; font-size: 15px; cursor: pointer; color: var(--text); letter-spacing: 1px; }
.pw-meter { height: 4px; border-radius: 2px; background: var(--border); margin-top: 6px; overflow: hidden; }
.pw-meter i { display: block; height: 100%; width: 0; transition: .2s; }

/* ---------- 后台 / 个人中心布局 ---------- */
.side-layout { display: grid; grid-template-columns: 230px 1fr; gap: 24px; align-items: start; }
.side-nav { position: sticky; top: calc(var(--header-h) + 20px); padding: 10px; }
.side-nav a { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 9px; color: var(--text-2); font-size: 14px; text-decoration: none; }
.side-nav a:hover { background: var(--bg-soft); color: var(--text); }
.side-nav a.active { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.side-nav .count { margin-left: auto; }
@media (max-width: 860px) {
  .side-layout { grid-template-columns: 1fr; }
  .side-nav { position: static; display: flex; overflow-x: auto; gap: 4px; }
  .side-nav a { white-space: nowrap; }
}
.stat { padding: 18px 20px; }
.stat .k { color: var(--muted); font-size: 13px; }
.stat .v { font-size: 28px; font-weight: 750; margin-top: 4px; }
.stat .d { font-size: 12.5px; color: var(--text-2); margin-top: 2px; }

.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th, .table td { padding: 11px 12px; text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap; }
.table th { color: var(--muted); font-weight: 600; font-size: 12.5px; background: var(--surface-2); }
.table tr:hover td { background: var(--surface-2); }
.table td.wrap { white-space: normal; min-width: 200px; }
.num { font-variant-numeric: tabular-nums; }

/* ---------- 对话 ---------- */
.chat-layout { display: grid; grid-template-columns: 280px 1fr; height: calc(100vh - var(--header-h)); }
.chat-side { border-right: 1px solid var(--border); background: var(--surface); display: flex; flex-direction: column; min-height: 0; }
.chat-side .top { padding: 14px; border-bottom: 1px solid var(--border); display: flex; gap: 8px; }
.conv-list { flex: 1; overflow-y: auto; padding: 8px; }
.conv { display: flex; gap: 10px; align-items: center; padding: 10px; border-radius: 10px; cursor: pointer; color: var(--text); text-decoration: none !important; position: relative; }
.conv:hover { background: var(--bg-soft); }
.conv.active { background: var(--primary-soft); }
.conv .t { font-size: 14px; font-weight: 500; }
.conv .s { font-size: 12px; color: var(--muted); }
.conv .ops { display: none; gap: 2px; }
.conv:hover .ops { display: flex; }
.conv .ops button { border: 0; background: none; cursor: pointer; padding: 2px 4px; color: var(--muted); font-size: 13px; border-radius: 4px; }
.conv .ops button:hover { background: var(--border); color: var(--text); }
.chat-main { display: flex; flex-direction: column; min-height: 0; min-width: 0; background: var(--bg); }
.chat-head { padding: 12px 20px; border-bottom: 1px solid var(--border); background: var(--surface); display: flex; align-items: center; gap: 12px; }
.chat-body { flex: 1; overflow-y: auto; padding: 24px 0; }
.chat-inner { max-width: 820px; margin: 0 auto; padding: 0 20px; }
.msg { display: flex; gap: 12px; margin-bottom: 22px; animation: fade .2s ease-out; }
.msg .bubble { padding: 12px 16px; border-radius: 14px; max-width: calc(100% - 50px); overflow-wrap: anywhere; }
.msg.assistant .bubble { background: var(--surface); border: 1px solid var(--border); border-top-left-radius: 4px; }
.msg.user { flex-direction: row-reverse; }
.msg.user .bubble { background: linear-gradient(135deg, var(--primary), var(--primary-2)); color: #fff; border-top-right-radius: 4px; white-space: pre-wrap; }
.msg-tools { display: flex; gap: 4px; margin-top: 6px; opacity: 0; transition: .15s; }
.msg:hover .msg-tools { opacity: 1; }
.msg-tools button { border: 0; background: none; color: var(--muted); font-size: 12px; cursor: pointer; padding: 2px 6px; border-radius: 4px; font-family: inherit; }
.msg-tools button:hover { background: var(--bg-soft); color: var(--text); }
.think { margin-bottom: 8px; font-size: 13px; max-width: 100%; }
.think summary { cursor: pointer; color: var(--muted); padding: 4px 10px; border-radius: 6px; background: var(--bg-soft); width: fit-content; user-select: none; }
.think summary:hover { color: var(--text); }
.think-body { margin-top: 6px; padding: 4px 0 4px 12px; border-left: 2px solid var(--border); color: var(--muted); white-space: pre-wrap; word-break: break-word; line-height: 1.7; max-height: 320px; overflow: auto; }
.kb-sources { margin-top: 6px; font-size: 13px; }
.kb-sources summary { cursor: pointer; color: var(--muted); font-size: 12px; padding: 2px 6px; border-radius: 4px; width: fit-content; }
.kb-sources summary:hover { background: var(--bg-soft); color: var(--text); }
.kb-chunk { background: var(--bg-soft); border-radius: 8px; padding: 8px 12px; margin-top: 6px; white-space: pre-wrap; word-break: break-word; font-size: 13px; line-height: 1.6; max-height: 260px; overflow: auto; }
.chat-input { padding: 14px 20px 18px; background: var(--bg); }
.chat-box { max-width: 820px; margin: 0 auto; display: flex; gap: 10px; align-items: flex-end; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 10px 10px 10px 16px; box-shadow: var(--shadow); }
.chat-box:focus-within { border-color: var(--primary); }
.chat-box textarea { flex: 1; border: 0; outline: none; resize: none; background: transparent; color: var(--text); font: inherit; font-size: 15px; max-height: 200px; min-height: 24px; line-height: 1.6; padding: 6px 0; }
.starters { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin: 10px 0 20px; }
.starters button { border: 1px solid var(--border); background: var(--surface); border-radius: 12px; padding: 9px 14px; cursor: pointer; color: var(--text-2); font: inherit; font-size: 13.5px; }
.starters button:hover { border-color: var(--primary); color: var(--primary); }
.typing span { display: inline-block; width: 6px; height: 6px; margin: 0 2px; background: var(--muted); border-radius: 50%; animation: blink 1.2s infinite; }
.typing span:nth-child(2) { animation-delay: .2s; } .typing span:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .2; } 40% { opacity: 1; } }
.chat-back { display: none; }
@media (max-width: 760px) {
  .chat-layout { grid-template-columns: 1fr; }
  .chat-side { display: none; }
  .chat-layout.show-side .chat-side { display: flex; }
  .chat-layout.show-side .chat-main { display: none; }
  .chat-back { display: inline-flex; }
}

/* Markdown */
.md > *:last-child { margin-bottom: 0; }
.md p { margin: 0 0 .8em; }
.md ul, .md ol { margin: 0 0 .8em; padding-left: 1.4em; }
.md li { margin: .2em 0; }
.md h1, .md h2, .md h3, .md h4 { margin: .8em 0 .5em; }
.md h1 { font-size: 1.4em; } .md h2 { font-size: 1.25em; } .md h3 { font-size: 1.1em; }
.md code { font-family: var(--mono); font-size: .9em; background: var(--bg-soft); padding: 1px 6px; border-radius: 5px; }
.md pre { position: relative; background: #0f1220; color: #e6e8f2; padding: 14px 16px; border-radius: 10px; overflow-x: auto; margin: 0 0 .9em; font-size: 13.5px; line-height: 1.55; }
.md pre code { background: none; padding: 0; color: inherit; font-size: inherit; }
.md pre .copy-code { position: absolute; top: 6px; right: 6px; font-size: 12px; background: rgba(255,255,255,.1); color: #fff; border: 0; border-radius: 6px; padding: 3px 8px; cursor: pointer; }
.md pre .lang { position: absolute; top: 8px; left: 14px; font-size: 11px; color: #8890ad; }
.md pre.has-lang { padding-top: 30px; }
.md blockquote { margin: 0 0 .8em; padding: 6px 14px; border-left: 3px solid var(--primary); background: var(--primary-soft); border-radius: 0 8px 8px 0; color: var(--text-2); }
.md table { border-collapse: collapse; margin: 0 0 .9em; font-size: 14px; display: block; overflow-x: auto; }
.md th, .md td { border: 1px solid var(--border); padding: 6px 12px; }
.md th { background: var(--surface-2); }
.md hr { margin: 14px 0; }
.md a { word-break: break-all; }
.md sub { color: var(--muted); font-size: 12px; }

/* ---------- 弹窗 / 提示 ---------- */
.modal-mask { position: fixed; inset: 0; background: rgba(10, 12, 20, .5); backdrop-filter: blur(3px); z-index: 100; display: grid; place-items: center; padding: 20px; animation: fade .15s; }
.modal { width: 100%; max-width: 480px; background: var(--surface); border-radius: 16px; box-shadow: var(--shadow-lg); max-height: calc(100vh - 40px); display: flex; flex-direction: column; animation: pop .18s ease-out; }
.modal.wide { max-width: 720px; }
.modal-head { padding: 18px 22px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; font-weight: 700; font-size: 16px; }
.modal-body { padding: 22px; overflow-y: auto; }
.modal-foot { padding: 14px 22px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 10px; }
.toasts { position: fixed; top: 76px; left: 50%; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { pointer-events: auto; padding: 10px 18px; border-radius: 10px; background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg); border: 1px solid var(--border); font-size: 14px; animation: pop .2s ease-out; display: flex; gap: 8px; align-items: center; max-width: 90vw; }
.toast.success { border-color: color-mix(in srgb, var(--success) 50%, var(--border)); }
.toast.error { border-color: color-mix(in srgb, var(--danger) 50%, var(--border)); }
.spinner { width: 22px; height: 22px; border: 2.5px solid var(--border); border-top-color: var(--primary); border-radius: 50%; animation: spin .7s linear infinite; display: inline-block; }
.loading { display: flex; justify-content: center; padding: 70px 0; }
.emoji-grid { display: grid; grid-template-columns: repeat(10, 1fr); gap: 4px; }
.emoji-grid button { font-size: 22px; padding: 6px 0; border: 0; background: none; border-radius: 8px; cursor: pointer; }
.emoji-grid button:hover, .emoji-grid button.active { background: var(--primary-soft); }
.color-row { display: flex; gap: 8px; flex-wrap: wrap; }
.color-row button { width: 28px; height: 28px; border-radius: 50%; border: 2px solid transparent; cursor: pointer; }
.color-row button.active { border-color: var(--text); box-shadow: 0 0 0 2px var(--surface) inset; }
.code-box { font-family: var(--mono); background: var(--bg-soft); padding: 10px 12px; border-radius: 8px; font-size: 13px; word-break: break-all; }
pre.code-block { background: #0f1220; color: #e6e8f2; padding: 16px; border-radius: 12px; overflow-x: auto; font-size: 13px; font-family: var(--mono); line-height: 1.6; }

/* ---------- 图表 ---------- */
.viz { background: var(--chart-surface); border-radius: 12px; position: relative; }
.viz svg { display: block; width: 100%; height: auto; overflow: visible; }
.viz .grid-line { stroke: var(--chart-grid); stroke-width: 1; }
.viz .baseline { stroke: var(--chart-axis); stroke-width: 1; }
.viz .tick { fill: var(--chart-muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.viz .bar { fill: var(--chart-series); }
.viz .hit { fill: transparent; cursor: crosshair; }
.viz .hit:hover + .bar, .viz .bar.hover { opacity: .78; }
.viz-tip { position: absolute; pointer-events: none; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-lg); border-radius: 8px; padding: 6px 10px; font-size: 12px; white-space: nowrap; transform: translate(-50%, -110%); color: var(--text); z-index: 5; }
.viz-tip b { font-variant-numeric: tabular-nums; }
.viz-table { font-size: 12.5px; }

/* ---------- 页脚 ---------- */
.footer { border-top: 1px solid var(--border); background: var(--surface); padding: 46px 0 26px; margin-top: 40px; }
.footer-grid { display: grid; grid-template-columns: 2fr repeat(3, 1fr); gap: 30px; }
.footer h4 { font-size: 14px; margin-bottom: 12px; }
.footer a { display: block; color: var(--text-2); font-size: 14px; padding: 3px 0; }
.footer .copy { border-top: 1px solid var(--border); margin-top: 30px; padding-top: 20px; color: var(--muted); font-size: 13px; display: flex; justify-content: space-between; flex-wrap: wrap; gap: 10px; }
@media (max-width: 760px) { .footer-grid { grid-template-columns: 1fr 1fr; } }
.no-footer .footer { display: none; }

.prose h2 { font-size: 20px; margin-top: 28px; }
.prose p, .prose li { color: var(--text-2); }
.back-top { position: fixed; right: 22px; bottom: 22px; width: 42px; height: 42px; border-radius: 50%; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow); cursor: pointer; font-size: 18px; color: var(--text-2); display: none; z-index: 40; }
.back-top.show { display: block; }
