/* ============================================================
   Enhanced CSS — 内容渲染 / 推理可视化 / 交互操作 / 多模态
   依赖 style.css 的变量体系，仅追加新组件样式
   ============================================================ */

/* ============ 1. 内容渲染 ============ */

/* 代码块（带语言标签 + 复制按钮） */
.code-block {
  position: relative;
  margin: 14px 0;
  border: 1px solid var(--hairline);
  border-radius: 10px;
  overflow: hidden;
  background: var(--bg-code);
}
.code-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 30px;
  padding: 4px 10px;
  font-size: 11px;
  color: var(--text-tertiary);
  border-bottom: 1px solid var(--hairline);
  background: color-mix(in srgb, var(--bg-code) 88%, var(--bg-hover));
}
.code-lang {
  font-family: "SF Mono", "Consolas", monospace;
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.05em;
}
.code-copy {
  background: transparent;
  border: 0;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 3px 4px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font: inherit;
  font-size: 11px;
  line-height: 1.2;
}
.code-copy .oc-icon { width: 13px; height: 13px; }
.code-copy:hover { background: var(--bg-active); color: var(--text); }
.code-copy.copied { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 40%, var(--hairline)); }
.katex-display { position: relative; }
.table-wrap { position: relative; }
.katex-display > .visual-actions,
.table-wrap > .visual-actions,
.mindmap-wrap > .visual-actions,
.mermaid-wrap > .visual-actions {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 2;
  display: flex;
  gap: 6px;
}
.artifact-open-btn {
  border: none;
  background: color-mix(in srgb, var(--accent) 10%, transparent);
  color: var(--accent);
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11.5px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: background 0.15s;
}
.artifact-open-btn:hover { background: color-mix(in srgb, var(--accent) 18%, transparent); }
.code-block pre {
  margin: 0 !important;
  overflow: auto;
  max-height: 480px;
  padding: 12px !important;
}
.code-block pre.code-collapsed { max-height: 160px; overflow: hidden; }
.code-expand {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 6px;
  border: none;
  background: linear-gradient(to top, var(--bg-code) 30%, transparent);
  color: var(--accent);
  font-size: 12px;
  cursor: pointer;
  padding-top: 24px;
}

/* Mermaid 图表 */
.mermaid-wrap {
  position: relative;
  margin: 14px 0;
  overflow-x: auto;
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  box-shadow: var(--shadow-xs);
  padding: 16px;
  text-align: center;
}
.mermaid-loading {
  color: var(--text-tertiary);
  font-size: 13px;
  padding: 24px;
}
.mermaid-error, .mermaid-unavailable {
  text-align: left;
  font-size: 13px;
  color: var(--text-tertiary);
  white-space: pre-wrap;
}
.mermaid-wrap svg { max-width: 100%; height: auto; }
.mermaid-wrap .nodeLabel,
.mermaid-wrap .edgeLabel,
.mermaid-wrap .label {
  font-family: inherit;
}
.mermaid-wrap .edgeLabel,
.mermaid-wrap .edgeLabel rect {
  fill: var(--bg-surface);
}
.mermaid-wrap .node rect,
.mermaid-wrap .cluster rect,
.mermaid-wrap .actor {
  stroke: none;
}

/* 思维导图：从左向右的树枝，连线贴在节点中线 */
.mindmap-wrap {
  position: relative;
  margin: 14px 0;
  overflow: auto;
  max-height: min(70vh, 640px);
  padding: 16px 18px;
  border: 1px solid var(--hairline);
  border-radius: 16px;
  background:
    radial-gradient(circle at 1px 1px, color-mix(in srgb, var(--text) 10%, transparent) 1px, transparent 0) 0 0 / 18px 18px,
    var(--bg-surface);
}
.mindmap-tree { min-width: min-content; }
.mindmap-empty {
  color: var(--text-tertiary);
  font-size: 13px;
  padding: 16px;
  text-align: center;
}
.mm-root, .mm-children {
  list-style: none;
  margin: 0;
  padding: 0;
}
.mm-root { display: flex; }
.mm-node {
  display: flex;
  flex-direction: row;
  align-items: center;
  position: relative;
}
.mm-children {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 8px;
  margin: 0;
  padding: 0 0 0 28px;
  position: relative;
}
.mm-card {
  position: relative;
  z-index: 1;
  flex: 0 0 auto;
  max-width: 240px;
  padding: 7px 12px;
  border-radius: 10px;
  border: 1px solid var(--hairline);
  background: var(--bg-app);
  text-align: left;
  box-shadow: none;
}
.mm-d0 > .mm-card {
  border-color: transparent;
  background: var(--text);
  color: var(--bg-app);
  font-weight: 650;
  border-radius: 12px;
  padding: 9px 14px;
}
.mm-d0 > .mm-card .mm-title { color: var(--bg-app); }
.mm-d0 > .mm-card .mm-note { color: var(--bg-app); opacity: 0.72; }
.mm-d1 > .mm-card {
  background: var(--brand-soft, color-mix(in srgb, var(--brand) 12%, var(--bg-app)));
  border-color: color-mix(in srgb, var(--brand) 28%, var(--hairline));
}
.mm-title {
  display: block;
  color: var(--text);
  font-size: 13.5px;
  line-height: 1.35;
  word-break: break-word;
}
.mm-note {
  display: block;
  margin-top: 2px;
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.35;
  font-weight: 400;
}
.mm-node.has-kids > .mm-card::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 100%;
  width: 14px;
  height: 1.5px;
  background: color-mix(in srgb, var(--brand) 55%, var(--hairline));
}
.mm-children > .mm-node > .mm-card::before {
  content: "";
  position: absolute;
  top: 50%;
  right: 100%;
  width: 14px;
  height: 1.5px;
  background: color-mix(in srgb, var(--brand) 55%, var(--hairline));
}
.mm-children > .mm-node::before {
  content: "";
  position: absolute;
  left: -14px;
  top: 0;
  bottom: 0;
  width: 1.5px;
  background: color-mix(in srgb, var(--brand) 55%, var(--hairline));
}
.mm-children > .mm-node:first-child::before { top: 50%; }
.mm-children > .mm-node:last-child::before { bottom: 50%; }
.mm-children > .mm-node:only-child::before { display: none; }

