/* 阿布管理平台 — 样式表
   设计：深色侧栏 + 浅色工作区，控制台质感，中文字体优先 */

:root {
  --brand: #4b5cf5;
  --brand-soft: #eef0ff;
  --brand-ink: #2b3ac9;
  --accent: #f5a524;
  --ink: #0e1116;
  --ink-2: #353b45;
  --muted: #78818f;
  --line: #e6e8ee;
  --line-soft: #f0f2f6;
  --bg: #f6f7f9;
  --panel: #ffffff;
  --ok: #17a673;
  --warn: #e0a015;
  --err: #d94a4a;
  --radius: 10px;
  --shadow-1: 0 1px 2px rgba(16, 20, 28, .05), 0 1px 3px rgba(16, 20, 28, .04);
  --shadow-2: 0 8px 24px rgba(16, 20, 28, .09), 0 2px 6px rgba(16, 20, 28, .05);
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 14px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
        "Hiragino Sans GB", "Microsoft YaHei", "Source Han Sans SC", sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

button, input, textarea, select { font: inherit; color: inherit; }

::selection { background: #dfe3ff; }

/* ---------------------------------------------------------------- 登录页 */

.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background:
    radial-gradient(900px 500px at 15% 10%, #eef1ff 0%, transparent 60%),
    radial-gradient(700px 500px at 90% 90%, #fff3e0 0%, transparent 55%),
    var(--bg);
  padding: 24px;
}

.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow-2);
  padding: 34px 30px 28px;
}

.login-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 26px; }

.mark {
  width: 40px; height: 40px; border-radius: 11px;
  background: linear-gradient(145deg, #1b2030, #0e1116);
  color: #fff; display: grid; place-items: center;
  font-weight: 700; font-size: 17px; letter-spacing: -.5px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.14);
  position: relative; flex: 0 0 auto;
}
.mark::after {
  content: ""; position: absolute; right: -3px; bottom: -3px;
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--accent); border: 2px solid var(--panel);
}

.login-brand h1 { font-size: 17px; margin: 0; letter-spacing: -.2px; }
.login-brand p { margin: 2px 0 0; font-size: 12px; color: var(--muted); font-family: var(--mono); }

/* ---------------------------------------------------------------- 表单 */