.msg.assistant .md-prose [style] {
  max-width: 100%;
}
.msg.assistant .md-prose .html-present,
.msg.assistant .md-prose .html-present-row {
  margin: 12px 0;
}
.msg.assistant .md-prose .html-present-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: stretch;
}
.msg.assistant .md-prose .html-present-row > * {
  flex: 1 1 240px;
  min-width: 0;
  box-sizing: border-box;
}
.msg.assistant .md-prose .html-present > .html-present-row {
  margin: 0;
}

/* 表格容器 */
.table-wrap {
  overflow-x: auto;
  margin: 12px 0;
  border-radius: var(--radius-sm);
  border: 1px solid var(--hairline);
}
.table-wrap table { margin: 0; }

/* 表格排序 */
.table-wrap th.sortable {
  cursor: pointer;
  user-select: none;
  position: relative;
  padding-right: 18px;
}
.table-wrap th.sortable::after {
  content: "↕";
  position: absolute;
  right: 5px;
  opacity: 0.35;
  font-size: 10px;
}
.table-wrap th.sort-asc::after { content: "↑"; opacity: 1; color: var(--accent); }
.table-wrap th.sort-desc::after { content: "↓"; opacity: 1; color: var(--accent); }
.table-wrap th.sortable:hover { background: var(--bg-active); }

/* 图片（灯箱） */
.md-image { margin: 12px 0; text-align: center; }
.md-image img {
  max-width: 100%;
  max-height: 420px;
  border-radius: var(--radius-md);
  cursor: zoom-in;
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s;
}
.md-image img:hover { transform: scale(1.005); }
.md-image figcaption {
  font-size: 12.5px;
  color: var(--text-tertiary);
  margin-top: 6px;
}
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  z-index: 9998;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
  backdrop-filter: blur(6px);
}
.lightbox.show { opacity: 1; pointer-events: auto; }
.lightbox img {
  max-width: 92vw;
  max-height: 88vh;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
}
.lightbox-close {
  position: absolute;
  top: 20px;
  right: 24px;
  background: rgba(255, 255, 255, 0.15);
  border: none;
  color: #fff;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 16px;
}

/* 引用块增强 */
.msg.assistant blockquote {
  background: var(--bg-hover);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

/* 任务列表 checkbox */
.msg.assistant input[type="checkbox"] {
  width: 15px;
  height: 15px;
  margin-right: 7px;
  accent-color: var(--accent);
  vertical-align: -2px;
}

/* 脚注 */
.footnotes { font-size: 13px; color: var(--text-tertiary); }
.footnotes hr { display: none; }

/* 未知组件 */
.unknown-component {
  border: 1px dashed var(--hairline-strong);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 13px;
  color: var(--text-tertiary);
}

/* ============ 2. 推理可视化 ============ */

/* 思维链容器 */
.reasoning-wrap {
  border-radius: var(--radius-md);
  background: var(--bg-hover);
  margin: 12px 0;
  overflow: hidden;
}
.reasoning-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  cursor: pointer;
  user-select: none;
  font-size: 13px;
  color: var(--text-secondary);
}
.reasoning-header:hover { background: var(--bg-active); }
.reasoning-icon { color: var(--text-tertiary); display: flex; }
.reasoning-title { font-weight: 600; flex: 1; }
.reasoning-count {
  font-size: 11px;
  background: var(--bg-active);
  padding: 1px 8px;
  border-radius: 999px;
}
.reasoning-chev { transition: transform 0.2s; display: flex; color: var(--text-tertiary); }
.reasoning-wrap.open .reasoning-chev { transform: rotate(180deg); }
.reasoning-steps {
  padding: 4px 14px 12px;
  border-top: 1px solid var(--hairline);
}
.reasoning-step {
  border-left: 2px solid var(--hairline-strong);
  margin: 8px 0;
  padding-left: 12px;
}
.reasoning-step summary {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text);
  list-style: none;
  padding: 3px 0;
}
.reasoning-step summary::-webkit-details-marker { display: none; }
.step-num {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--bg-active);
  font-size: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.step-toggle { margin-left: auto; color: var(--text-tertiary); font-size: 11px; }
.reasoning-body {
  font-size: 13.5px;
  color: var(--text-secondary);
  padding: 6px 0 4px;
}

/* 工具调用卡片 */
.tool-call {
  border-radius: var(--radius-md);
  background: var(--bg-hover);
  margin: 10px 0;
  overflow: hidden;
}
.tool-call-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text-secondary);
  user-select: none;
}
.tool-call-header:hover { background: var(--bg-active); }
.tool-icon { color: var(--accent); display: flex; }
.tool-name { font-weight: 600; flex: 1; }
.tool-status {
  font-size: 11px;
  background: var(--danger-bg);
  color: var(--danger);
  padding: 1px 8px;
  border-radius: 999px;
}
.tool-call-body {
  padding: 4px 14px 12px;
  border-top: 1px solid var(--hairline);
  font-size: 13px;
}
.tool-section-title {
  font-size: 12px;
  color: var(--text-tertiary);
  margin: 8px 0 4px;
  font-weight: 600;
}
.tool-section .code-block { margin: 4px 0; font-size: 12.5px; }

/* 多阶段思考状态 */
.phase-indicator {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  border-radius: 999px;
  background: var(--bg-hover);
  color: var(--text-secondary);
  font-size: 13px;
  margin: 8px 0;
}
.phase-spinner {
  width: 14px;
  height: 14px;
  border: 2px solid var(--hairline-strong);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ============ 3. 消息操作栏 ============ */
.msg-actions {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-top: 6px;
  opacity: 0.45;
  transition: opacity 0.15s;
}
.msg-actions:hover { opacity: 1; }
.msg-action {
  background: none;
  border: none;
  color: var(--text-tertiary);
  cursor: pointer;
  padding: 5px 7px;
  border-radius: 8px;
  display: flex;
  align-items: center;
}
.msg-action:hover { background: var(--bg-hover); color: var(--text); }
.msg-action.active { color: var(--accent); }
.msg-action[data-vote="down"].active { color: var(--danger); }

/* 快捷指令按钮 */
.quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}
.quick-action {
  background: var(--bg-hover);
  border: none;
  color: var(--text-secondary);
  padding: 5px 13px;
  border-radius: 999px;
  font-size: 12.5px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.quick-action:hover { background: var(--bg-active); color: var(--text); }

/* 编辑模式 */
.msg-edit-area {
  width: 100%;
  border: none;
  border-radius: var(--radius-sm);
  background: var(--bg-code);
  padding: 12px 14px;
  font-family: inherit;
  font-size: 14px;
  color: var(--text);
  resize: vertical;
  outline: none;
  line-height: 1.6;
}
.msg-edit-row {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  justify-content: flex-end;
}

/* 跟进建议（纵向列表，位于消息下方） */
.follow-ups {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px dashed var(--hairline-strong);
  max-width: 100%;
}
.follow-ups-label {
  font-size: 12px;
  color: var(--text-tertiary);
  margin-bottom: 6px;
  font-weight: 500;
}
.follow-up-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  background: none;
  border: none;
  color: var(--text-secondary);
  padding: 7px 8px;
  border-radius: 8px;
  font-size: 13.5px;
  cursor: pointer;
  transition: all 0.15s;
  text-align: left;
  width: 100%;
  line-height: 1.5;
}
.follow-up-btn::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-tertiary);
  flex-shrink: 0;
  transition: background 0.15s;
}
.follow-up-btn:hover {
  background: var(--bg-hover);
  color: var(--text);
}
.follow-up-btn:hover::before { background: var(--accent); }

/* ============ 4. 侧边栏会话增强 ============ */
.chat-search {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 4px 6px 8px;
  padding: 7px 12px;
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  box-shadow: var(--shadow-xs);
}
.chat-search svg { color: var(--text-tertiary); flex-shrink: 0; }
.chat-search input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  font-size: 13px;
  color: var(--text);
  font-family: inherit;
}
.chat-search input::placeholder { color: var(--text-tertiary); }
.chat-item-wrap { position: relative; }
.chat-item-menu {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  gap: 2px;
  background: var(--bg-surface);
  border-radius: 8px;
  padding: 2px;
  box-shadow: var(--shadow-sm);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.12s;
}
.chat-item-wrap:hover .chat-item-menu,
.chat-item-wrap:focus-within .chat-item-menu {
  opacity: 1;
  pointer-events: auto;
}
.chat-item-menu .menu-btn {
  background: none;
  border: none;
  font-size: 13px;
  cursor: pointer;
  padding: 3px 5px;
  border-radius: 5px;
  line-height: 1;
}
.chat-item-menu .menu-btn:hover { background: var(--bg-hover); }
.chat-item-menu .menu-btn.danger:hover { background: var(--danger-bg); }
.pin-mark { font-size: 12px; flex-shrink: 0; }
.chat-item.active .chat-item-menu { display: flex; }
.chat-list-empty {
  color: var(--text-tertiary);
  font-size: 13px;
  text-align: center;
  padding: 24px 12px;
}
.rename-input {
  flex: 1;
  border: none;
  outline: none;
  background: var(--bg-surface);
  border-radius: 6px;
  font-size: 13px;
  color: var(--text);
  padding: 2px 6px;
  font-family: inherit;
  box-shadow: var(--shadow-xs);
}

/* ============ 5. 多模态 ============ */
/* 附件按钮 */
.composer-left {
  display: flex;
  align-items: flex-end;
  gap: 2px;
}
.attach-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-tertiary);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  flex-shrink: 0;
}
.attach-btn:hover { background: var(--bg-hover); color: var(--text); }
.attach-previews {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 4px 8px;
  max-width: 800px;
  margin: 0 auto;
}
.file-card {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px 7px 8px;
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  box-shadow: var(--shadow-xs);
  font-size: 12.5px;
  max-width: 220px;
}
.file-card .fc-icon {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  flex-shrink: 0;
}
.file-card .fc-info { min-width: 0; }
.file-card .fc-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text);
  font-weight: 500;
}
.file-card .fc-size { font-size: 11px; color: var(--text-tertiary); }
.file-card .fc-remove {
  background: none;
  border: none;
  color: var(--text-tertiary);
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 4px;
  font-size: 13px;
  flex-shrink: 0;
}
.file-card .fc-remove:hover { color: var(--danger); }
.attach-img-preview {
  position: relative;
  border-radius: var(--radius-sm);
  overflow: hidden;
  box-shadow: var(--shadow-xs);
}
.attach-img-preview img { width: 64px; height: 64px; object-fit: cover; display: block; }
.attach-img-preview .fc-remove {
  position: absolute;
  top: 3px;
  right: 3px;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  border: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 11px;
  line-height: 1;
}