.field { margin-bottom: 16px; }
.field > label {
  display: block; font-size: 12px; font-weight: 600; color: var(--ink-2);
  margin-bottom: 6px; letter-spacing: .2px;
}
.input, .textarea, .select {
  width: 100%; padding: 9px 12px; background: #fff;
  border: 1px solid #dfe3ea; border-radius: 8px; outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.input:focus, .textarea:focus, .select:focus {
  border-color: var(--brand); box-shadow: 0 0 0 3px rgba(75, 92, 245, .12);
}
.textarea { resize: vertical; min-height: 120px; }
.hint { font-size: 12px; color: var(--muted); margin-top: 6px; }
.err-text { color: var(--err); font-size: 12.5px; min-height: 18px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 14px; border-radius: 8px; border: 1px solid transparent;
  background: var(--brand); color: #fff; font-weight: 600; font-size: 13px;
  cursor: pointer; transition: background .15s, box-shadow .15s, border-color .15s, opacity .15s;
  white-space: nowrap;
}
.btn:hover { background: var(--brand-ink); text-decoration: none; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.ghost { background: #fff; color: var(--ink-2); border-color: #dfe3ea; }
.btn.ghost:hover { background: #f7f8fb; border-color: #cfd5df; color: var(--ink); }
.btn.sm { padding: 5px 10px; font-size: 12.5px; }
.btn.danger { background: #fff; color: var(--err); border-color: #f2caca; }
.btn.danger:hover { background: #fdf3f3; }
.btn.block { width: 100%; padding: 10px; }

/* ---------------------------------------------------------------- 骨架 */

.shell { display: flex; min-height: 100vh; }

.sidebar {
  width: 230px; flex: 0 0 230px; position: sticky; top: 0; height: 100vh;
  background: linear-gradient(180deg, #12151c 0%, #0d1015 100%);
  color: #c9cedb; display: flex; flex-direction: column;
  border-right: 1px solid #0a0c10;
}

.side-brand { display: flex; align-items: center; gap: 10px; padding: 18px 18px 16px; }
.side-brand .mark { width: 32px; height: 32px; border-radius: 9px; font-size: 14px; border-color: #0d1015; }
.side-brand .mark::after { border-color: #0d1015; }
.side-brand strong { color: #fff; font-size: 14.5px; display: block; letter-spacing: .2px; }
.side-brand span { font-size: 11px; color: #6c7689; font-family: var(--mono); letter-spacing: .3px; }

.side-nav { padding: 8px 10px; flex: 1; overflow-y: auto; }
.side-label {
  font-size: 10.5px; text-transform: uppercase; letter-spacing: .9px;
  color: #545d70; padding: 14px 10px 6px; font-weight: 700;
}
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px;
  color: #b6bdcb; font-size: 13.5px; margin-bottom: 2px; cursor: pointer;
  transition: background .14s, color .14s;
}
.nav-item:hover { background: rgba(255,255,255,.055); color: #fff; text-decoration: none; }
.nav-item.active { background: rgba(75, 92, 245, .18); color: #fff; box-shadow: inset 2px 0 0 var(--brand); }
.nav-item svg { width: 16px; height: 16px; opacity: .85; flex: 0 0 auto; }
.nav-item .count {
  margin-left: auto; font-size: 11px; font-family: var(--mono);
  color: #7c8699; background: rgba(255,255,255,.07); padding: 0 6px; border-radius: 20px;
}

.side-foot { padding: 12px 16px 16px; border-top: 1px solid rgba(255,255,255,.06); font-size: 11.5px; color: #667085; }
.side-foot .row { display: flex; align-items: center; gap: 6px; }
.side-foot .dot { width: 6px; height: 6px; border-radius: 50%; background: #3ddc97; box-shadow: 0 0 8px #3ddc97aa; }
.side-foot .dot.bad { background: var(--err); box-shadow: 0 0 8px #d94a4aaa; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  height: 58px; display: flex; align-items: center; gap: 16px;
  padding: 0 30px; background: rgba(255,255,255,.82);
  backdrop-filter: saturate(180%) blur(10px);
  border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20;
}
.crumb { font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 7px; }
.crumb b { color: var(--ink); font-weight: 600; }
.topbar .spacer { flex: 1; }
.user-chip {
  display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-2);
  padding: 5px 10px 5px 6px; border: 1px solid var(--line); border-radius: 20px; background: #fff;
}
.user-chip .avatar {
  width: 22px; height: 22px; border-radius: 50%; background: var(--brand-soft);
  color: var(--brand-ink); display: grid; place-items: center; font-size: 11px; font-weight: 700;
}

.content { padding: 26px 30px 64px; width: 100%; max-width: 1220px; }

/* ---------------------------------------------------------------- 页头 */

.page-head { display: flex; align-items: flex-start; gap: 16px; margin-bottom: 22px; }
.page-head h1 { font-size: 21px; margin: 0; letter-spacing: -.3px; font-weight: 700; }
.page-head p { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.page-head .actions { margin-left: auto; display: flex; gap: 8px; }

/* ---------------------------------------------------------------- 卡片 */

.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow-1);
}
.card-head {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 18px; border-bottom: 1px solid var(--line-soft);
}
.card-head h2 { font-size: 14px; margin: 0; font-weight: 650; letter-spacing: -.1px; }
.card-head .sub { font-size: 12px; color: var(--muted); }
.card-head .actions { margin-left: auto; display: flex; gap: 8px; }
.card-body { padding: 18px; }
.card-body.flush { padding: 0; }

.stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 16px 14px; box-shadow: var(--shadow-1); position: relative; overflow: hidden;
}
.stat .k { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.stat .v { font-size: 25px; font-weight: 700; letter-spacing: -.8px; margin-top: 6px; font-variant-numeric: tabular-nums; }
.stat .v small { font-size: 12px; font-weight: 500; color: var(--muted); letter-spacing: 0; margin-left: 4px; }
.stat .f { font-size: 11.5px; color: var(--muted); margin-top: 4px; font-family: var(--mono); }
.stat::after {
  content: ""; position: absolute; right: -18px; top: -18px; width: 64px; height: 64px;
  border-radius: 50%; background: var(--brand-soft); opacity: .55;
}

.grid-2 { display: grid; grid-template-columns: 1.15fr .85fr; gap: 16px; align-items: start; }

/* ---------------------------------------------------------------- 表格 */

.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }
.table th {
  text-align: left; font-weight: 600; color: var(--muted); font-size: 11.5px;
  text-transform: uppercase; letter-spacing: .5px; padding: 10px 16px;
  border-bottom: 1px solid var(--line); background: #fbfbfd; white-space: nowrap;
}
.table td { padding: 12px 16px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background .12s; }
.table tbody tr:hover { background: #fafbff; }
.table tr.clickable { cursor: pointer; }
.table .t-title { font-weight: 600; color: var(--ink); }
.table .t-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.table .num { font-variant-numeric: tabular-nums; font-family: var(--mono); font-size: 12.5px; }

.ver {
  display: inline-block; font-family: var(--mono); font-size: 11.5px; font-weight: 600;
  padding: 2px 7px; border-radius: 5px; background: var(--brand-soft); color: var(--brand-ink);
}

.tag {
  display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px;
  padding: 2px 8px; border-radius: 20px; background: #f1f3f7; color: var(--ink-2);
  border: 1px solid #e8ebf1;
}
.tag.ok { background: #eaf7f1; color: #0f7a56; border-color: #cfeee1; }
.tag.err { background: #fdeeee; color: #b93a3a; border-color: #f6d5d5; }
.tag.warn { background: #fdf6e6; color: #96660a; border-color: #f4e4bb; }

.empty { padding: 46px 20px; text-align: center; color: var(--muted); font-size: 13px; }
.empty strong { display: block; color: var(--ink-2); margin-bottom: 4px; font-size: 14px; }

/* ---------------------------------------------------------------- 文档阅读 */

.doc-wrap { display: grid; grid-template-columns: minmax(0, 1fr) 260px; gap: 24px; align-items: start; }

.doc-head { margin-bottom: 18px; }
.doc-head h1 { font-size: 27px; margin: 0 0 10px; letter-spacing: -.6px; line-height: 1.3; }
.doc-meta { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; font-size: 12px; color: var(--muted); }
.doc-meta .sep { width: 1px; height: 12px; background: var(--line); }

.prose {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow-1); padding: 32px 38px 40px; font-size: 14.5px; line-height: 1.85;
  color: #1d222b;
}
.prose > :first-child { margin-top: 0; }
.prose h1 { font-size: 24px; margin: 0 0 18px; letter-spacing: -.4px; }
.prose h2 {
  font-size: 18px; margin: 34px 0 12px; padding-bottom: 8px; border-bottom: 1px solid var(--line);
  letter-spacing: -.2px; scroll-margin-top: 76px;
}
.prose h3 { font-size: 15.5px; margin: 24px 0 8px; color: var(--ink-2); scroll-margin-top: 76px; }
.prose h4 { font-size: 14px; margin: 18px 0 6px; color: var(--ink-2); }
.prose p { margin: 10px 0; }
.prose ul, .prose ol { padding-left: 22px; margin: 10px 0; }
.prose li { margin: 5px 0; }
.prose blockquote {
  margin: 14px 0; padding: 10px 16px; border-left: 3px solid var(--brand);
  background: #f7f8ff; color: var(--ink-2); border-radius: 0 6px 6px 0;
}
.prose code {
  font-family: var(--mono); font-size: 12.8px; background: #f2f4f8;
  padding: 1.5px 5px; border-radius: 4px; color: #b53a6e; border: 1px solid #e9ecf2;
}
.prose pre {
  background: #0f1319; color: #dfe4ee; padding: 16px 18px; border-radius: 9px;
  overflow-x: auto; font-size: 12.6px; line-height: 1.7; margin: 14px 0;
  border: 1px solid #1d2430;
}
.prose pre code { background: none; border: 0; padding: 0; color: inherit; font-size: inherit; }
.prose table { border-collapse: collapse; width: 100%; margin: 14px 0; font-size: 13px; }
.prose th, .prose td { border: 1px solid var(--line); padding: 8px 12px; text-align: left; vertical-align: top; }
.prose th { background: #f8f9fc; font-weight: 650; }
.prose tr:nth-child(even) td { background: #fcfcfe; }
.prose img { max-width: 100%; border-radius: 6px; }
.prose hr { border: 0; border-top: 1px solid var(--line); margin: 28px 0; }
.prose .mermaid { margin: 16px 0; text-align: center; }
.prose .mermaid svg { max-width: 100%; height: auto; }
.prose .anchor-link { color: #c8cedb; margin-left: 6px; font-weight: 400; opacity: 0; transition: opacity .15s; }
.prose h2:hover .anchor-link, .prose h3:hover .anchor-link { opacity: 1; }

.side-panel { position: sticky; top: 76px; display: grid; gap: 14px; }
.meta-list { display: grid; gap: 10px; font-size: 12.5px; }
.meta-list .row { display: flex; justify-content: space-between; gap: 10px; }
.meta-list .row span:first-child { color: var(--muted); }
.meta-list .row span:last-child { color: var(--ink-2); text-align: right; font-weight: 500; }

.toc { font-size: 12.5px; max-height: 46vh; overflow-y: auto; }
.toc a { display: block; padding: 4px 0 4px 10px; color: var(--muted); border-left: 2px solid var(--line); line-height: 1.5; }
.toc a:hover { color: var(--brand); border-left-color: var(--brand); text-decoration: none; }
.toc a.lv3 { padding-left: 22px; font-size: 12px; }
.toc a.active { color: var(--brand-ink); border-left-color: var(--brand); background: #f7f8ff; }

.list-plain { margin: 0; padding: 0; list-style: none; font-size: 12.5px; }
.list-plain li { padding: 9px 0; border-bottom: 1px dashed var(--line); display: flex; gap: 8px; align-items: baseline; }
.list-plain li:last-child { border-bottom: 0; }
.list-plain .t { color: var(--muted); font-family: var(--mono); font-size: 11px; flex: 0 0 auto; }

/* ---------------------------------------------------------------- 编辑器 */

.editor-grid { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 18px; align-items: start; }
.meta-card { position: sticky; top: 76px; }
.edit-area {
  width: 100%; min-height: 620px; padding: 18px 20px; border-radius: var(--radius);
  border: 1px solid var(--line); background: #fff; font-family: var(--mono);
  font-size: 13px; line-height: 1.8; resize: vertical; box-shadow: var(--shadow-1);
}
.edit-area:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(75,92,245,.1); }
.editor-tabs { display: flex; gap: 2px; background: #eef0f5; padding: 3px; border-radius: 8px; }
.editor-tabs button {
  border: 0; background: none; padding: 5px 12px; border-radius: 6px;
  font-size: 12.5px; color: var(--muted); cursor: pointer; font-weight: 600;
}
.editor-tabs button.on { background: #fff; color: var(--ink); box-shadow: var(--shadow-1); }
.preview-pane {
  min-height: 620px; background: #fff; border: 1px solid var(--line);
  border-radius: var(--radius); padding: 24px 28px; box-shadow: var(--shadow-1);
  overflow-y: auto;
}
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

/* ---------------------------------------------------------------- 弹层与提示 */

.modal-mask {
  position: fixed; inset: 0; background: rgba(12, 16, 24, .42);
  backdrop-filter: blur(2px); display: grid; place-items: center; z-index: 90; padding: 20px;
  animation: fade .15s ease;
}
.modal {
  width: min(760px, 100%); max-height: 84vh; background: #fff; border-radius: 12px;
  box-shadow: 0 24px 60px rgba(10, 14, 22, .28); display: flex; flex-direction: column;
  animation: pop .16s ease;
}
.modal-head { display: flex; align-items: center; gap: 10px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.modal-head h3 { margin: 0; font-size: 15px; }
.modal-head .x { margin-left: auto; border: 0; background: none; font-size: 20px; color: var(--muted); cursor: pointer; line-height: 1; }
.modal-body { padding: 18px 20px; overflow-y: auto; }
.modal-foot { padding: 14px 20px; border-top: 1px solid var(--line); display: flex; gap: 8px; justify-content: flex-end; }

@keyframes fade { from { opacity: 0 } to { opacity: 1 } }
@keyframes pop { from { opacity: 0; transform: translateY(6px) scale(.99) } to { opacity: 1; transform: none } }

.toasts { position: fixed; right: 20px; bottom: 20px; display: grid; gap: 8px; z-index: 120; }
.toast {
  background: #14181f; color: #e9edf5; padding: 10px 14px; border-radius: 8px; font-size: 13px;
  box-shadow: var(--shadow-2); animation: pop .16s ease; max-width: 360px;
}
.toast.ok { border-left: 3px solid #3ddc97; }
.toast.err { border-left: 3px solid #ff6b6b; }

.loading { padding: 60px 0; text-align: center; color: var(--muted); font-size: 13px; }
.spinner {
  width: 18px; height: 18px; border: 2px solid #dfe3ea; border-top-color: var(--brand);
  border-radius: 50%; display: inline-block; animation: spin .7s linear infinite; vertical-align: -3px; margin-right: 8px;
}
@keyframes spin { to { transform: rotate(360deg) } }

.bar { height: 6px; background: #eef0f5; border-radius: 4px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: linear-gradient(90deg, var(--brand), #7b8bff); border-radius: 4px; }

.kv { display: grid; grid-template-columns: 120px 1fr; gap: 8px 12px; font-size: 13px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-family: var(--mono); font-size: 12.5px; word-break: break-all; }

.mono { font-family: var(--mono); }
.muted { color: var(--muted); }
.nowrap { white-space: nowrap; }

/* ---------------------------------------------------------------- 对话 */

.chat-shell {
  display: flex; flex-direction: column;
  height: calc(100vh - 210px); min-height: 440px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: var(--shadow-1); overflow: hidden;
}

.chat-bar {
  display: flex; align-items: center; gap: 9px; padding: 9px 16px;
  border-bottom: 1px solid var(--line-soft); background: #fcfcfe;
  font-size: 12.5px; color: var(--muted); flex: 0 0 auto;
}
.chat-bar .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 7px #17a67366; }
.chat-bar .dot.off { background: var(--warn); box-shadow: 0 0 7px #e0a01555; }
.chat-bar .spacer { flex: 1; }
.chat-bar b { color: var(--ink-2); font-weight: 600; }

.chat-log { flex: 1; overflow-y: auto; padding: 22px 22px 6px; background: #fbfbfd; }
.chat-log::-webkit-scrollbar { width: 8px; }
.chat-log::-webkit-scrollbar-thumb { background: #dde1e9; border-radius: 4px; }

.chat-empty { padding: 48px 20px; text-align: center; color: var(--muted); font-size: 13px; }
.chat-empty .mark { margin: 0 auto 14px; }
.chat-empty strong { display: block; color: var(--ink-2); font-size: 15px; margin-bottom: 6px; }
.chat-hints { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 18px; }
.chat-hints button {
  border: 1px solid var(--line); background: #fff; color: var(--ink-2);
  padding: 7px 12px; border-radius: 20px; font-size: 12.5px; cursor: pointer;
  transition: all .12s;
}
.chat-hints button:hover { border-color: var(--brand); color: var(--brand-ink); background: #f8f9ff; }

.msg { display: flex; gap: 10px; margin-bottom: 20px; align-items: flex-start; }
.msg.me { flex-direction: row-reverse; }
.msg .ava {
  width: 30px; height: 30px; border-radius: 9px; flex: 0 0 auto;
  background: linear-gradient(145deg, #1b2030, #0e1116); color: #fff;
  display: grid; place-items: center; font-size: 13px; font-weight: 700;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.14);
}
.msg .body { max-width: min(680px, 78%); min-width: 0; }
.msg .bubble {
  padding: 11px 15px; border-radius: 14px; font-size: 14px; line-height: 1.75;
  word-break: break-word;
}
.msg.abu .bubble {
  background: #fff; border: 1px solid var(--line);
  border-top-left-radius: 4px; box-shadow: var(--shadow-1); color: #1d222b;
}
.msg.me .bubble { background: var(--brand); color: #fff; border-top-right-radius: 4px; white-space: pre-wrap; }
.msg.system { justify-content: center; }
.msg.system .bubble {
  background: #fdf6e6; border: 1px solid #f4e4bb; color: #8a5f08;
  font-size: 12.5px; border-radius: 8px; max-width: 100%;
}
.msg .meta { font-size: 11px; color: var(--muted); margin-top: 5px; font-family: var(--mono); }
.msg.me .meta { text-align: right; }

.msg .bubble.md > :first-child { margin-top: 0; }
.msg .bubble.md > :last-child { margin-bottom: 0; }
.msg .bubble.md p { margin: 8px 0; }
.msg .bubble.md ul, .msg .bubble.md ol { padding-left: 20px; margin: 8px 0; }
.msg .bubble.md li { margin: 3px 0; }
.msg .bubble.md code {
  font-family: var(--mono); font-size: 12.5px; background: #f2f4f8;
  padding: 1px 5px; border-radius: 4px; color: #b53a6e; border: 1px solid #e9ecf2;
}
.msg .bubble.md pre {
  background: #0f1319; color: #dfe4ee; padding: 12px 14px; border-radius: 8px;
  overflow-x: auto; font-size: 12.4px; line-height: 1.65; margin: 10px 0;
  border: 1px solid #1d2430;
}
.msg .bubble.md pre code { background: none; border: 0; padding: 0; color: inherit; font-size: inherit; }
.msg .bubble.md table { border-collapse: collapse; width: 100%; margin: 10px 0; font-size: 12.8px; }
.msg .bubble.md th, .msg .bubble.md td { border: 1px solid var(--line); padding: 6px 10px; text-align: left; }
.msg .bubble.md th { background: #f8f9fc; font-weight: 650; }
.msg .bubble.md blockquote {
  margin: 10px 0; padding: 8px 14px; border-left: 3px solid var(--brand);
  background: #f7f8ff; border-radius: 0 6px 6px 0; color: var(--ink-2);
}
.msg .bubble.md a { word-break: break-all; }

.typing { display: inline-flex; gap: 4px; align-items: center; padding: 15px 16px; }
.typing i {
  width: 6px; height: 6px; border-radius: 50%; background: #b9c0cf;
  animation: blink 1.15s infinite ease-in-out;
}
.typing i:nth-child(2) { animation-delay: .16s; }
.typing i:nth-child(3) { animation-delay: .32s; }
@keyframes blink { 0%, 80%, 100% { opacity: .3; transform: translateY(0) } 40% { opacity: 1; transform: translateY(-2px) } }

.chat-composer { flex: 0 0 auto; padding: 12px 16px 6px; border-top: 1px solid var(--line-soft); background: #fff; }
.chat-composer .box { display: flex; gap: 10px; align-items: flex-end; }

/* 允许动手：默认关，开启后本轮流式执行仍走 agent150 的黑名单与留痕 */
.chat-tools { display: flex; align-items: center; gap: 9px; padding: 0 2px 9px; }
.chat-tool {
  display: inline-flex; align-items: center; gap: 7px; height: 27px; padding: 0 11px 0 9px;
  border-radius: 999px; border: 1px solid var(--line); background: #fff; color: var(--ink-2);
  font: inherit; font-size: 12px; cursor: pointer; transition: background .12s, border-color .12s, color .12s;
}
.chat-tool:hover:not(:disabled) { border-color: #cfd4de; }
.chat-tool .sw {
  position: relative; width: 22px; height: 12px; border-radius: 99px;
  background: #dcdfe6; transition: background .12s;
}
.chat-tool .sw::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 8px; height: 8px;
  border-radius: 50%; background: #fff; transition: left .12s;
}
.chat-tool.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.chat-tool.on .sw { background: rgba(255, 255, 255, .38); }
.chat-tool.on .sw::after { left: 12px; }
.chat-tool:disabled { opacity: .42; cursor: not-allowed; }
.chat-tools-tip { font-size: 11.5px; color: var(--muted); }
.hand-tag {
  display: inline-block; margin-left: 6px; padding: 0 6px; height: 16px; line-height: 16px;
  border-radius: 4px; font-size: 11px; background: var(--brand-soft); color: var(--brand-ink);
  vertical-align: 1px;
}
.chat-input {
  flex: 1; min-height: 44px; max-height: 180px; resize: none; overflow-y: auto;
  padding: 11px 13px; border: 1px solid var(--line); border-radius: 10px;
  background: #fbfbfd; font-size: 14px; line-height: 1.6; outline: none;
  transition: border-color .12s, box-shadow .12s;
}
.chat-input:focus { border-color: var(--brand); background: #fff; box-shadow: 0 0 0 3px rgba(75,92,245,.09); }
.chat-input::placeholder { color: #a8b0be; }
.chat-send { height: 44px; padding: 0 20px; border-radius: 10px; flex: 0 0 auto; }
.chat-send.chat-stop { background: var(--err); border-color: var(--err); color: #fff; }
.chat-send.chat-stop:hover { background: #c0392f; border-color: #c0392f; color: #fff; }
.chat-foot {
  padding: 0 16px 11px; font-size: 11.5px; color: var(--muted);
  display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
}

/* ---------------------------------------------------------------- MCP 页 */

.mcp-endpoint { display: flex; gap: 8px; align-items: stretch; }
.mcp-endpoint code {
  flex: 1; min-width: 0; overflow: auto; white-space: nowrap;
  background: #0f131b; color: #cfe0ff; border: 1px solid #1c2333;
  border-radius: 8px; padding: 9px 12px; font-family: var(--mono); font-size: 12.5px;
  display: flex; align-items: center;
}
.mcp-sec {
  font-size: 12px; font-weight: 650; color: var(--muted);
  letter-spacing: .3px; margin: 18px 0 8px; text-transform: uppercase;
}
.codeblock {
  margin: 0; background: #0f131b; color: #cfe0ff; border: 1px solid #1c2333;
  border-radius: 8px; padding: 12px 14px; overflow: auto;
  font-family: var(--mono); font-size: 12px; line-height: 1.7;
}
.tool-list { display: flex; flex-direction: column; gap: 6px; }
.tool-item {
  display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap;
  padding: 7px 10px; border: 1px solid var(--line-soft);
  border-radius: 8px; background: #fbfcfe;
}
.tool-item b { font-family: var(--mono); font-size: 12.5px; color: var(--brand-ink); font-weight: 600; }
.tool-item span { color: var(--muted); font-size: 12px; flex: 1; min-width: 0; }
.mcp-flash { margin-top: 14px; font-size: 12.5px; color: var(--muted); }
.mcp-flash.ok { color: var(--ok); }
.mcp-flash.err { color: var(--err); }
.badge {
  display: inline-block; margin-left: 6px; font-size: 11px; font-weight: 600;
  padding: 1px 6px; border-radius: 5px; background: var(--brand-soft); color: var(--brand-ink);
}
.card-foot {
  display: flex; gap: 12px; align-items: baseline; justify-content: space-between;
  padding: 10px 16px; border-top: 1px solid var(--line-soft);
  font-size: 11.5px; color: var(--muted);
}
.card-foot code { font-family: var(--mono); font-size: 11.5px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.actions-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.chk { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-2); cursor: pointer; }
.chk input { width: 15px; height: 15px; accent-color: var(--brand); }
[hidden] { display: none !important; }

@media (max-width: 1080px) {
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-2 { grid-template-columns: 1fr; }
  .doc-wrap { grid-template-columns: 1fr; }
  .side-panel { position: static; }
  .editor-grid { grid-template-columns: 1fr; }
  .meta-card { position: static; }
  .split { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
  .sidebar { display: none; }
  .content { padding: 18px 16px 60px; }
  .topbar { padding: 0 16px; }
  .prose { padding: 22px 18px 28px; }
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .page-head { flex-direction: column; }
  .page-head .actions { margin-left: 0; }
}