/* 用户消息中的图片/附件 */
.msg.user .attach-inline { margin: 8px 0; }

/* Artifacts 面板 */
.artifact-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(560px, 92vw);
  background: var(--bg-surface);
  box-shadow: var(--shadow-lg);
  z-index: 1500;
  transform: translateX(105%);
  transition: transform 0.28s cubic-bezier(0.2, 0.8, 0.2, 1);
  display: flex;
  flex-direction: column;
}
.artifact-panel.show { transform: translateX(0); }
.artifact-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--hairline);
  flex-shrink: 0;
}
.artifact-title { font-weight: 650; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.artifact-actions { display: flex; gap: 6px; }
.artifact-btn {
  border: none;
  background: var(--bg-hover);
  color: var(--text-secondary);
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 12.5px;
  cursor: pointer;
}
.artifact-btn:hover { background: var(--bg-active); color: var(--text); }
.artifact-body { flex: 1; overflow: auto; position: relative; }
.artifact-frame { width: 100%; height: 100%; border: none; background: #fff; }
.artifact-code {
  margin: 0;
  padding: 16px;
  font-size: 13px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: "SF Mono", "Consolas", monospace;
  color: var(--text);
}
.artifact-svg { padding: 16px; display: flex; justify-content: center; }
.artifact-text { padding: 18px; font-size: 14px; color: var(--text); line-height: 1.7; }

/* 语音按钮 */
.voice-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-tertiary);
  cursor: pointer;
  transition: all 0.15s;
  flex-shrink: 0;
  background: none;
  border: none;
}
.voice-btn:hover { background: var(--bg-hover); color: var(--text); }
.voice-btn.recording {
  color: #fff;
  background: var(--danger);
  animation: pulse 1.2s infinite;
}
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 59, 48, 0.4); }
  50% { box-shadow: 0 0 0 6px rgba(255, 59, 48, 0); }
}

/* 打字光标（流式） */
.stream-cursor {
  display: inline-block;
  width: 2px;
  height: 1em;
  background: var(--accent);
  vertical-align: -2px;
  margin-left: 2px;
  animation: blinkCursor 0.9s infinite;
}
@keyframes blinkCursor { 0%, 49% { opacity: 1; } 50%, 100% { opacity: 0; } }

/* 虚拟列表占位（长对话自动分页加载） */
.msgs-pagination { text-align: center; padding: 8px; }
.msgs-pagination button {
  border: none;
  background: var(--bg-hover);
  color: var(--text-secondary);
  padding: 8px 20px;
  border-radius: 999px;
  font-size: 13px;
  cursor: pointer;
}
.msgs-pagination button:hover { background: var(--bg-active); color: var(--text); }

/* 深色模式下 highlight.js 主题切换 */
[data-theme="dark"] .hljs { background: transparent; }
[data-theme="light"] .hljs { background: transparent; }

/* ============ 6. 小屏适配 ============ */
@media (max-width: 768px) {
  .artifact-panel { width: 100vw; }
  .quick-actions { gap: 4px; }
  .quick-action { font-size: 12px; padding: 4px 10px; }
}

/* 来源引用 */
.cite-badge {
  display: inline-flex;
  align-items: center;
  padding: 0 5px;
  margin: 0 2px;
  border-radius: 999px;
  background: var(--bg-active);
  color: var(--text-secondary);
  font-size: 10.5px;
  font-weight: 600;
  cursor: pointer;
  vertical-align: super;
  line-height: 1.5;
  transition: all 0.15s;
  user-select: none;
}
.cite-badge:hover { background: color-mix(in srgb, var(--accent) 15%, transparent); color: var(--accent); }
.reply-cost {
  display: block;
  font-size: 11px;
  color: var(--text-tertiary);
  margin-top: 8px;
  user-select: none;
}
.cite-sources {
  margin-top: 14px;
  padding-top: 10px;
  border-top: 1px dashed var(--hairline-strong);
}
.cite-sources-title {
  font-size: 12px;
  color: var(--text-tertiary);
  font-weight: 600;
  margin-bottom: 8px;
}
.cite-source {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 13px;
  color: var(--text-secondary);
  text-decoration: none;
  transition: background 0.15s;
}
.cite-source:hover { background: var(--bg-hover); color: var(--text); }
.cite-num {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--bg-active);
  color: var(--text-secondary);
  font-size: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.cite-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cite-source.flash { background: color-mix(in srgb, var(--accent) 12%, transparent); }

/* ============ 7. 空状态建议 ============ */
.empty-suggests {
  display: grid;
  grid-template-columns: repeat(2, minmax(150px, 1fr));
  gap: 10px;
  margin-top: 22px;
  max-width: 520px;
  width: 100%;
}
.empty-suggest {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  border: 1px solid var(--hairline);
  box-shadow: var(--shadow-xs);
  color: var(--text-secondary);
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  transition: all 0.15s;
}
.empty-suggest:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--hairline-strong);
  color: var(--text);
  transform: translateY(-1px);
}
@media (max-width: 480px) {
  .empty-suggests { grid-template-columns: 1fr; }
}
/* 错误重试 */
.msg-retry-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
}
.msg-retry-row .btn {
  border: 1px solid var(--hairline-strong);
  background: var(--bg-surface);
  color: var(--text-secondary);
}
.msg-retry-row .btn:hover {
  background: var(--bg-hover);
  color: var(--text);
  border-color: var(--text-tertiary);
}

/* ============================================================
   8. 设置弹窗(页签 / 账户 / 偏好)
   ============================================================ */
.modal-lg { width: min(680px, 94vw); }

.settings-tabs {
  display: flex;
  gap: 4px;
  padding: 0 22px 12px;
  border-bottom: 1px solid var(--hairline);
}
.settings-tab {
  border: none;
  background: transparent;
  padding: 7px 16px;
  border-radius: 999px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s, color 0.15s;
}
.settings-tab:hover { background: var(--bg-hover); color: var(--text); }
.settings-tab.active { background: var(--bg-active); color: var(--text); font-weight: 600; }

.settings-panel { display: none; }
.settings-panel.active { display: block; animation: panelIn 0.18s ease; }

/* 账户面板 */
.acc-head {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 0 18px;
}
.avatar-lg { width: 52px; height: 52px; font-size: 20px; }
.acc-head-meta { flex: 1; min-width: 0; }
.acc-name { font-size: 17px; font-weight: 650; }
.acc-quota-badge {
  padding: 8px 16px;
  border-radius: 999px;
  background: var(--bg-hover);
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text);
}

/* 偏好面板 */
.pref-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 13px 4px;
  border-bottom: 1px solid var(--hairline);
  cursor: pointer;
}
.pref-row:last-of-type { border-bottom: none; }
.pref-info { min-width: 0; }
.pref-name { font-size: 14.5px; font-weight: 550; }
.pref-desc { font-size: 12.5px; color: var(--text-tertiary); margin-top: 3px; }

.theme-seg {
  display: inline-flex;
  background: var(--bg-hover);
  border-radius: 999px;
  padding: 3px;
  flex-shrink: 0;
}
.stepper {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  background: var(--bg-hover);
  border-radius: 999px;
  padding: 3px;
  flex-shrink: 0;
}
.stepper .seg-btn { min-width: 32px; padding: 6px 10px; }
.stepper-field { width: 100%; justify-content: space-between; }
.stepper-field input { flex: 1; }
.stepper input {
  width: 52px;
  border: none;
  background: transparent;
  text-align: center;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  padding: 4px 0;
  outline: none;
}
.seg-btn {
  border: none;
  background: transparent;
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s, color 0.15s;
}
.seg-btn.active { background: var(--bg-surface); color: var(--text); box-shadow: var(--shadow-xs); font-weight: 600; }

/* ============================================================
   9. 确认弹窗(UI.confirm)
   ============================================================ */
.oc-confirm-mask { z-index: 3000; }
.modal-sm { width: min(400px, 92vw); }
.confirm-message { font-size: 14.5px; line-height: 1.7; color: var(--text-secondary); }
.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 4px 22px 22px;
}

/* ============================================================
   10. 管理后台:日志 / 趋势 / 搜索
   ============================================================ */
.admin-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.admin-toolbar .search-input {
  flex: 1;
  min-width: 200px;
  padding: 9px 14px;
  border: none;
  border-radius: 999px;
  background: var(--bg-hover);
  color: var(--text);
  font-size: 13.5px;
  font-family: inherit;
  outline: none;
}
.admin-toolbar .search-input:focus { box-shadow: 0 0 0 3px var(--hairline-strong); }

/* 调用趋势(纯 CSS 柱状图) */
.trend-chart {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  height: 120px;
  padding: 12px 4px 0;
}
.trend-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  min-width: 0;
}
.trend-bar {
  width: 100%;
  max-width: 34px;
  border-radius: 6px 6px 3px 3px;
  background: linear-gradient(180deg, var(--accent), color-mix(in srgb, var(--accent) 55%, transparent));
  min-height: 3px;
  transition: opacity 0.15s;
  position: relative;
}
.trend-col:hover .trend-bar { opacity: 0.8; }
.trend-bar .trend-val {
  position: absolute;
  top: -20px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  opacity: 0;
  white-space: nowrap;
  transition: opacity 0.15s;
}
.trend-col:hover .trend-val { opacity: 1; }
.trend-label { font-size: 11px; color: var(--text-tertiary); white-space: nowrap; }
.trend-empty { color: var(--text-tertiary); font-size: 13px; text-align: center; padding: 30px 0; }

/* 指标行 */
.meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 22px;
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 6px;
}
.meta-row b { color: var(--text); font-weight: 600; }

/* 顶部用户徽标与额度 */
.mini-users { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.mini-user {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 13.5px;
  padding: 8px 12px;
  border-radius: 10px;
  background: var(--bg-surface-2);
}
.mini-user .mu-name { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini-user .mu-quota { color: var(--text-secondary); flex-shrink: 0; font-variant-numeric: tabular-nums; }

/* ============================================================
   11. 运行日志
   ============================================================ */
.log-filters {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.log-filter-btn {
  border: 1px solid var(--hairline);
  background: var(--bg-surface);
  color: var(--text-secondary);
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 12.5px;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.15s;
}
.log-filter-btn:hover { background: var(--bg-hover); color: var(--text); }
.log-filter-btn.active { background: var(--text); color: var(--bg-surface); border-color: var(--text); }

.log-table { font-size: 13px; }
.log-table th, .log-table td { padding: 9px 12px; }
.log-table td { font-variant-numeric: tabular-nums; }
.log-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
}
.log-badge.chat { background: color-mix(in srgb, var(--accent) 10%, transparent); color: var(--accent); }
.log-badge.auth { background: var(--bg-active); color: var(--text-secondary); }
.log-badge.err { background: var(--danger-bg); color: var(--danger); }
.log-status { font-weight: 600; }
.log-status.ok { color: var(--accent); }
.log-status.fail { color: var(--danger); }
.log-msg { color: var(--text-tertiary); max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ============================================================
   12. 模型选择器 / 顶栏增强
   ============================================================ */
.model-picker .provider-chip { display: flex; }
.model-picker .provider-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); flex-shrink: 0; }
.provider-chip .pc-format {
  font-size: 11px;
  color: var(--text-tertiary);
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--bg-active);
  margin-left: 4px;
}

/* 流式文本占位 */
.stream-inline { white-space: pre-wrap; word-break: break-word; }
.md-streaming .stream-cursor { margin-left: 3px; }
.stream-cursor {
  display: inline-block;
  width: 2px;
  height: 1em;
  vertical-align: -0.15em;
  margin-left: 2px;
  background: var(--text-secondary);
  animation: ocBlink 1s step-end infinite;
}
@keyframes ocBlink { 0%, 100% { opacity: 1; } 50% { opacity: 0; } }

/* 回复耗时 / 分页 */
.reply-cost {
  flex-basis: 100%;
  font-size: 12px;
  color: var(--text-tertiary);
  margin-top: 6px;
}
.msgs-pagination { text-align: center; padding: 10px 0; }
.msgs-pagination button {
  border: 1px solid var(--hairline);
  background: var(--bg-surface);
  color: var(--text-secondary);
  border-radius: 999px;
  padding: 8px 18px;
  font-size: 13px;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s;
}
.msgs-pagination button:hover { border-color: var(--text-tertiary); color: var(--text); }

/* ============================================================
   13. 侧边栏:Logo 品牌区 + 模型选择器
   ============================================================ */
.sidebar-brand {
  display: flex;
  align-items: center;
  padding: 18px 20px 6px;
  overflow: hidden;
}
.brand-logo {
  max-width: 160px;
  max-height: 44px;
  object-fit: contain;
  display: block;
}
.brand-logo-light { display: block; }
.brand-logo-dark { display: none; }
[data-theme="dark"] .brand-logo-light { display: none; }
[data-theme="dark"] .brand-logo-dark { display: block; }

/* 侧边栏内的模型选择器(胶囊,同款式但适配侧边栏宽度) */
.sidebar-model-wrap {
  padding: 4px 12px 8px;
}
.sidebar-model-wrap .model-picker {
  width: 100%;
  justify-content: flex-start;
  background: var(--bg-hover);
  box-shadow: none;
  padding: 9px 13px;
  border-radius: var(--radius-md);
}
.sidebar-model-wrap .model-picker:hover {
  background: var(--bg-active);
  box-shadow: none;
}
.sidebar-model-wrap .model-name {
  flex: 1;
  max-width: none;
  font-size: 13.5px;
}
.sidebar-model-wrap .provider-chip { margin: 0; }
/* 回复耗时 / 分页等保持在原位置 */

/* ============================================================
   14. 补丁:缺失变量与后台表单控件
   ============================================================ */
:root, [data-theme="light"] { --border: rgba(0,0,0,0.1); --border-strong: rgba(0,0,0,0.2); }
[data-theme="dark"] { --border: rgba(255,255,255,0.12); --border-strong: rgba(255,255,255,0.24); }

/* 用户管理 toolbar 搜索输入更精致 */
.admin-toolbar .search-input {
  border-radius: 10px;
  height: 38px;
  padding: 0 14px;
  border: 1px solid var(--hairline);
  background: var(--bg-surface);
}
.admin-toolbar .search-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 12%, transparent);
}

/* 日志过滤器按钮(默认态要有明显边框,激活态清晰) */
.log-filters {
  gap: 6px;
}
.log-filter-btn {
  border: 1px solid var(--hairline-strong);
  background: var(--bg-surface);
  color: var(--text-secondary);
  font-weight: 500;
}
.log-filter-btn:hover {
  background: var(--bg-hover);
  color: var(--text);
  border-color: var(--text-tertiary);
}
.log-filter-btn.active {
  background: var(--text);
  color: var(--bg-surface);
  border-color: var(--text);
  font-weight: 600;
}

/* 趋势图:柱子加圆角与底部分隔,默认显示数值实体箭头 */
.trend-chart {
  gap: 10px;
  padding: 16px 4px 8px;
  border-bottom: 1px solid var(--hairline);
  margin-bottom: 14px;
}
.trend-bar {
  border-radius: 5px 5px 2px 2px;
  background: linear-gradient(180deg, var(--accent), color-mix(in srgb, var(--accent) 40%, transparent));
  min-width: 8px;
}
.trend-col:hover .trend-bar { opacity: 0.85; transform: scaleY(1.02); transform-origin: bottom; }
.trend-bar .trend-val {
  opacity: 1;
  top: -19px;
  font-weight: 600;
}
.trend-label { color: var(--text-tertiary); }

/* 迷你用户卡 */
.mini-user { background: var(--bg-surface-2); border: 1px solid var(--hairline); }

/* 概览 section-title 用于后台时保持同款 */
.admin-card .section-title { margin-top: 22px; }

/* ============================================================
   15. 顶栏:hamburger 桌面隐藏,移动端侧边栏遮罩 & 抽屉
   ============================================================ */
.hamburger-btn { display: none; }
.sidebar-mask {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 490;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
@media (max-width: 768px) {
  .hamburger-btn { display: inline-flex; }
  .sidebar {
    position: fixed;
    z-index: 500;
    height: 100%;
    box-shadow: var(--shadow-lg);
    transform: translateX(-100%);
    transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
  }
  .sidebar.mobile-open { transform: translateX(0); }
  .sidebar-mask.show { display: block; }
}

/* ============================================================
   16. 概览页:趋势图零值描点 / 运行信息卡片 / Top 用户美化
   ============================================================ */
/* 趋势图 */
.trend-chart {
  gap: 8px;
  padding: 18px 4px 10px;
  border-bottom: 1px solid var(--hairline);
  margin-bottom: 16px;
  min-height: 120px;
}
.trend-col { flex: 1; min-width: 0; max-width: 46px; }
.trend-bar {
  width: 100%;
  max-width: 30px;
  min-width: 6px;
  border-radius: 5px 5px 2px 2px;
  transition: opacity 0.15s, filter 0.15s;
}
.trend-col.has .trend-bar {
  background: linear-gradient(180deg, var(--accent), color-mix(in srgb, var(--accent) 35%, transparent));
  box-shadow: 0 2px 6px color-mix(in srgb, var(--accent) 25%, transparent);
}
.trend-col.today .trend-bar {
  background: linear-gradient(180deg, var(--accent), var(--accent));
  box-shadow: 0 2px 8px color-mix(in srgb, var(--accent) 35%, transparent);
}
/* 零值:细基线 + 底部圆点 */
.trend-col:not(.has) .trend-bar {
  background: var(--hairline-strong);
  border-radius: 2px;
}
.trend-bar .trend-val {
  opacity: 0;
  top: -20px;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-secondary);
  background: var(--bg-surface);
  padding: 1px 6px;
  border-radius: 6px;
  box-shadow: var(--shadow-xs);
  white-space: nowrap;
}
.trend-col.has:hover .trend-val { opacity: 1; }
.trend-label {
  font-size: 10.5px;
  color: var(--text-tertiary);
  font-variant-numeric: tabular-nums;
}
.trend-col.today .trend-label { color: var(--accent); font-weight: 600; }

/* 运行信息:4 张并排小卡 */
.meta-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  margin: 0 0 6px;
}
.meta-row span {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 12px 14px;
  background: var(--bg-surface-2);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-md);
  font-size: 12px;
  color: var(--text-tertiary);
}
.meta-row b {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

/* Top 用户:序号 + 头像色块 + 额度徽标 */
.mini-users { display: flex; flex-direction: column; gap: 8px; margin-top: 4px; }
.mini-user {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13.5px;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  background: var(--bg-surface-2);
  border: 1px solid var(--hairline);
  transition: background 0.15s, transform 0.1s;
}
.mini-user:hover { background: var(--bg-hover); transform: translateY(-1px); }
.mini-user .mu-rank {
  width: 24px;
  height: 24px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
  background: var(--bg-active);
  color: var(--text-secondary);
}
.mini-user:nth-child(1) .mu-rank { background: color-mix(in srgb, var(--accent) 12%, transparent); color: var(--accent); }
.mini-user:nth-child(2) .mu-rank { background: color-mix(in srgb, var(--accent) 8%, transparent); color: var(--accent); }
.mini-user .mu-name { flex: 1; font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini-user .mu-quota {
  flex-shrink: 0;
  font-weight: 600;
  color: var(--text);
  background: var(--bg-surface);
  padding: 4px 12px;
  border-radius: 999px;
  font-variant-numeric: tabular-nums;
  box-shadow: var(--shadow-xs);
}

/* ============================================================
   17. 对话历史:时间分块 + 字体微调
   ============================================================ */
.chat-group {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 12px 4px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  border-top: 1px solid var(--hairline);
  margin-top: 4px;
}
.chat-group:first-of-type { border-top: none; margin-top: 0; }
.chat-group-icon { font-size: 12px; }
.chat-group-label { flex-shrink: 0; }
.chat-group-time {
  margin-left: auto;
  font-weight: 500;
  text-transform: none;
  font-size: 10.5px;
  color: var(--text-tertiary);
  opacity: 0.8;
}

/* 对话列表字体调小 */
.chat-item { font-size: 13px; padding: 8px 11px; }
.chat-item .chat-icon svg { width: 13px; height: 13px; }
.chat-title { font-size: 13px; }

/* 消息字体调小(15px -> 14px,行高略收) */
.msg .msg-content { font-size: 14px; line-height: 1.65; }
.msg.assistant code { font-size: 12.5px; }
.msg.assistant pre { font-size: 12.5px; }

/* ============================================================
   18. emoji 头像
   ============================================================ */
.avatar { font-size: 18px; }
.avatar-lg { font-size: 26px; }
.msg .msg-avatar {
  font-size: 18px;
  line-height: 1;
  background: linear-gradient(135deg, var(--bg-active), var(--bg-hover));
  border: 1px solid var(--hairline);
}
.msg.user .msg-avatar {
  background: linear-gradient(135deg, var(--bg-active), var(--bg-hover));
}

/* ============================================================
   19. 后台:用户对话历史查看
   ============================================================ */
.chat-history-item {
  border: 1px solid var(--hairline);
  border-radius: var(--radius-md);
  margin-bottom: 8px;
  background: var(--bg-surface-2);
  overflow: hidden;
}
.chat-history-item summary {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 14px;
  cursor: pointer;
  list-style: none;
  font-size: 14px;
  transition: background 0.12s;
  user-select: none;
}
.chat-history-item summary:hover { background: var(--bg-hover); }
.chat-history-item summary::-webkit-details-marker { display: none; }
.chat-history-item summary::after {
  content: "▾";
  margin-left: auto;
  color: var(--text-tertiary);
  font-size: 12px;
  transition: transform 0.15s;
}
.chat-history-item[open] summary::after { transform: rotate(180deg); }
.chat-h-title { font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-h-meta { flex-shrink: 0; font-size: 12px; color: var(--text-tertiary); }
.chat-detail { border-top: 1px solid var(--hairline); max-height: 420px; overflow-y: auto; }
.chat-detail-msgs { padding: 8px 14px 14px; display: flex; flex-direction: column; gap: 8px; }
.chat-msg {
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 13px;
  line-height: 1.6;
}
.chat-msg.u { background: var(--bg-user-msg); align-self: flex-start; max-width: 92%; }
.chat-msg.a { background: var(--bg-surface); border: 1px solid var(--hairline); align-self: flex-start; max-width: 92%; }
.chat-msg-who { font-size: 11px; color: var(--text-tertiary); margin-bottom: 3px; font-weight: 600; }
.chat-msg-text { word-break: break-word; white-space: pre-wrap; }

/* admin 弹窗内的 select 复用 select-box 风格 */
#user-chats-select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 30px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2386868b' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
}

/* ============================================================
   20. 外观设置控件(字体大小 / 字体 / 主题色)
   ============================================================ */
.font-size-control {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
.font-size-control input[type="range"] {
  width: 120px;
  accent-color: var(--accent);
}
.font-size-value {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-top: 4px;
  font-variant-numeric: tabular-nums;
}
.font-family-input {
  width: 220px;
  max-width: 55vw;
  padding: 9px 14px;
  border: none;
  border-radius: 10px;
  background: var(--bg-hover);
  color: var(--text);
  font-size: 13.5px;
  font-family: inherit;
  outline: none;
}
.font-family-input:focus { box-shadow: 0 0 0 3px var(--hairline-strong); }
.accent-control {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.accent-control input[type="color"] {
  width: 42px;
  height: 34px;
  padding: 2px;
  border: 1px solid var(--hairline);
  border-radius: 9px;
  background: var(--bg-surface);
  cursor: pointer;
}
.pref-row-accent {
  flex-direction: column;
  align-items: stretch;
  cursor: default;
  gap: 12px;
}
.accent-picker {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
}
.accent-preview {
  width: 100%;
  height: 28px;
  border-radius: 8px;
  background: var(--brand, var(--accent));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--text) 8%, transparent);
}
.accent-bars {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.accent-track {
  position: relative;
  height: 22px;
  border-radius: 999px;
  cursor: pointer;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--text) 8%, transparent);
  touch-action: none;
  outline: none;
}
.accent-track:focus-visible {
  box-shadow: 0 0 0 3px var(--ring-brand);
}
.accent-hue {
  background: linear-gradient(90deg,
    #f06e16 0%,
    #f5bc1a 12%,
    #e8ef39 22%,
    #6dea67 38%,
    #56e6bf 50%,
    #3d85ed 66%,
    #6b45ef 78%,
    #db79e0 88%,
    #f277b0 94%,
    #f06e16 100%);
}
.accent-light {
  background: linear-gradient(90deg, #2a2d33 0%, #8b9098 48%, #f4f5f7 100%);
}
.accent-thumb {
  position: absolute;
  top: 50%;
  width: 18px;
  height: 18px;
  margin-left: -9px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid #1f2430;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.28);
  transform: translateY(-50%);
  pointer-events: none;
}
.accent-meta {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}
.accent-hex {
  width: 92px;
  height: 32px;
  padding: 0 10px;
  border: 1px solid var(--hairline);
  border-radius: 8px;
  background: var(--bg-hover);
  color: var(--text);
  font: inherit;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}
/* 应用 CSS 变量 */
.font-size-value::after { content: " 字号"; }

/* ============================================================
   21. 外观变量生效(字号 / 字体 / 消息区跟随)
   ============================================================ */
	:root {
	  --oc-font-size-msg: 14px;
	  --oc-font-size-ui: 14px;
	  --oc-font-family: "TinyChat Text", -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
	  --oc-ui-font: var(--oc-font-family);
	  --oc-latin-font: "TinyChat Text", -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", "Times New Roman", Georgia, serif;
	  --fs: var(--oc-font-size-ui, 14px);
	  --fs-title: 16px;
	  --fs-display: 20px;
	}
.msg .msg-content {
  font-size: var(--oc-font-size-msg, 14px);
}
.composer textarea,
.chat-item,
.chat-title,
.footer-btn,
.quota,
.user-name {
  font-family: var(--oc-font-family), -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}
body,
button,
input,
textarea,
select,
.msg,
.sidebar,
.chat-list,
.settings-panel,
.modal,
.admin-panel {
  font-family: var(--oc-ui-font, var(--oc-font-family));
}
.msg .katex,
.msg .katex-mathml,
.msg math {
  font-family: var(--oc-latin-font, "Times New Roman", serif);
}
