/* ============================================================================
 * styles.css —— 全站样式（浅色主题）
 * 设计令牌取自参考截图：主色 #3964FE、侧栏 #F9FAFB、分隔线 #E0E1E1、
 * 控件高 48px、主按钮为全圆角胶囊。
 * 命名规范：布局/组件用语义化 BEM 风格（.auth-card__title、.msg-bubble）；
 *           Markdown 排版统一使用 md- 前缀（.md-h1、.md-table、.tok-keyword）。
 * ========================================================================== */

:root {
  /* 输入区工具行统一高度：深度思考 / 智能搜索 / 模型切换 / 发送 四个按钮同高 */
  --ds-composer-btn-h: 34px;

  /* 主色 */
  --ds-blue: #3964fe;
  --ds-blue-hover: #2b55e6;
  --ds-blue-active: #2049d6;
  --ds-blue-soft: #eef3ff;
  --ds-blue-soft-2: #e2eaff;
  --ds-blue-border: #b9c9ff; /* 蓝色容器的描边（图片缩略图就绪态等） */
  --ds-blue-text: #2b4fd8; /* 浅蓝底上的蓝色文字（对 #eef3ff 为 5.8:1） */
  --ds-inline-code: #c0245c; /* 行内代码文字（对 #f5f6f8 为 5.3:1） */

  /* 中性色 */
  --ds-bg: #ffffff;
  --ds-bg-sidebar: #f9fafb;
  --ds-bg-subtle: #f5f6f8;
  --ds-bg-hover: #eff0f2;
  --ds-bg-active: #e8eeff;
  --ds-border: #e0e1e1;
  --ds-border-light: #ecedef;
  --ds-text: #1b1c1e;
  /* 一级标题色：此前多处引用 --ds-text-1 但从未定义，标题会静默回落 */
  --ds-text-1: #14151a; /* 对白底 15.6:1（标题/强调） */
  --ds-text-2: #4d5157; /* 对白底 8.4:1 */
  --ds-text-3: #5c636e; /* 对白底 6.1:1 */
  --ds-text-4: #6b7280; /* 对白底 4.8:1（小字下限） */
  --ds-placeholder: #6b7280;

  /* 功能色 */
  --ds-danger: #e5484d; /* 仅用于描边/填充等非文字场景 */
  --ds-danger-text: #c22a2f; /* 红字（对浅灰卡片 5.5:1） */
  --ds-danger-soft: #fef1f1;
  --ds-danger-border: #f0b4b6;
  --ds-success: #10854a; /* 白字按钮（4.7:1） */
  --ds-warning: #f5a623;

  /* 尺寸 */
  --ds-radius-xs: 5px; /* 极小控件（图标按钮 / 进度条 / 小标记） */
  --ds-radius-sm: 8px;
  --ds-radius: 12px;
  --ds-radius-lg: 16px;
  --ds-radius-pill: 999px;
  --ds-control-h: 48px;
  --ds-sidebar-w: 260px;
  --ds-content-w: 800px;
  --ds-shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.04);
  --ds-shadow: 0 4px 16px rgba(16, 24, 40, 0.08);
  --ds-shadow-lg: 0 18px 48px rgba(16, 24, 40, 0.12);
  --ds-ease: cubic-bezier(0.33, 0, 0.2, 1);

  /* ---- 字号阶梯 ----
     此前 11.5 / 12 / 12.5、13 / 13.5、16~18 这些半像素差的值并列存在，
     同一语义层级在不同页面会长得不一样。这里收敛成固定几档，全站只允许用这些值。 */
  --ds-fs-2xs: 11.5px; /* 角标 / 时间戳 / 极辅助文字 */
  --ds-fs-xs: 12px; /* 辅助说明、来源、域名 */
  --ds-fs-sm: 13px; /* 次要正文、列表项 */
  --ds-fs-md: 14px; /* 控件内文字 */
  --ds-fs-base: 15px; /* 正文（与 body 一致） */
  --ds-fs-lg: 17px; /* 小标题 */
  --ds-fs-xl: 20px; /* 区块标题 */
  --ds-fs-2xl: 24px; /* 页面主标题 */
  --ds-fs-3xl: 28px; /* 欢迎屏 / 大数字 */

  /* ---- 卡片：所有「白底卡片」共用一套底/描边/圆角/阴影 ---- */
  --ds-card-bg: var(--ds-bg);
  --ds-card-border: var(--ds-border-light);
  --ds-card-radius: var(--ds-radius-lg);
  --ds-card-shadow: var(--ds-shadow-sm);
  /* 卡片内边距：登录卡 / 用户中心卡 / 反馈表单 / 反馈条目 / 筛选条 / 条款文档 / 空态
     此前分别是 32 / 28 / 20 / 14 / 12 / 32 / 40px，翻页时留白一路跳变。
     统一成一个令牌后，移动端只需覆盖这一处。 */
  --ds-card-pad: 22px;

  /* 蓝色禁用态：主按钮与发送按钮此前各自硬编码了一个浅蓝，统一成同一个 */
  --ds-blue-disabled: #a9bcff;

  /* 用户气泡底色：移动端沿用 DeepSeek 手机端的"浅蓝气泡 / 深色蓝灰气泡"，
     桌面端继续用中性灰（--ds-bg-subtle），保持原有观感不变 */
  --ds-user-bubble: #e9effd;
  --ds-user-bubble-text: #1b2540;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  margin: 0;
}

body {
  display: flex;
  flex-direction: column;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB',
    'Microsoft YaHei', 'Helvetica Neue', Inter, Arial, sans-serif;
  font-size: var(--ds-fs-base);
  line-height: 1.6;
  color: var(--ds-text);
  background: var(--ds-bg);
  /* 滚动到内容底部（overscroll / 橡皮筋）时不要露出纯白 */
  background-color: var(--ds-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* 条款页打开时，把根背景也换成页面灰，滚动区域不会突兀变白 */
html:has(.legal:not(.hidden)),
body:has(.legal:not(.hidden)) {
  background: var(--ds-bg-subtle);
}

button {
  font: inherit;
  cursor: pointer;
  color: inherit;
}

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

a {
  color: var(--ds-blue-text);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.hidden {
  display: none !important;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ==========================================================================
   一、登录 / 注册页
   ========================================================================== */

.auth-page {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column; /* 主内容居中，页脚贴底 */
  background: var(--ds-bg);
}

.auth-page__main {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
}

/* 友情链接页脚：居中浅灰小字，样式参考站外站点的简洁页脚 */
.site-footer {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  padding: 14px 24px 20px;
  font-size: var(--ds-fs-xs);
  color: var(--ds-text-4);
}

.site-footer__label {
  color: var(--ds-text-4);
}

.site-footer__link {
  color: var(--ds-text-4);
  text-decoration: none;
  transition: color 0.15s var(--ds-ease);
}

.site-footer__link:hover,
.site-footer__link:focus-visible {
  color: var(--ds-text-2);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.auth-card {
  width: 100%;
  max-width: 400px;
}

.auth-card__logo {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin-bottom: 40px;
}

.auth-card__logo .brand-mark {
  width: 30px;
  height: 30px;
  border-radius: var(--ds-radius-sm);
  background: var(--ds-blue);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--ds-fs-base);
  font-weight: 700;
}

/* 品牌头像（替换原先的「A」字方块） */
.brand-avatar {
  display: block;
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  object-fit: cover;
  object-position: center;
  background: var(--ds-bg-subtle);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.06);
}

.auth-card__logo .brand-avatar {
  width: 34px;
  height: 34px;
  border-radius: var(--ds-radius-sm);
}

.auth-card__logo .brand-text {
  color: var(--ds-blue);
  font-size: var(--ds-fs-2xl);
  font-weight: 700;
  letter-spacing: -0.3px;
}

.auth-card__title {
  font-size: var(--ds-fs-xl);
  font-weight: 700;
  margin: 0 0 6px;
}

.auth-card__subtitle {
  font-size: var(--ds-fs-sm);
  color: var(--ds-text-3);
  margin: 0 0 24px;
}

/* 输入框：默认 / 聚焦 / 禁用 */
.field {
  margin-bottom: 16px;
}

.field__label {
  display: block;
  font-size: var(--ds-fs-sm);
  font-weight: 500;
  color: var(--ds-text-2);
  margin-bottom: 7px;
}

.input-wrap {
  position: relative;
  display: flex;
  align-items: center;
  height: var(--ds-control-h);
  border: 1px solid var(--ds-border);
  border-radius: var(--ds-radius);
  background: var(--ds-bg);
  transition: border-color 0.18s var(--ds-ease), box-shadow 0.18s var(--ds-ease), background 0.18s;
}

/* 注意 :not() 会参与特异性计算：这条 (0,3,0) 必须排除聚焦/错误态，
   否则悬停在聚焦或校验失败的输入框上会把蓝色/红色描边盖成灰色 */
.input-wrap:hover:not(.is-disabled):not(.is-focus):not(.is-error) {
  border-color: var(--ds-border);
}

.input-wrap.is-focus {
  border-color: var(--ds-blue);
  box-shadow: 0 0 0 3px rgba(57, 100, 254, 0.12);
}

.input-wrap.is-error {
  border-color: var(--ds-danger);
  box-shadow: 0 0 0 3px rgba(229, 72, 77, 0.1);
}

.input-wrap.is-disabled {
  background: var(--ds-bg-subtle);
  border-color: var(--ds-border-light);
  cursor: not-allowed;
}

.input-wrap__prefix {
  padding: 0 8px 0 16px;
  font-size: var(--ds-fs-base);
  color: var(--ds-text);
  flex: 0 0 auto;
}

.input-wrap__divider {
  width: 1px;
  height: 18px;
  background: var(--ds-border);
  margin-right: 12px;
  flex: 0 0 1px;
}

.input {
  flex: 1;
  min-width: 0;
  height: 100%;
  border: none;
  outline: none;
  background: transparent;
  font-size: var(--ds-fs-base);
  padding: 0 16px;
  border-radius: var(--ds-radius);
  /* 移除浏览器注入的控件，避免与自定义图标重复 */
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
}

/* 关键：屏蔽 Edge / IE 在密码框上注入的原生「显示密码」按钮。
   项目使用自定义的眼睛图标（.input-wrap__action--icon），
   若不屏蔽，原生按钮会与自定义图标并排出现，形成"两个图标"；
   点击切换 type 时原生按钮重绘，看起来就像图标消失了。 */
.input::-ms-reveal,
.input::-ms-clear {
  display: none;
}

.input::-webkit-credentials-auto-fill-button,
.input::-webkit-strong-password-auto-fill-button,
.input::-webkit-contacts-auto-fill-button {
  visibility: hidden;
  display: none !important;
  pointer-events: none;
  position: absolute;
  right: 0;
}

/* 前缀与输入框之间隔了 .input-wrap__divider，必须用 ~（相邻兄弟选择器永远不会命中） */
.input-wrap__prefix ~ .input {
  padding-left: 0;
}

.input::placeholder {
  color: var(--ds-placeholder);
}

.input:disabled {
  cursor: not-allowed;
  color: var(--ds-text-4);
}

.input-wrap__suffix {
  flex: 0 0 auto;
  padding-right: 8px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.input-wrap__action {
  border: none;
  background: transparent;
  color: var(--ds-blue-text);
  font-size: var(--ds-fs-sm);
  padding: 6px 10px;
  border-radius: var(--ds-radius-sm);
  transition: background 0.15s;
}

.input-wrap__action:hover:not(:disabled) {
  background: var(--ds-blue-soft);
}

.input-wrap__action:disabled {
  color: var(--ds-text-4);
  cursor: not-allowed;
}

/* 图标型操作按钮（密码显示/隐藏） */
.input-wrap__action--icon {
  width: 34px;
  height: 34px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--ds-radius-sm);
  color: var(--ds-text-3);
}

.input-wrap__action--icon:hover {
  background: var(--ds-bg-hover);
  color: var(--ds-text-2);
}

.input-wrap__action--icon .ic-eye-off {
  display: none;
}

.input-wrap__action--icon.is-visible .ic-eye {
  display: none;
}

.input-wrap__action--icon.is-visible .ic-eye-off {
  display: inline-flex;
}

/* 环境提示条（例如页面来自静态预览、已自动连接本地服务） */
.env-banner {
  flex: 0 0 auto;
  position: relative;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: var(--ds-fs-xs);
  line-height: 1.5;
  padding: 7px 14px;
  background: #fff8e6;
  border-bottom: 1px solid #f3e0b3;
  color: #8a6116;
}

.env-banner.is-error {
  background: var(--ds-danger-soft);
  border-bottom-color: #f7d9da;
  color: var(--ds-danger);
}

.env-banner code {
  font-family: 'SFMono-Regular', Consolas, monospace;
  background: rgba(0, 0, 0, 0.06);
  padding: 1px 5px;
  border-radius: var(--ds-radius-xs);
}

.env-banner a {
  color: inherit;
  text-decoration: underline;
}

.field__error {
  font-size: var(--ds-fs-xs);
  color: var(--ds-danger-text);
  margin-top: 6px;
  min-height: 17px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.field__hint {
  font-size: var(--ds-fs-xs);
  color: var(--ds-text-3);
  margin-top: 6px;
}

/* 密码强度 */
.strength {
  margin-top: 10px;
}

.strength__bars {
  display: flex;
  gap: 5px;
}

.strength__bars i {
  height: 4px;
  flex: 1;
  border-radius: var(--ds-radius-xs);
  background: var(--ds-border-light);
  transition: background 0.2s;
}

.strength__text {
  font-size: var(--ds-fs-xs);
  color: var(--ds-text-4);
  margin-top: 6px;
}

/* 协议说明 */
.auth-card__agree {
  font-size: var(--ds-fs-sm);
  color: var(--ds-text-2);
  line-height: 1.75;
  margin: 18px 0 24px;
}

.auth-card__agree a {
  color: var(--ds-blue-text);
}

/* 主按钮分两档，全站只有这两种主按钮，颜色与禁用态共用同一套蓝：
     .btn-primary  —— 登录/注册页的「页面级 CTA」：48px 胶囊，带蓝色投影（对应参考稿的大按钮）
     .btn--primary —— 页面内的「行内主操作」（提交反馈、保存头像等）：38px，与 .btn 同高同圆角
   两者都只从 --ds-blue / --ds-blue-hover / --ds-blue-active / --ds-blue-disabled 取色。 */
.btn-primary {
  width: 100%;
  height: var(--ds-control-h);
  border: none;
  border-radius: var(--ds-radius-pill);
  background: var(--ds-blue);
  color: #fff;
  font-size: var(--ds-fs-lg);
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: background 0.18s var(--ds-ease), transform 0.1s, box-shadow 0.18s;
  box-shadow: 0 6px 18px rgba(57, 100, 254, 0.22);
}

.btn-primary:hover:not(:disabled) {
  background: var(--ds-blue-hover);
}

.btn-primary:active:not(:disabled) {
  background: var(--ds-blue-active);
  transform: scale(0.995);
}

.btn-primary:disabled {
  background: var(--ds-blue-disabled);
  cursor: not-allowed;
  box-shadow: none;
}

.btn-primary__spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.45);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: none;
}

.btn-primary.is-loading .btn-primary__spinner {
  display: block;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* 辅助链接区 */
.auth-card__links {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 20px;
  font-size: var(--ds-fs-sm);
}

.auth-card__links a {
  color: var(--ds-blue-text);
}

.auth-card__links a:hover {
  text-decoration: underline;
}

.auth-card__links .dot {
  color: var(--ds-border);
}

/* 全局提示条（表单级错误） */
.form-alert {
  display: none;
  align-items: flex-start;
  gap: 8px;
  font-size: var(--ds-fs-sm);
  line-height: 1.6;
  padding: 10px 12px;
  border-radius: var(--ds-radius-sm);
  background: var(--ds-danger-soft);
  border: 1px solid #f7d9da;
  color: var(--ds-danger-text);
  margin-bottom: 16px;
}

.form-alert.is-visible {
  display: flex;
}

.form-alert--info {
  background: var(--ds-blue-soft);
  border-color: var(--ds-blue-soft-2);
  color: var(--ds-blue-text);
}

/* ==========================================================================
   二、主应用布局
   ========================================================================== */

.app {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  overflow: hidden;
}

/* 对话视图下把 .app 固定铺满视口。
   原因：.app 只是 body 的一个 flex 子项，只要 body 里多出任何占高的兄弟节点
   （静态预览注入的元素、环境提示条等），.app 就会被挤矮，
   底部露出 body 白底、并被文档滚动条带成"多一行空白"。
   fixed 后尺寸只跟视口有关，内部 .messages 依旧自己滚动。
   注意：条款页 / 登录页会移除 html 上的 view-app，行为保持原样。 */
html.view-app .app:not(.hidden) {
  position: fixed;
  inset: 0;
}

/* 顶部有环境提示条时，把固定的 app 让出它的高度，提示条仍然可见 */
body.has-env-banner .app:not(.hidden) {
  top: var(--env-banner-h, 34px);
}

/* 用户中心是独立整页：收起会话侧栏，让内容独占整宽 */
.app--uc .sidebar {
  display: none;
}

.app--uc .uc {
  flex: 1 1 100%;
  width: 100%;
}

/* ------------------------------- 侧栏 ------------------------------- */

.sidebar {
  width: var(--ds-sidebar-w);
  flex: 0 0 var(--ds-sidebar-w);
  background: var(--ds-bg-sidebar);
  border-right: 1px solid var(--ds-border);
  display: flex;
  flex-direction: column;
  z-index: 30;
}

.sidebar__head {
  padding: 14px 14px 8px;
}

.sidebar__top {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  padding-left: 4px;
}

.sidebar__logo {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--ds-blue-text);
  font-weight: 700;
  font-size: var(--ds-fs-xl);
  letter-spacing: -0.3px;
}

.sidebar__logo .brand-mark {
  width: 24px;
  height: 24px;
  border-radius: var(--ds-radius-sm);
  background: var(--ds-blue);
  color: #fff;
  font-size: var(--ds-fs-sm);
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sidebar__logo .brand-avatar {
  width: 26px;
  height: 26px;
  border-radius: var(--ds-radius-sm);
}

.sidebar__tools {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 2px;
}

.icon-btn {
  border: none;
  background: transparent;
  width: 30px;
  height: 30px;
  border-radius: var(--ds-radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ds-text-2);
  transition: background 0.15s, color 0.15s;
}

.icon-btn:hover:not(:disabled) {
  background: var(--ds-bg-hover);
  color: var(--ds-text);
}

.icon-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.icon-btn--danger:hover {
  background: var(--ds-danger-soft);
  color: var(--ds-danger);
}

.btn-new {
  width: 100%;
  height: 38px;
  border: 1px solid var(--ds-border);
  border-radius: var(--ds-radius);
  background: var(--ds-bg);
  color: var(--ds-text);
  font-size: var(--ds-fs-md);
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.btn-new:hover {
  border-color: var(--ds-blue);
  color: var(--ds-blue-text);
  background: var(--ds-blue-soft);
}

.sidebar__search {
  padding: 0 14px 8px;
}

.input-search {
  width: 100%;
  height: 34px;
  border: 1px solid transparent;
  border-radius: var(--ds-radius-sm);
  background: transparent;
  padding: 0 10px;
  font-size: var(--ds-fs-sm);
  outline: none;
  transition: background 0.15s, border-color 0.15s;
}

.input-search::placeholder {
  color: var(--ds-text-4);
}

.input-search:hover {
  background: var(--ds-bg-hover);
}

.input-search:focus {
  background: var(--ds-bg);
  border-color: var(--ds-blue);
}

.conv-list {
  flex: 1;
  overflow-y: auto;
  padding: 2px 10px 12px;
}

.conv-group {
  margin-bottom: 6px;
}

.conv-group__title {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: var(--ds-fs-xs);
  color: var(--ds-text-3);
  padding: 10px 8px 4px;
  cursor: pointer;
  user-select: none;
}

.conv-group__title:hover {
  color: var(--ds-text-2);
}

.conv-group__caret {
  transition: transform 0.2s var(--ds-ease);
}

.conv-group.is-collapsed .conv-group__caret {
  transform: rotate(-90deg);
}

.conv-group.is-collapsed .conv-group__body {
  display: none;
}

.conv-item {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  padding: 0 8px 0 10px;
  border-radius: var(--ds-radius-sm);
  cursor: pointer;
  transition: background 0.12s;
}

.conv-item:hover {
  background: var(--ds-bg-hover);
}

.conv-item.is-active {
  background: var(--ds-bg-active);
}

.conv-item.is-active .conv-item__title {
  color: var(--ds-blue-text);
  font-weight: 500;
}

.conv-item__title {
  flex: 1;
  min-width: 0;
  font-size: var(--ds-fs-sm);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.conv-item__actions {
  display: none;
  gap: 1px;
}

.conv-item:hover .conv-item__actions,
.conv-item.is-active .conv-item__actions {
  display: flex;
}

.conv-item__actions .icon-btn {
  width: 24px;
  height: 24px;
  border-radius: var(--ds-radius-xs);
}

.conv-empty {
  padding: 20px 12px;
  text-align: center;
  font-size: var(--ds-fs-sm);
  color: var(--ds-text-4);
  line-height: 1.7;
}

/* 关键词搜索时的命中计数 */
.conv-search-tip {
  padding: 8px 12px 2px;
  font-size: var(--ds-fs-xs);
  color: var(--ds-text-4);
}

/* 关键词高亮：只给背景，不动字色，避免和链接色打架 */
mark.md-hl,
.md-hl {
  background: #fff2a8;
  color: inherit;
  padding: 0 1px;
  border-radius: var(--ds-radius-xs);
}

/* 侧栏底部：用户 + 额度 */
.sidebar__foot {
  border-top: 1px solid var(--ds-border);
  padding: 10px 12px 12px;
  background: var(--ds-bg-sidebar);
}

/* 额度进度条已移除：累计提问次数不设上限，界面不再展示"剩余次数"。
   服务端只保留一条滑动窗口频率限制，被限流时由 .composer-notice 给出提示。 */

.user-row {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 4px 6px 2px;
  border-radius: var(--ds-radius-sm);
}

.avatar {
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  border-radius: 50%;
  /* 渐变两端都要保证白色首字母达到 4.5:1，故整体压深 */
  background: linear-gradient(135deg, #3f63e8, #2a4fd6);
  color: #fff;
  font-size: var(--ds-fs-sm);
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
}

.user-row__info {
  flex: 1;
  min-width: 0;
}

.user-row__name {
  font-size: var(--ds-fs-sm);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-row__mail {
  font-size: var(--ds-fs-2xs);
  color: var(--ds-text-4);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ------------------------------- 主区 ------------------------------- */

.main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: var(--ds-bg);
}

.main__head {
  flex: 0 0 56px;
  height: 56px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 16px;
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--ds-border-light);
}

.menu-btn {
  display: none;
}

.main__title {
  font-size: var(--ds-fs-base);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 46vw;
}

.main__badge {
  font-size: var(--ds-fs-2xs);
  color: var(--ds-blue-text);
  background: var(--ds-blue-soft);
  border-radius: var(--ds-radius-pill);
  padding: 3px 10px;
  font-weight: 500;
}

.main__head-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: var(--ds-fs-xs);
  color: var(--ds-text-4);
}

/* 标题栏「新建会话」：桌面端跟在额度信息后面，移动端（额度隐藏后）靠 auto 推到最右 */
.main__new {
  margin-left: auto;
}

@media (min-width: 769px) {
  /* 桌面端额度信息已经带了 margin-left:auto，这里再 auto 会把两个 auto 平分，
     标题栏中间被撑开。交给 head-right 一个 auto 就够了 */
  .main__new {
    margin-left: 0;
  }
}

.messages {
  flex: 1;
  overflow-y: auto;
  scroll-behavior: smooth;
}

.messages__inner {
  max-width: var(--ds-content-w);
  margin: 0 auto;
  padding: 28px 24px 8px;
}

/* 欢迎屏 */
.welcome {
  min-height: 52vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 24px 8px;
}

.welcome__logo {
  width: 46px;
  height: 46px;
  border-radius: var(--ds-radius-lg);
  background: linear-gradient(135deg, var(--ds-blue) 0%, #7d9bff 100%);
  color: #fff;
  font-size: var(--ds-fs-xl);
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 10px 24px rgba(57, 100, 254, 0.24);
}

/* 欢迎页 Logo 现在是图片，去掉渐变/文字相关的表现 */
img.welcome__logo {
  object-fit: cover;
  object-position: center;
  background: var(--ds-bg-subtle);
  box-shadow: 0 10px 24px rgba(57, 100, 254, 0.2);
}

.welcome__title {
  font-size: var(--ds-fs-xl);
  font-weight: 600;
  margin: 18px 0 26px;
}

.suggest-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  width: 100%;
  max-width: 560px;
}

.suggest {
  border: 1px solid var(--ds-border);
  background: var(--ds-bg);
  border-radius: var(--ds-radius);
  padding: 11px 14px;
  font-size: var(--ds-fs-sm);
  color: var(--ds-text-2);
  text-align: left;
  line-height: 1.55;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}

.suggest:hover {
  border-color: var(--ds-blue);
  color: var(--ds-blue-text);
  background: var(--ds-blue-soft);
}

/* 消息 */
.msg {
  display: flex;
  gap: 12px;
  margin-bottom: 26px;
  align-items: flex-start;
}

/* 助手消息：沿用 .msg 的默认（左对齐）排布，此处仅作语义占位与定位锚点 */
.msg--assistant {
  flex-direction: row;
}

.msg--user {
  flex-direction: row-reverse;
}

.msg__avatar {
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  /* 白字/白图标需满足 4.5:1，渐变取足够深的蓝 */
  background: linear-gradient(135deg, #3f63e8, #2a4fd6);
  margin-top: 2px;
}

.msg--user .msg__avatar {
  background: #dfe1e5;
  /* 浅灰底上必须用足够深的文字，否则首字母几乎不可见（对比度 < 4.5） */
  color: #3d424d;
  font-size: var(--ds-fs-xs);
  font-weight: 600;
}

/* 用户设置过头像时：头像图片填满圆形，首字母作为加载失败的回退 */
.msg__avatar--image {
  background: var(--ds-bg-subtle);
  overflow: hidden;
}

.msg__avatar__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border-radius: 50%;
}

.msg__body {
  min-width: 0;
  max-width: 100%;
  flex: 1 1 auto;
}

.msg--user .msg__body {
  flex: 0 1 auto;
  max-width: 78%;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.msg__bubble {
  font-size: var(--ds-fs-base);
  line-height: 1.75;
  word-break: break-word;
}

.msg--user .msg__bubble {
  background: var(--ds-bg-subtle);
  border-radius: var(--ds-radius-lg) 4px var(--ds-radius-lg) var(--ds-radius-lg);
  padding: 9px 14px;
  white-space: pre-wrap;
}

.msg__time {
  font-size: var(--ds-fs-2xs);
  color: var(--ds-text-4);
  margin-top: 6px;
}

.msg--user .msg__time {
  text-align: right;
}

/* 思考过程折叠块 */
.md-reasoning {
  margin-bottom: 10px;
}

.md-reasoning__summary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: var(--ds-fs-sm);
  color: var(--ds-text-3);
  cursor: pointer;
  user-select: none;
  list-style: none;
  padding: 3px 0;
}

.md-reasoning__summary::-webkit-details-marker {
  display: none;
}

.md-reasoning__summary:hover {
  color: var(--ds-text-2);
}

.md-reasoning__summary .caret {
  transition: transform 0.2s var(--ds-ease);
}

.md-reasoning[open] .md-reasoning__summary .caret {
  transform: rotate(180deg);
}

.md-reasoning__body {
  margin-top: 8px;
  padding: 10px 14px;
  background: var(--ds-bg-subtle);
  border-radius: var(--ds-radius);
  font-size: var(--ds-fs-sm);
  line-height: 1.8;
  color: var(--ds-text-2);
  max-height: 360px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

/* 消息操作栏 */
.msg__actions {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-top: 6px;
  opacity: 0;
  transition: opacity 0.15s;
}

.msg:hover .msg__actions,
.msg__actions:focus-within {
  opacity: 1;
}

.msg__actions .icon-btn {
  width: 28px;
  height: 28px;
  color: var(--ds-text-4);
}

.msg__actions .icon-btn:hover:not(:disabled) {
  color: var(--ds-text-2);
}

/* 反馈选中态（规则必须排在 hover 之后，否则悬停会被上面的 hover 色覆盖）：
   点赞成功 → 手势纯蓝；点踩 → 手势纯灰；两者都是实心图标 */
.msg__actions .icon-btn.is-on[data-act='like'] {
  color: var(--ds-blue);
}

.msg__actions .icon-btn.is-on[data-act='dislike'] {
  color: var(--ds-text-3);
}

/* 与上面的 hover 规则同权重，靠"排在后面"取胜，悬停时选中色不会被冲掉 */

.msg__error {
  margin-top: 8px;
  font-size: var(--ds-fs-xs);
  color: var(--ds-danger-text);
  background: var(--ds-danger-soft);
  border-radius: var(--ds-radius-sm);
  padding: 7px 11px;
}

.typing-dots {
  display: inline-flex;
  gap: 4px;
  align-items: center;
  height: 20px;
}

.typing-dots i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ds-text-4);
  animation: bounce 1.2s infinite ease-in-out;
}

.typing-dots i:nth-child(2) {
  animation-delay: 0.15s;
}

.typing-dots i:nth-child(3) {
  animation-delay: 0.3s;
}

@keyframes bounce {
  0%,
  60%,
  100% {
    transform: translateY(0);
    opacity: 0.45;
  }
  30% {
    transform: translateY(-4px);
    opacity: 1;
  }
}

.caret-blink {
  display: inline-block;
  width: 7px;
  height: 16px;
  background: var(--ds-blue);
  border-radius: var(--ds-radius-xs);
  vertical-align: text-bottom;
  margin-left: 3px;
  animation: blink 1s steps(2, start) infinite;
}

@keyframes blink {
  to {
    visibility: hidden;
  }
}

/* ----------------------------- 输入区 ----------------------------- */

.composer-wrap {
  flex: 0 0 auto;
  padding: 4px 24px 14px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0) 0%, #fff 30%);
}

.composer-inner {
  max-width: var(--ds-content-w);
  margin: 0 auto;
}

.composer-notice {
  display: none;
  font-size: var(--ds-fs-xs);
  color: var(--ds-danger-text);
  background: var(--ds-danger-soft);
  border-radius: var(--ds-radius-sm);
  padding: 8px 12px;
  margin-bottom: 8px;
}

.composer-notice.is-visible {
  display: block;
}

/* 输入区：一颗大圆角卡片 —— 上方是输入框，下方一行左边能力开关、右边工具按钮 */
.composer {
  display: flex;
  flex-direction: column;
  gap: 6px;
  border: 1px solid var(--ds-border);
  border-radius: 22px;
  background: var(--ds-bg);
  padding: 12px 12px 10px 16px;
  box-shadow: var(--ds-shadow-sm);
  transition: border-color 0.18s var(--ds-ease), box-shadow 0.18s var(--ds-ease);
}

.composer:hover {
  border-color: var(--ds-border);
}

.composer.is-focus {
  border-color: var(--ds-blue);
  box-shadow: 0 0 0 3px rgba(57, 100, 254, 0.1);
}

.composer.is-disabled {
  background: var(--ds-bg-subtle);
}

/* 输入框独占一行、撑满整宽（早期横向布局留下的 width:0 + flex:1 会把宽度压成 0） */
.composer__input {
  flex: 0 0 auto;
  width: 100%;
  min-width: 0;
  border: none;
  outline: none;
  resize: none;
  background: transparent;
  font-size: var(--ds-fs-base);
  line-height: 1.6;
  max-height: 168px;
  padding: 2px 0 0;
}

/* 底部一行：能力开关在左、工具按钮在右 */
.composer__bar {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

/* ===== 能力开关（深度思考 / 智能搜索）===== */
.composer__caps {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 6px;
  flex: 0 1 auto;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
}

.composer__caps::-webkit-scrollbar {
  display: none;
}

/* 高度与工具行按钮（模型切换 / 发送）保持一致，视觉同高 */
.cap {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: var(--ds-composer-btn-h);
  border: 1px solid var(--ds-border);
  background: var(--ds-bg);
  color: var(--ds-text-2);
  border-radius: var(--ds-radius-pill);
  padding: 0 12px 0 10px;
  font-size: var(--ds-fs-sm);
  line-height: 1;
  cursor: pointer;
  flex: 0 0 auto;
  transition: color 0.16s var(--ds-ease), border-color 0.16s var(--ds-ease),
    background 0.16s var(--ds-ease);
}

.cap:hover {
  color: var(--ds-text-1);
  border-color: var(--ds-border);
}

/* 开关图标：未选中描边灰，选中变蓝 */
.cap__ic {
  width: 14px;
  height: 14px;
  flex: 0 0 auto;
  color: var(--ds-text-4);
  transition: color 0.16s var(--ds-ease);
}

.cap:hover .cap__ic {
  color: var(--ds-text-2);
}

.cap[data-on='1'] {
  color: var(--ds-blue-text);
  border-color: rgba(57, 100, 254, 0.28);
  background: rgba(57, 100, 254, 0.07);
}

.cap[data-on='1'] .cap__ic {
  color: var(--ds-blue-text);
}

.cap__txt {
  white-space: nowrap;
}

/* 检索通道未配置时置灰，避免点了没反应 */
.cap:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.composer__input::placeholder {
  color: var(--ds-placeholder);
}

.composer__input:disabled {
  cursor: not-allowed;
  color: var(--ds-text-4);
}

.composer__tools {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto; /* 始终贴右，避免被长文本/长占位符挤动 */
  flex: 0 0 auto;
}

/* 工具行里的图标按钮与其余按钮同高（全局 .icon-btn 仍是 30px，别处不受影响） */
.composer__tools .icon-btn,
.composer__tools .btn-stop {
  width: var(--ds-composer-btn-h);
  height: var(--ds-composer-btn-h);
}

/* 回形针：当前模型看不懂图片/视频时切成"引导态"（浅色 + 虚化），
   hover 时恢复，文案由 JS 写进 title 说明会切到哪个模型 */
.composer__tools .icon-btn.is-vision-off {
  color: var(--ds-text-4);
  opacity: 0.7;
}

.composer__tools .icon-btn.is-vision-off:hover {
  opacity: 1;
  color: var(--ds-text-1);
}

/* ===== 模型切换控件（参照外部 IDE 的模型选择设计：胶囊按钮 + 上浮分组菜单） ===== */
.model-switch {
  position: relative;
}

.model-switch__btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: var(--ds-composer-btn-h);
  border: 1px solid var(--ds-border);
  background: var(--ds-bg);
  border-radius: var(--ds-radius-pill);
  padding: 0 10px 0 12px;
  font-size: var(--ds-fs-sm);
  color: var(--ds-text-2);
  cursor: pointer;
  transition: border-color 0.15s var(--ds-ease), background 0.15s var(--ds-ease);
  max-width: 200px;
}

.model-switch__btn:hover,
.model-switch.is-open .model-switch__btn {
  border-color: var(--ds-border);
  background: var(--ds-bg-subtle);
}

.model-switch__spark {
  color: var(--ds-blue);
  flex: 0 0 auto;
}

.model-switch__label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.model-switch__caret {
  color: var(--ds-text-4);
  flex: 0 0 auto;
  transition: transform 0.18s var(--ds-ease);
}

.model-switch.is-open .model-switch__caret {
  transform: rotate(180deg);
}

.model-switch__menu {
  position: absolute;
  right: 0;
  bottom: calc(100% + 10px);
  min-width: 250px;
  /* 极窄屏（<340px）下菜单靠右对齐会溢出到屏幕外 */
  max-width: calc(100vw - 24px);
  /* 菜单是向上展开的，而对话页是 100dvh 固定布局（页面本身不滚动）。
     模型变多后，超出视口顶部的条目既看不见也滚不到——表现为"后面的模型没显示"。
     这里用 max-height 兜住（具体数值由 JS 按按钮上方可用空间算出），超出时菜单内部滚动。 */
  max-height: var(--ds-model-menu-max, 60vh);
  overflow-y: auto;
  overscroll-behavior: contain;
  background: var(--ds-bg);
  border: 1px solid var(--ds-border);
  border-radius: var(--ds-radius);
  box-shadow: var(--ds-shadow-lg);
  padding: 6px;
  z-index: 40;
}

/* 分组标题历史上用于把同厂商的模型收在一起；现在每个模型单独成行，
   厂商名改放在条目内（.model-switch__vendor），这条保留仅为兼容旧 DOM */
.model-switch__group {
  font-size: var(--ds-fs-xs);
  color: var(--ds-text-4);
  padding: 8px 10px 4px;
  user-select: none;
}

.model-switch__item {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  width: 100%;
  border: none;
  background: none;
  text-align: left;
  padding: 9px 10px;
  border-radius: var(--ds-radius-sm);
  font-size: var(--ds-fs-md);
  color: var(--ds-text-2);
  cursor: pointer;
  transition: background 0.12s var(--ds-ease);
}

/* 名称在上、厂商在下：一行两行信息，条目仍然是「一个模型」 */
.model-switch__meta {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1px;
  min-width: 0;
  margin-right: auto;
}

.model-switch__name {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.model-switch__vendor {
  font-size: var(--ds-fs-2xs);
  color: var(--ds-text-4);
  line-height: 1.3;
}

/* 支持上传附件的模型在条目上直接标出来，
   比原来"整组共用一个副标题"更准（智谱AI 组里只有 GLM-5.3-Flash 支持） */
.model-switch__tag {
  flex: 0 0 auto;
  font-size: var(--ds-fs-2xs);
  color: var(--ds-blue-text);
  background: var(--ds-blue-soft);
  border-radius: var(--ds-radius-pill);
  padding: 1px 8px;
}

.model-switch__item:hover,
.model-switch__item:focus-visible {
  background: var(--ds-bg-hover);
  outline: none;
}

.model-switch__item.is-selected {
  color: var(--ds-text);
  font-weight: 600;
}

.model-switch__item .model-switch__check {
  color: var(--ds-blue);
}

.model-switch__item .model-switch__default {
  flex: 0 0 auto;
  font-size: var(--ds-fs-2xs);
  color: var(--ds-text-4);
  border: 1px solid var(--ds-border);
  border-radius: var(--ds-radius-pill);
  padding: 1px 7px;
}

.btn-send {
  width: var(--ds-composer-btn-h);
  height: var(--ds-composer-btn-h);
  border: none;
  border-radius: 50%;
  background: var(--ds-blue);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, transform 0.1s;
}

.btn-send:hover:not(:disabled) {
  background: var(--ds-blue-hover);
}

.btn-send:disabled {
  background: #dfe1e5;
  color: #a9aeb6;
  cursor: not-allowed;
}

.btn-stop {
  width: var(--ds-composer-btn-h);
  height: var(--ds-composer-btn-h);
  border: none;
  border-radius: 50%;
  background: var(--ds-text);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-stop:hover {
  background: #000;
}

.composer__disclaimer {
  text-align: center;
  font-size: var(--ds-fs-xs);
  color: var(--ds-text-4);
  margin-top: 10px;
}

/* 移动端遮罩 */
.sidebar-mask {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 20, 30, 0.32);
  z-index: 25;
}

/* ==========================================================================
   三、Markdown 排版（.md-* / .tok-*）
   统一应用于 AI 回答与内容展示区
   ========================================================================== */

.md-body,
.msg__bubble.md-body {
  font-size: var(--ds-fs-base);
  line-height: 1.78;
  color: var(--ds-text);
  word-break: break-word;
}

.md-body > *:first-child {
  margin-top: 0 !important;
}

.md-body > *:last-child {
  margin-bottom: 0 !important;
}

.md-p {
  margin: 0 0 14px;
}

/* 数学公式（KaTeX 渲染容器；未加载 KaTeX 时降级显示原始 LaTeX 文本） */
.md-math {
  display: inline-block;
  white-space: normal;
}

.md-math--display {
  display: block;
  text-align: center;
  margin: 10px 0;
  overflow-x: auto;
}

.md-math .katex-display {
  margin: 0;
}

.md-h {
  font-weight: 600;
  line-height: 1.4;
  color: var(--ds-text);
  margin: 26px 0 12px;
}

.md-h1 {
  font-size: var(--ds-fs-2xl);
  padding-bottom: 8px;
  border-bottom: 1px solid var(--ds-border-light);
}

.md-h2 {
  font-size: var(--ds-fs-xl);
  padding-bottom: 6px;
  border-bottom: 1px solid var(--ds-border-light);
}

.md-h3 {
  font-size: var(--ds-fs-lg);
}

.md-h4 {
  font-size: var(--ds-fs-lg);
}

.md-h5 {
  font-size: var(--ds-fs-base);
}

.md-h6 {
  font-size: var(--ds-fs-md);
  color: var(--ds-text-2);
}

.md-body strong {
  font-weight: 600;
}

.md-body em {
  font-style: italic;
}

.md-body del {
  color: var(--ds-text-3);
}

.md-body mark {
  background: #fff3bf;
  border-radius: var(--ds-radius-xs);
  padding: 0 3px;
}

.md-link {
  color: var(--ds-blue-text);
  text-decoration: none;
  word-break: break-all;
}

.md-link:hover {
  text-decoration: underline;
}

.md-list {
  margin: 0 0 14px;
  padding-left: 26px;
}

.md-list .md-list {
  margin: 6px 0 2px;
}

.md-li {
  margin: 5px 0;
}

.md-li > .md-list {
  margin-top: 6px;
}

.md-li-task {
  list-style: none;
  margin-left: -20px;
}

.md-task {
  margin-right: 6px;
  vertical-align: middle;
}

.md-quote {
  margin: 14px 0;
  padding: 10px 16px;
  border-left: 3px solid #d5d8dd;
  background: var(--ds-bg-sidebar);
  border-radius: 0 var(--ds-radius-sm) var(--ds-radius-sm) 0;
  color: var(--ds-text-2);
}

.md-quote > *:last-child {
  margin-bottom: 0;
}

.md-hr {
  border: none;
  border-top: 1px solid var(--ds-border-light);
  margin: 24px 0;
}

.md-img {
  max-width: 100%;
  height: auto;
  border-radius: var(--ds-radius);
  border: 1px solid var(--ds-border-light);
  margin: 8px 0;
  display: block;
}

.md-code {
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, 'Courier New', monospace;
  font-size: 0.88em;
  background: var(--ds-bg-subtle);
  border: 1px solid var(--ds-border-light);
  border-radius: var(--ds-radius-xs);
  padding: 1px 5px;
  color: var(--ds-inline-code);
}

.md-codeblock {
  position: relative;
  margin: 14px 0;
  border: 1px solid var(--ds-border-light);
  border-radius: var(--ds-radius);
  background: #fbfbfc;
  overflow: hidden;
}

.md-code-lang {
  display: block;
  font-size: var(--ds-fs-xs);
  color: var(--ds-text-4);
  padding: 8px 14px 0;
  font-family: 'SFMono-Regular', Consolas, monospace;
}

.md-copy {
  position: absolute;
  top: 6px;
  right: 8px;
  border: none;
  background: rgba(255, 255, 255, 0.92);
  color: var(--ds-text-3);
  font-size: var(--ds-fs-xs);
  padding: 3px 9px;
  border-radius: var(--ds-radius-xs);
  opacity: 0;
  transition: opacity 0.15s, color 0.15s;
}

.md-codeblock:hover .md-copy,
.md-copy:focus {
  opacity: 1;
}

.md-copy:hover {
  color: var(--ds-blue-text);
}

.md-pre {
  margin: 0;
  padding: 10px 14px 14px;
  overflow-x: auto;
}

.md-codeblock-code {
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, 'Courier New', monospace;
  font-size: var(--ds-fs-sm);
  line-height: 1.65;
  white-space: pre;
  color: #2f3337;
}

/* 表格 */
.md-table-wrap {
  margin: 14px 0;
  overflow-x: auto;
  border: 1px solid var(--ds-border-light);
  border-radius: var(--ds-radius);
}

.md-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--ds-fs-md);
}

.md-table th,
.md-table td {
  padding: 9px 14px;
  border-bottom: 1px solid var(--ds-border-light);
  text-align: left;
  vertical-align: top;
}

.md-table th {
  background: var(--ds-bg-sidebar);
  font-weight: 600;
  color: var(--ds-text-2);
  white-space: nowrap;
}

.md-table tbody tr:last-child td {
  border-bottom: none;
}

.md-table tbody tr:hover td {
  background: #fcfcfd;
}

.md-align-center {
  text-align: center !important;
}

.md-align-right {
  text-align: right !important;
}

.md-align-left {
  text-align: left !important;
}

/* 语法高亮配色（浅色） */
.tok-comment {
  color: #8a8f99;
  font-style: italic;
}

.tok-string {
  color: #0a6b3d;
}

.tok-number {
  color: #0550ae;
}

.tok-keyword {
  color: #cf222e;
}

.tok-func {
  color: #8250df;
}

.tok-prop {
  color: #0550ae;
}

.tok-punct {
  color: #57606a;
}

.tok-tag {
  color: #116329;
}

.tok-attr {
  color: #0550ae;
}

.tok-doctype {
  color: #8a8f99;
}

.tok-preproc {
  color: #8250df;
}

.tok-macro {
  color: #953800;
}

.tok-selector {
  color: #116329;
}

.tok-param {
  color: #953800;
}

.tok-key {
  color: #0550ae;
}

.tok-ins {
  color: #1a7f37;
}

.tok-del {
  color: #cf222e;
}

.tok-meta {
  color: #8250df;
}

/* Toast */
.toast-wrap {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}

.toast {
  background: #1f2430;
  color: #fff;
  font-size: var(--ds-fs-sm);
  padding: 9px 16px;
  border-radius: var(--ds-radius);
  box-shadow: var(--ds-shadow);
  max-width: 90vw;
  animation: toast-in 0.22s var(--ds-ease);
}

.toast--error {
  background: #c62b30;
}

.toast--success {
  background: var(--ds-success);
}

/* 手机端：toast 不能压在 56px 高的顶栏标题上（登录欢迎语正好盖住「新对话」），
   下移到顶栏下方悬浮；桌面端保持原位不动 */
@media (max-width: 640px) {
  .toast-wrap {
    top: 64px;
  }
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
}

/* ==========================================================================
   四、响应式
   ========================================================================== */

@media (max-width: 768px) {
  .sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    transform: translateX(-100%);
    transition: transform 0.24s var(--ds-ease);
    box-shadow: var(--ds-shadow-lg);
  }

  body.sidebar-open .sidebar {
    transform: translateX(0);
  }

  body.sidebar-open .sidebar-mask {
    display: block;
  }

  .menu-btn {
    display: flex;
  }

  .messages__inner {
    padding: 18px 14px 4px;
  }

  .composer-wrap {
    padding: 4px 12px 10px;
  }

  .main__badge,
  .main__head-right {
    display: none;
  }

  .main__title {
    max-width: 52vw;
  }

  .msg--user .msg__body {
    max-width: 88%;
  }

  .suggest-grid {
    grid-template-columns: 1fr;
  }

  .auth-page__main {
    padding: 28px 20px;
  }

  .md-h1 {
    font-size: var(--ds-fs-xl);
  }

  .md-h2 {
    font-size: var(--ds-fs-lg);
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* ==========================================================================
   五、图标规范
   统一：无填充 + currentColor 描边 + 固定尺寸（不参与压缩，避免重排/重叠）
   ========================================================================== */
.icon-btn,
.input-wrap__action--icon,
.btn-send,
.btn-stop,
.msg__actions .icon-btn,
.conv-item__actions .icon-btn {
  flex: 0 0 auto;
}

.icon-btn svg,
.input-wrap__action--icon svg,
.btn-send svg,
.btn-stop svg,
.msg__avatar svg,
.welcome__logo svg,
.uc-icon svg {
  display: block;
  flex: 0 0 auto;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon-btn svg {
  width: 17px;
  height: 17px;
}

.msg__actions .icon-btn svg,
.conv-item__actions .icon-btn svg {
  width: 15px;
  height: 15px;
}

/* ==========================================================================
   六、用户中心
   ========================================================================== */

.uc {
  flex: 1 1 auto;
  min-height: 0;
  /* 用户中心是整页视图：内容超出时必须能滚动。
     父级 html/body 高度固定为视口高，且 .uc 允许被 flex 压缩（min-height:0），
     若不给自身加 overflow，超出的内容会被静默裁掉且滚不动。 */
  overflow-y: auto;
  overscroll-behavior: contain;
  /* 与条款页 / 反馈中心 / 管理后台共用同一套页面底色与留白，
     此前用户中心是纯白底，几个整页视图之间会有明显的"换了个站"的割裂感 */
  background: var(--ds-bg-subtle);
  box-sizing: border-box;
  padding: 28px 20px 56px;
}

/* 外层容器：只负责居中 */
.uc__inner {
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
}

.uc__head {
  display: flex;
  align-items: center;
  gap: 12px;
  /* 允许换行：移动端条款链接占满一行时标题不会被挤压成逐字竖排 */
  flex-wrap: wrap;
  margin-bottom: 28px;
}

/* 标题块：占据剩余宽度且不允许收缩到过窄，防止文字逐字换行 */
.uc__head__text {
  flex: 1 1 auto;
  min-width: 0;
}

.uc__title {
  font-size: var(--ds-fs-xl);
  font-weight: 650;
  margin: 0;
  letter-spacing: -0.01em;
  color: var(--ds-text-1);
}

.uc__subtitle {
  font-size: var(--ds-fs-sm);
  color: var(--ds-text-3);
  margin: 4px 0 0;
}

.uc__legal {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  font-size: var(--ds-fs-sm);
  color: var(--ds-text-4);
  flex: 0 0 auto;
}

.uc__legal a {
  color: var(--ds-text-3);
  text-decoration: none;
  transition: color 0.15s var(--ds-ease);
}

.uc__legal a:hover {
  color: var(--ds-blue);
  text-decoration: underline;
}

/* ---------- 主体：左侧窄导航 + 右侧内容（最流行的 SaaS Settings 布局） ---------- */
.uc__body {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 40px;
  align-items: start;
}

.uc-nav {
  position: sticky;
  top: 24px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 8px;
  background: var(--ds-bg-sidebar);
  border: 1px solid var(--ds-border-light);
  border-radius: var(--ds-radius-lg);
  box-shadow: var(--ds-shadow-sm);
}

.uc-nav__item {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  padding: 10px 13px;
  border: none;
  border-radius: var(--ds-radius);
  background: transparent;
  color: var(--ds-text-2);
  font-size: var(--ds-fs-md);
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s var(--ds-ease), color 0.15s var(--ds-ease);
}

.uc-nav__item .ic {
  width: 18px;
  height: 18px;
  color: var(--ds-text-3);
  transition: color 0.15s var(--ds-ease);
}

.uc-nav__item:hover {
  background: var(--ds-bg-hover);
  color: var(--ds-text-1);
}

.uc-nav__item:hover .ic {
  color: var(--ds-text-2);
}

/* 当前选中项：左侧色条 + 高亮底色，视觉层级清晰 */
.uc-nav__item.is-active {
  background: var(--ds-blue-soft);
  color: var(--ds-blue-text);
  font-weight: 600;
  box-shadow: inset 2px 0 0 var(--ds-blue);
}

.uc-nav__item.is-active .ic {
  color: var(--ds-blue);
}

.uc-nav__item:focus-visible {
  outline: 2px solid var(--ds-blue);
  outline-offset: -2px;
}

.uc-nav__label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.uc-panels {
  min-width: 0;
  width: 100%;
  /* 面板内部最大阅读宽度，避免表单拉得过长 */
  max-width: 780px;
}

/* 面板默认不渲染；只有 .is-active 才显示，避免 JS 未介入时内容全部堆叠 */
.uc-panel {
  display: none;
}

.uc-panel.is-active {
  display: block;
}

/* 卡片：更柔和、更现代、更大圆角 */
/* 卡片：底/描边/圆角/阴影全部走 --ds-card-* 令牌，
   与反馈中心、管理后台的卡片保持同一观感（此前这里用的是侧栏灰 #f9fafb） */
.uc-card {
  background: var(--ds-card-bg);
  border: 1px solid var(--ds-card-border);
  border-radius: var(--ds-card-radius);
  padding: var(--ds-card-pad);
  box-shadow: var(--ds-card-shadow);
}

/* 卡片底色统一由 --ds-card-bg 提供（暗色块里已重定义），这里只保留暗色阴影 */
:root[data-theme='dark'] .uc-card {
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2), 0 1px 2px rgba(0, 0, 0, 0.16);
}

/* 暗色模式：导航选中态与图片缩略图描边的对应值 */
:root[data-theme='dark'] .uc-nav__item.is-active {
  background: var(--ds-blue-soft);
  color: var(--ds-blue-text);
}

:root[data-theme='dark'] .attach-item__thumb,
:root[data-theme='dark'] .msg-attach__thumb {
  border-color: var(--ds-border);
}

:root[data-theme='dark'] .attach-item--image.attach-item--ready .attach-item__thumb,
:root[data-theme='dark'] .attach-item--video.attach-item--ready .attach-item__thumb {
  border-color: var(--ds-blue-border);
}

.uc-panel > .uc-card {
  margin-bottom: 0;
}

.uc-card + .uc-card {
  margin-top: 20px;
}

.uc-card--plain {
  background: var(--ds-bg-sidebar);
}

.uc-card__title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: var(--ds-fs-lg);
  font-weight: 600;
  color: var(--ds-text-1);
  margin: 0 0 8px;
}

.uc-card__title .ic {
  width: 18px;
  height: 18px;
  color: var(--ds-blue);
}

.uc-card__desc {
  font-size: var(--ds-fs-sm);
  line-height: 1.65;
  color: var(--ds-text-3);
  margin: 0 0 24px;
}

.uc-grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

/* 账号信息 */
.uc-profile {
  display: flex;
  align-items: center;
  gap: 22px;
  flex-wrap: wrap;
}

.uc-avatar {
  position: relative;
  width: 88px;
  height: 88px;
  flex: 0 0 88px;
  border-radius: 50%;
  background: linear-gradient(135deg, #5b7cff, #3964fe);
  color: #fff;
  font-size: var(--ds-fs-3xl);
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  box-shadow: 0 8px 22px rgba(57, 100, 254, 0.22);
}

.uc-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  position: absolute;
  inset: 0;
}

.uc-profile__meta {
  flex: 1 1 220px;
  min-width: 0;
}

.uc-profile__name {
  font-size: var(--ds-fs-lg);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  color: var(--ds-text-1);
  margin: 0 0 12px;
}

.uc-profile__row {
  font-size: var(--ds-fs-sm);
  color: var(--ds-text-3);
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 7px;
  word-break: break-all;
}

.uc-profile__row b {
  color: var(--ds-text-2);
  font-weight: 500;
}

.uc-profile__row .ic {
  width: 15px;
  height: 15px;
  color: var(--ds-text-4);
}

.uc-badge {
  font-size: var(--ds-fs-2xs);
  font-weight: 500;
  color: var(--ds-blue-text);
  background: var(--ds-blue-soft);
  border-radius: var(--ds-radius-pill);
  padding: 2px 9px;
}

/* 头像编辑 */
.uc-avatar-editor {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
  align-items: flex-start;
}

.uc-crop {
  width: 220px;
  height: 220px;
  flex: 0 0 220px;
  border-radius: var(--ds-radius);
  border: 1px dashed var(--ds-border);
  background: var(--ds-bg-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
}

.uc-crop canvas,
.uc-crop img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.uc-crop__empty {
  text-align: center;
  font-size: var(--ds-fs-sm);
  color: var(--ds-text-3);
  padding: 16px;
}

.uc-avatar-tools {
  flex: 1 1 260px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.uc-file {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.uc-file input[type='file'] {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.uc-range {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: var(--ds-fs-sm);
  color: var(--ds-text-3);
}

.uc-range input[type='range'] {
  flex: 1;
  min-width: 160px;
  accent-color: var(--ds-blue);
}

.uc-hint {
  font-size: var(--ds-fs-sm);
  color: var(--ds-text-3);
  line-height: 1.7;
}

.uc-hint--error {
  color: var(--ds-danger-text);
}

/* ---------------- 模型选择（用户中心） ---------------- */

.uc-model-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.uc-model-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--ds-border);
  border-radius: var(--ds-radius-sm);
  background: var(--ds-bg-subtle);
  transition: border-color 0.15s var(--ds-ease), background 0.15s var(--ds-ease);
}

.uc-model-item.is-on {
  background: var(--ds-bg);
  border-color: var(--ds-blue-soft);
}

/* 关闭的条目整体压暗，与"可用"形成一眼可辨的对比 */
.uc-model-item.is-off {
  opacity: 0.72;
}

.uc-model-item__main {
  flex: 1 1 auto;
  min-width: 0;
}

.uc-model-item__name {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: var(--ds-fs-md);
  font-weight: 600;
  color: var(--ds-text-1);
}

.uc-model-item__sub {
  margin-top: 3px;
  font-size: var(--ds-fs-xs);
  color: var(--ds-text-4);
}

/* 与模型菜单里的「支持附件」标签保持同一套视觉 */
.uc-model-tag {
  flex: 0 0 auto;
  font-size: var(--ds-fs-2xs);
  font-weight: 400;
  color: var(--ds-blue-text);
  background: var(--ds-blue-soft);
  border-radius: var(--ds-radius-pill);
  padding: 1px 8px;
}

.uc-model-actions {
  display: flex;
  align-items: center;
  gap: 16px;
  flex: 0 0 auto;
}

/* 默认模型：单选 */
.uc-model-default {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: var(--ds-fs-sm);
  color: var(--ds-text-3);
  cursor: pointer;
  user-select: none;
}

.uc-model-default input {
  width: 15px;
  height: 15px;
  margin: 0;
  accent-color: var(--ds-blue);
}

.uc-model-default.is-on {
  color: var(--ds-blue-text);
  font-weight: 600;
}

.uc-model-default.is-locked {
  opacity: 0.45;
  cursor: not-allowed;
}

/* 启用 / 禁用开关 */
.uc-switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

/* 原生 checkbox 视觉隐藏但仍可 Tab 聚焦：轨道与文字由下面的 span 画，
   点击 label（轨道/文字）即可切换，键盘用户则靠 :focus-visible 的描边 */
.uc-switch input {
  position: absolute;
  width: 0;
  height: 0;
  opacity: 0;
  margin: 0;
}

.uc-switch__track {
  position: relative;
  flex: 0 0 auto;
  width: 38px;
  height: 22px;
  border-radius: var(--ds-radius-pill);
  background: var(--ds-border);
  transition: background 0.18s var(--ds-ease);
}

.uc-switch__thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.22);
  transition: transform 0.18s var(--ds-ease);
}

.uc-switch input:checked + .uc-switch__track {
  background: var(--ds-blue);
}

.uc-switch input:checked + .uc-switch__track .uc-switch__thumb {
  transform: translateX(16px);
}

.uc-switch input:focus-visible + .uc-switch__track {
  outline: 2px solid var(--ds-blue);
  outline-offset: 2px;
}

.uc-switch__text {
  font-size: var(--ds-fs-sm);
  color: var(--ds-text-3);
}

.uc-model-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 18px;
}

/* 按钮 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 1px solid transparent;
  border-radius: var(--ds-radius);
  padding: 0 16px;
  height: 38px;
  font-size: var(--ds-fs-md);
  font-weight: 500;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.btn--primary {
  background: var(--ds-blue);
  color: #fff;
}

.btn--primary:hover:not(:disabled) {
  background: var(--ds-blue-hover);
}

.btn--ghost {
  background: transparent;
  border-color: var(--ds-border);
  color: var(--ds-text-2);
}

.btn--ghost:hover:not(:disabled) {
  border-color: var(--ds-blue-text);
  color: var(--ds-blue-text);
}

.btn--danger {
  background: transparent;
  border-color: var(--ds-border);
  color: var(--ds-danger-text);
}

.btn--danger:hover:not(:disabled) {
  border-color: var(--ds-danger);
  background: var(--ds-danger-soft);
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn__spinner {
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.45);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: none;
}

.btn.is-loading .btn__spinner {
  display: block;
}

/* 用量统计（现代数据卡片） */
.usage-page__foot {
  font-size: var(--ds-fs-sm);
  color: var(--ds-text-3);
  margin: 0 0 20px;
}

.usage-cards {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.usage-cards--three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.stat-card {
  background: var(--ds-bg-sidebar);
  border: 1px solid var(--ds-border-light);
  border-radius: var(--ds-radius);
  padding: 18px 20px;
  min-width: 0;
  box-shadow: var(--ds-shadow-sm);
}

.stat-card__label {
  font-size: var(--ds-fs-sm);
  color: var(--ds-text-3);
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.stat-card__value {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin-top: 10px;
  flex-wrap: wrap;
}

.stat-card__number {
  font-size: var(--ds-fs-3xl);
  font-weight: 700;
  letter-spacing: -0.4px;
  font-variant-numeric: tabular-nums;
  color: var(--ds-text-1);
}

.stat-card__unit {
  font-size: var(--ds-fs-sm);
  color: var(--ds-text-3);
}

.usage-bar {
  height: 6px;
  border-radius: var(--ds-radius-xs);
  background: var(--ds-border-light);
  overflow: hidden;
  margin-top: 14px;
}

.usage-bar i {
  display: block;
  height: 100%;
  background: #f85000;
  border-radius: var(--ds-radius-xs);
  transition: width 0.3s var(--ds-ease);
}

.usage-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 18px 0 12px;
  border-top: 1px solid var(--ds-border-light);
  margin-top: 18px;
}

.seg {
  display: inline-flex;
  background: var(--ds-bg-subtle);
  border-radius: var(--ds-radius-sm);
  padding: 3px;
  gap: 3px;
}

.seg__btn {
  border: none;
  background: transparent;
  color: var(--ds-text-2);
  font-size: var(--ds-fs-sm);
  padding: 5px 12px;
  border-radius: var(--ds-radius-xs);
}

.seg__btn.is-active {
  background: var(--ds-bg);
  color: var(--ds-text);
  font-weight: 600;
  box-shadow: var(--ds-shadow-sm);
}

.select {
  border: 1px solid var(--ds-border);
  border-radius: var(--ds-radius-sm);
  background: var(--ds-bg);
  color: var(--ds-text-2);
  font-size: var(--ds-fs-sm);
  padding: 6px 10px;
  outline: none;
}

.select:focus {
  border-color: var(--ds-blue);
}

.chart-card {
  background: var(--ds-bg-sidebar);
  border: 1px solid var(--ds-border-light);
  border-radius: var(--ds-radius);
  padding: 20px;
  margin-top: 4px;
}

.chart-card__head {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.chart-card__title {
  font-size: var(--ds-fs-md);
  font-weight: 600;
  color: var(--ds-text-1);
}

.chart-card__value {
  font-size: var(--ds-fs-sm);
  color: var(--ds-text-3);
}

.chart-card__legend {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: var(--ds-fs-xs);
  color: var(--ds-text-3);
}

.legend-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: var(--ds-radius-xs);
  margin-right: 5px;
}

.chart-svg {
  display: block;
  width: 100%;
  height: auto;
}

.chart-grid line {
  stroke: var(--ds-border-light);
  stroke-width: 1;
}

.chart-axis {
  font-size: var(--ds-fs-2xs);
  fill: var(--ds-text-3);
}

.chart-empty {
  padding: 40px 12px;
  text-align: center;
  font-size: var(--ds-fs-sm);
  color: var(--ds-text-3);
}

.usage-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--ds-fs-sm);
  margin-top: 14px;
}

.usage-table th,
.usage-table td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--ds-border-light);
  white-space: nowrap;
}

.usage-table th {
  color: var(--ds-text-3);
  font-weight: 500;
  font-size: var(--ds-fs-xs);
  background: var(--ds-bg-subtle);
}

.usage-table td {
  color: var(--ds-text-2);
  font-variant-numeric: tabular-nums;
}

.usage-table td:first-child {
  color: var(--ds-text);
  white-space: normal;
  word-break: break-all;
}

.usage-table tr:last-child td {
  border-bottom: none;
}

.usage-table__wrap {
  overflow-x: auto;
  border: 1px solid var(--ds-border-light);
  border-radius: var(--ds-radius);
}

.uc-section-gap {
  height: 6px;
}

/* ==========================================================================
   七、暗色模式（由 app.js 写入 <html data-theme="dark">）
   ========================================================================== */
:root[data-theme='dark'] {
  --ds-bg: #15161a;
  --ds-bg-sidebar: #1c1d22;
  --ds-bg-subtle: #24262c;
  --ds-bg-hover: #2b2d34;
  --ds-bg-active: #26304a;
  --ds-border: #3a3d45;
  --ds-border-light: #2c2e34;

  --ds-text: #eceef1;
  /* 暗色下的一级标题色（与浅色保持一致的存在性） */
  --ds-text-1: #f5f7fa;
  --ds-text-2: #c9ccd2;
  --ds-text-3: #a9aeb7;
  --ds-text-4: #9aa0a8;
  --ds-placeholder: #8b9099;

  --ds-blue-soft: #232a44;
  --ds-blue-soft-2: #2b3557;
  --ds-blue-border: #46527d;
  --ds-blue-text: #9fb5ff;
  --ds-inline-code: #ff9dc0;

  --ds-danger: #ff7377;
  --ds-danger-text: #ff8a8d;
  --ds-danger-soft: #3b2326;
  --ds-danger-border: #6b3a3d;
  --ds-success: #159a58;
  --ds-warning: #f0b046;

  --ds-shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --ds-shadow: 0 4px 16px rgba(0, 0, 0, 0.45);
  --ds-shadow-lg: 0 18px 48px rgba(0, 0, 0, 0.55);

  /* 暗色下整页底色用的是 --ds-bg-subtle（#24262c），若卡片也跟着用同一个值，
     卡片会与页面糊成一片。这里把卡片压到 --ds-bg-sidebar（#1c1d22），
     靠"比页面更深一档 + 描边"形成层次，与浅色"白卡片浮在浅灰页上"是同一套逻辑。 */
  --ds-card-bg: var(--ds-bg-sidebar);

  /* 移动端用户气泡：深蓝灰底 + 亮字（对比度 7.4:1） */
  --ds-user-bubble: #2b3557;
  --ds-user-bubble-text: #e8edfa;
}

/* 暗色下的非令牌色修正 */
:root[data-theme='dark'] .main__head {
  background: rgba(21, 22, 26, 0.88);
}

:root[data-theme='dark'] .composer-wrap {
  background: linear-gradient(180deg, rgba(21, 22, 26, 0) 0%, #15161a 30%);
}

:root[data-theme='dark'] .md-codeblock {
  background: #1e2025;
}

:root[data-theme='dark'] .md-codeblock-code {
  color: #d7dae0;
}

:root[data-theme='dark'] .md-table tbody tr:hover td {
  background: #23252b;
}

/* 附件卡片：暗色下用令牌色 + 透明蓝，避免浅色硬编码造成过亮 */
:root[data-theme='dark'] .attach-item--ready {
  border-color: rgba(159, 181, 255, 0.4);
  background: rgba(159, 181, 255, 0.08);
}

:root[data-theme='dark'] .attach-item__name,
:root[data-theme='dark'] .msg-attach__name {
  color: var(--ds-text);
}

:root[data-theme='dark'] .attach-item__act {
  color: var(--ds-text-2);
}

:root[data-theme='dark'] .composer:hover {
  border-color: #4a4e57;
}

:root[data-theme='dark'] .md-img {
  border-color: var(--ds-border);
}

:root[data-theme='dark'] .md-quote {
  border-left-color: #4a4e57;
}

:root[data-theme='dark'] .env-banner {
  background: #3a3117;
  border-bottom-color: #4d411f;
  color: #f3d18a;
}

:root[data-theme='dark'] .env-banner.is-error {
  background: var(--ds-danger-soft);
  border-bottom-color: #5a3135;
  color: #ffb3b5;
}

:root[data-theme='dark'] .env-banner code {
  background: rgba(255, 255, 255, 0.12);
}

:root[data-theme='dark'] .toast {
  background: #2c2f36;
  color: #f2f3f5;
}

:root[data-theme='dark'] .btn-primary:disabled,
:root[data-theme='dark'] .btn--primary:disabled {
  background: #38415e;
  color: var(--ds-text-2);
  opacity: 0.85;
}

:root[data-theme='dark'] .btn-send:disabled {
  background: #33363d;
  color: #7e848d;
}

:root[data-theme='dark'] .btn-stop {
  background: #e4e6ea;
  color: #1b1c1e;
}

:root[data-theme='dark'] .avatar,
:root[data-theme='dark'] .uc-avatar,
:root[data-theme='dark'] .welcome__logo,
:root[data-theme='dark'] .msg__avatar {
  box-shadow: none;
}

:root[data-theme='dark'] .msg--user .msg__avatar {
  background: #3a3d45;
  color: #dfe1e5;
}

:root[data-theme='dark'] .strength__bars i {
  background: #33363d;
}

:root[data-theme='dark'] .usage-bar i {
  background: #ff6a2b;
}

:root[data-theme='dark'] .md-code {
  background: #26282e;
  border-color: #33363d;
}

/* 暗色语法高亮 */
:root[data-theme='dark'] .tok-comment {
  color: #8b939e;
}

:root[data-theme='dark'] .tok-string {
  color: #7fd6a2;
}

:root[data-theme='dark'] .tok-number {
  color: #82b4ff;
}

:root[data-theme='dark'] .tok-keyword {
  color: #ff8f97;
}

:root[data-theme='dark'] .tok-func {
  color: #c9a4ff;
}

:root[data-theme='dark'] .tok-prop {
  color: #82b4ff;
}

:root[data-theme='dark'] .tok-punct {
  color: #aeb3bb;
}

:root[data-theme='dark'] .tok-tag {
  color: #7fd6a2;
}

:root[data-theme='dark'] .tok-attr {
  color: #82b4ff;
}

:root[data-theme='dark'] .tok-preproc,
:root[data-theme='dark'] .tok-meta {
  color: #c9a4ff;
}

:root[data-theme='dark'] .tok-macro,
:root[data-theme='dark'] .tok-param {
  color: #ffc48a;
}

:root[data-theme='dark'] .tok-selector {
  color: #7fd6a2;
}

:root[data-theme='dark'] .tok-key {
  color: #82b4ff;
}

:root[data-theme='dark'] .tok-ins {
  color: #7fd6a2;
}

:root[data-theme='dark'] .tok-del {
  color: #ff8f97;
}

/* 暗色补充：以下位置原本硬编码了浅色值，暗色下会「发白」或直接不可读 */
:root[data-theme='dark'] .md-body mark {
  /* 浅色下是 #fff3bf 底 + 深字；暗色下必须换成深底，否则 --ds-text 在白底上几乎不可见 */
  background: #4a4326;
  color: #f7e9b0;
}

:root[data-theme='dark'] .input-wrap:hover:not(.is-disabled):not(.is-focus):not(.is-error) {
  border-color: #4a4d56;
}

:root[data-theme='dark'] .cap:hover:not([data-on='true']),
:root[data-theme='dark'] .model-switch__btn:hover {
  border-color: #4a4d56;
}

:root[data-theme='dark'] .md-copy {
  background: rgba(38, 40, 46, 0.94);
  border-color: #3a3d45;
  color: #c9ccd2;
}

:root[data-theme='dark'] .md-copy:hover {
  background: #34373e;
  color: #f5f7fa;
}

/* 状态徽标：浅色底在暗色卡片上过于刺眼，且 12px 字号需要更高的对比度 */
:root[data-theme='dark'] .fb-status--open {
  background: #3a2f1b;
  color: #f0b970;
}

:root[data-theme='dark'] .fb-status--resolved {
  background: #1d3527;
  color: #6fd39b;
}

/* 暗色下停止按钮本身是浅色按钮（#e4e6ea + 深色字），
   浅色主题的 hover（纯黑底）在这里会变成黑底黑字，必须单独给 hover */
:root[data-theme='dark'] .btn-stop:hover:not(:disabled) {
  background: #c9ccd2;
}

/* ==========================================================================
   八、响应式补充
   ========================================================================== */
@media (max-width: 900px) {
  .usage-cards,
  .usage-cards--three {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  /* 769-900px 时密码面板只有 ~445px 宽，两栏会让每个输入框窄到 186px（占位符被截断），
     所以单栏断点要从 768 上提到 900 */
  .uc-grid-2 {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .uc__inner {
    padding: 20px 16px 40px;
  }

  .uc__head {
    margin-bottom: 18px;
  }

  .uc__title {
    font-size: var(--ds-fs-xl);
  }

  .uc__legal {
    width: 100%;
    margin-left: 0;
    padding-top: 6px;
    border-top: 1px solid var(--ds-border-light);
  }

  /* 移动端：左侧导航改成顶部横向标签条 */
  .uc__body {
    grid-template-columns: minmax(0, 1fr);
    gap: 14px;
  }

  /* 移动端顶部标签条：改用自适应网格，五个面板全部平铺可见。
     原来是横向滚动条——第 5 个「模型选择」藏在屏幕外，用户根本不知道有这一项。 */
  .uc-nav {
    position: sticky;
    top: 0;
    z-index: 2;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(88px, 1fr));
    gap: 6px;
    padding: 5px;
    max-width: none;
    margin: 0;
  }

  .uc-nav__item {
    width: 100%;
    min-height: 38px;
    justify-content: center;
    gap: 6px;
    padding: 8px 6px;
    font-size: var(--ds-fs-sm);
    white-space: nowrap;
  }

  .uc-nav__label {
    overflow: hidden;
    text-overflow: ellipsis;
  }

  /* 横向导航用底部色条更自然 */
  .uc-nav__item.is-active {
    box-shadow: inset 0 -2px 0 var(--ds-blue);
  }

  .uc-panels {
    max-width: none;
  }

  /* 卡片内边距由 --ds-card-pad 统一提供，见文件末尾的移动端统一块 */

  .uc-crop {
    width: 100%;
    flex: 1 1 auto;
    height: 220px;
  }

  .usage-cards,
  .usage-cards--three {
    grid-template-columns: 1fr;
  }

  .stat-card__number {
    font-size: var(--ds-fs-xl);
  }

  .chart-card {
    padding: 14px;
  }

  .env-banner {
    font-size: var(--ds-fs-xs);
    padding: 6px 10px;
    text-align: center;
  }
}

/* ==========================================================================
   九、统一图标容器与用户中心补充
   ========================================================================== */

/* 图标占位容器：尺寸固定，不参与 flex 压缩，避免与文字重叠或引起重排 */
.ic {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 17px;
  height: 17px;
  color: inherit;
}

.ic svg {
  display: block;
  width: 100%;
  height: 100%;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.input-wrap__prefix.ic {
  width: 16px;
  height: 16px;
  padding: 0;
  margin-left: 16px;
  color: var(--ds-text-2);
}

.input-wrap__prefix.ic + .input-wrap__divider {
  margin-left: 10px;
}

.field__error {
  display: flex;
  align-items: center;
  gap: 5px;
}

.field__error .ic {
  width: 13px;
  height: 13px;
}

.form-alert .ic {
  margin-top: 2px;
}

.conv-group__title .ic {
  width: 11px;
  height: 11px;
}

.conv-group__caret {
  transition: transform 0.2s var(--ds-ease);
}

/* 侧栏底部头像按钮 */
.avatar--button {
  border: none;
  padding: 0;
  cursor: pointer;
  overflow: hidden;
  position: relative;
  transition: box-shadow 0.15s var(--ds-ease);
}

.avatar--button:hover {
  box-shadow: 0 0 0 3px var(--ds-blue-soft);
}

.avatar--button:focus-visible {
  outline: 2px solid var(--ds-blue);
  outline-offset: 2px;
}

.avatar__img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.uc-avatar img {
  position: absolute;
  inset: 0;
}

.uc-avatar {
  position: relative;
}

.uc-avatar > span {
  position: relative;
}

.uc-crop__empty .ic {
  width: 26px;
  height: 26px;
  color: var(--ds-text-4);
  margin: 0 auto 6px;
}

.usage-table__wrap {
  overflow-x: auto;
}

.seg__btn:focus-visible,
.select:focus-visible,
.btn:focus-visible,
.icon-btn:focus-visible {
  outline: 2px solid var(--ds-blue);
  outline-offset: 2px;
}

/* ======================================================================
   附件：待发列表 + 消息内卡片
   ====================================================================== */

.attach-list {
  display: none;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
}

.attach-list.is-visible {
  display: flex;
}

.attach-item {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 1 auto;
  min-width: 0;
  max-width: 100%;
  padding: 7px 8px 7px 10px;
  border: 1px solid var(--ds-border);
  border-radius: var(--ds-radius);
  background: var(--ds-bg-subtle);
}

.attach-item--ready {
  border-color: rgba(57, 100, 254, 0.35);
  background: rgba(57, 100, 254, 0.04);
}

.attach-item--error {
  border-color: var(--ds-danger-border);
  background: var(--ds-danger-soft);
}

/* 图片缩略图（待发区）：可点击放大 */
.attach-item__thumb {
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  border-radius: var(--ds-radius-xs);
  object-fit: cover;
  object-position: center;
  background: var(--ds-bg-subtle);
  border: 1px solid var(--ds-border);
  display: block;
  cursor: zoom-in;
}

.attach-item__thumb:hover {
  filter: brightness(0.94);
}

.attach-item--image.attach-item--ready .attach-item__thumb,
.attach-item--video.attach-item--ready .attach-item__thumb {
  border-color: var(--ds-blue-border, var(--ds-border));
}

/* 视频缩略图：<video> 渲染首帧作封面，给黑底避免加载前闪白 */
.attach-item--video .attach-item__thumb,
.msg-attach--video .msg-attach__thumb {
  background: #000;
}

.attach-item--error .attach-item__thumb {
  display: none;
}

.attach-item__icon {
  display: flex;
  flex: 0 0 auto;
  color: var(--ds-text-3);
}

.attach-item--ready .attach-item__icon {
  color: var(--ds-blue-text);
}

.attach-item--error .attach-item__icon {
  color: var(--ds-danger-text);
}

.attach-item__info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  max-width: 260px;
}

.attach-item__name {
  font-size: var(--ds-fs-sm);
  font-weight: 500;
  color: var(--ds-text-1);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.attach-item__status {
  font-size: var(--ds-fs-2xs);
  color: var(--ds-text-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.attach-item--error .attach-item__status {
  color: var(--ds-danger-text);
}

.attach-item__bar {
  display: block;
  height: 3px;
  border-radius: var(--ds-radius-xs);
  background: var(--ds-border);
  overflow: hidden;
  margin-top: 2px;
}

.attach-item__bar-fill {
  display: block;
  height: 100%;
  background: var(--ds-blue);
  border-radius: var(--ds-radius-xs);
  transition: width 0.15s linear;
}

.attach-item__act {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex: 0 0 auto;
  height: 26px;
  padding: 0 8px;
  border: 1px solid var(--ds-border);
  border-radius: var(--ds-radius-sm);
  background: var(--ds-bg);
  color: var(--ds-text-2);
  font-size: var(--ds-fs-xs);
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}

.attach-item__act:hover {
  border-color: var(--ds-blue);
  color: var(--ds-blue-text);
}

.attach-item__act--del {
  padding: 0 5px;
  border-color: transparent;
  background: transparent;
  color: var(--ds-text-4);
}

.attach-item__act--del:hover {
  border-color: var(--ds-danger-border);
  background: var(--ds-danger-soft);
  color: var(--ds-danger-text);
}

.attach-item__act-txt {
  white-space: nowrap;
}

/* 已发送消息里的附件卡片 */
.msg__attachments {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 8px;
}

.msg-attach {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border: 1px solid var(--ds-border);
  border-radius: var(--ds-radius);
  background: var(--ds-bg-subtle);
}

.msg-attach__icon {
  display: flex;
  flex: 0 0 auto;
  color: var(--ds-blue-text);
}

/* 已发送消息里的图片缩略图 */
.msg-attach__thumb {
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  border-radius: var(--ds-radius-xs);
  object-fit: cover;
  object-position: center;
  display: block;
  border: 1px solid var(--ds-border);
  background: var(--ds-bg-subtle);
}

.msg-attach--image {
  padding: 6px 10px 6px 6px;
}

.msg-attach__info {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
  flex: 1 1 auto;
}

.msg-attach__name {
  font-size: var(--ds-fs-sm);
  font-weight: 500;
  color: var(--ds-text-1);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.msg-attach__detail {
  font-size: var(--ds-fs-2xs);
  color: var(--ds-text-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ===== 媒体附件（已发送）与放大预览 ===== */
.msg-attach__media {
  position: relative;
  flex: 0 0 auto;
  display: flex;
}

.msg-attach__thumb {
  cursor: zoom-in;
  transition: filter 0.16s var(--ds-ease), transform 0.16s var(--ds-ease);
}

.msg-attach__media:hover .msg-attach__thumb {
  filter: brightness(1.06);
}

/* ===== 消息里的媒体附件：图片在上、文件名与操作在下方一行（参考样式） ===== */
.msg-attach--media {
  flex-direction: column;
  /* 用户气泡本来就靠右，这里再对齐一次，让图片与气泡右边缘齐平 */
  align-items: flex-end;
  gap: 6px;
  padding: 0;
  border: none;
  background: transparent;
  max-width: 100%;
}

.msg-attach--media .msg-attach__media {
  border-radius: 16px;
  overflow: hidden;
  box-shadow: var(--ds-shadow-sm);
}

.msg-attach--media .msg-attach__thumb {
  width: 168px;
  height: 168px;
  border: none;
  border-radius: 16px;
  background: var(--ds-bg-subtle);
}

/* 移动端再收一点：168px 在窄屏气泡里会把整条消息撑得过宽 */
@media (max-width: 640px) {
  .msg-attach--media .msg-attach__thumb {
    width: 136px;
    height: 136px;
  }
}

.msg-attach__foot {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  width: 100%;
  min-width: 0;
}

.msg-attach--media .msg-attach__info {
  align-items: flex-end;
  text-align: right;
  flex: 0 1 auto;
}

.msg-attach--media .msg-attach__acts {
  flex: 0 0 auto;
  margin-left: 0;
}

/* 操作按钮（复制 / 用这张图重新提问）从缩略图上挪到卡片右侧：
   叠在图上时只有 36px 的小图会被盖住大半，点图放大经常点不中；
   常驻显示也让触屏设备（没有 hover）能找到这两个入口。 */
.msg-attach__acts {
  display: flex;
  gap: 2px;
  flex: 0 0 auto;
  margin-left: auto;
  align-self: center;
}

.msg-attach__acts .icon-btn {
  width: 26px;
  height: 26px;
  padding: 0;
  color: var(--ds-text-3);
}

.msg-attach__acts .icon-btn:hover {
  background: var(--ds-bg-hover);
  color: var(--ds-text-1);
}

/* 大图 / 大视频全屏预览（可放大缩小） */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.86);
  animation: lightbox-in 0.16s var(--ds-ease);
}

/* 缩放/平移的舞台：铺满整个遮罩，把手势限制在它内部，
   由它承载滚轮、指针与双击事件 */
.lightbox__stage {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 48px;
  /* 关键：关掉浏览器自身的触摸手势，否则双指捏合会去缩放整个页面 */
  touch-action: none;
  cursor: zoom-in;
}

.lightbox__stage.is-grabbing {
  cursor: grabbing;
}

.lightbox__media {
  max-width: 100%;
  max-height: 100%;
  border-radius: var(--ds-radius-xs);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.45);
  background: #000;
  /* 变换以中心为原点，JS 里的锚点缩放公式依赖这个前提 */
  transform-origin: center center;
  will-change: transform;
  -webkit-user-select: none;
  user-select: none;
}

/* 放大后图片会超出舞台，用 max-width/height 限制的是 100% 那一档，
   这里把限制放开到舞台尺寸，实际由 scale 控制显示大小 */
.lightbox__stage img.lightbox__media {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.lightbox__bar {
  position: absolute;
  left: 50%;
  bottom: 26px;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 5px;
  border-radius: var(--ds-radius-pill);
  background: rgba(24, 26, 32, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.14);
  backdrop-filter: blur(10px);
  z-index: 2;
}

.lightbox__tool,
.lightbox__scale {
  height: 34px;
  min-width: 34px;
  border: none;
  border-radius: var(--ds-radius-pill);
  background: transparent;
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s var(--ds-ease);
}

.lightbox__scale {
  padding: 0 12px;
  font-size: var(--ds-fs-xs);
  font-variant-numeric: tabular-nums;
  min-width: 62px;
}

.lightbox__tool:hover,
.lightbox__scale:hover {
  background: rgba(255, 255, 255, 0.16);
}

.lightbox__caption {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 74px;
  text-align: center;
  font-size: var(--ds-fs-xs);
  color: rgba(255, 255, 255, 0.72);
  padding: 0 20px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  pointer-events: none;
}

.lightbox__close {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 3;
  color: #fff;
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.2);
}

.lightbox__close:hover {
  background: rgba(255, 255, 255, 0.22);
  color: #fff;
}

@keyframes lightbox-in {
  from {
    opacity: 0;
  }
}

/* ===== 参考来源（智能搜索开启时展示） ===== */
.md-sources {
  margin: 12px 0 0;
  border-top: 1px solid var(--ds-border);
  padding-top: 10px;
}

.md-sources__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.md-sources__title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: var(--ds-fs-xs);
  font-weight: 600;
  color: var(--ds-text-2);
  margin-bottom: 6px;
}

/* 相关度 / 时间 排序切换：胶囊分段控件，与站内其他小控件同一语言 */
.md-sources__sort {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 2px;
  margin-bottom: 6px;
  border: 1px solid var(--ds-border);
  border-radius: var(--ds-radius-pill);
  background: var(--ds-bg-subtle);
}

.md-sources__sort-btn {
  border: 0;
  background: transparent;
  color: var(--ds-text-3);
  font-size: var(--ds-fs-xs);
  line-height: 1.4;
  padding: 3px 10px;
  border-radius: var(--ds-radius-pill);
  transition: background 0.15s var(--ds-ease), color 0.15s var(--ds-ease);
}

.md-sources__sort-btn:hover {
  color: var(--ds-text-1);
}

.md-sources__sort-btn.is-active {
  background: var(--ds-bg);
  color: var(--ds-blue-text);
  box-shadow: var(--ds-shadow-sm);
}

.md-sources__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.md-sources__item {
  font-size: var(--ds-fs-xs);
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.md-sources__item a {
  color: var(--ds-blue-text);
  text-decoration: none;
}

.md-sources__item a:hover {
  text-decoration: underline;
}

.md-sources__index {
  display: inline-block;
  min-width: 14px;
  margin-right: 4px;
  color: var(--ds-text-4);
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.md-sources__host {
  color: var(--ds-text-3);
  margin-left: 6px;
}

.md-sources__more {
  margin-top: 6px;
  border: 1px solid var(--ds-border);
  background: var(--ds-bg-subtle);
  color: var(--ds-text-2);
  font-size: var(--ds-fs-xs);
  padding: 4px 12px;
  border-radius: var(--ds-radius-pill);
  transition: background 0.15s var(--ds-ease), color 0.15s var(--ds-ease);
}

.md-sources__more:hover {
  background: var(--ds-bg-hover);
  color: var(--ds-text-1);
}

/* 检索中 / 未命中：弱化成一则说明文字，不抢正文注意力 */
.md-sources--state .md-sources__title {
  color: var(--ds-text-4);
  font-weight: 500;
}

.md-sources__hint {
  font-size: var(--ds-fs-xs);
  color: var(--ds-text-4);
}

.md-sources__hint--loading::before {
  content: '';
  display: inline-block;
  width: 10px;
  height: 10px;
  margin-right: 6px;
  vertical-align: -1px;
  border: 2px solid var(--ds-border);
  border-top-color: var(--ds-blue);
  border-radius: 50%;
  animation: md-spin 0.7s linear infinite;
}

@keyframes md-spin {
  to {
    transform: rotate(360deg);
  }
}

/* ======================================================================
   法律条款页（用户协议 / 隐私政策）
   ====================================================================== */

/* 条款页整体铺满：内容比视口高时不能被裁成 100vh，
   否则滚动到下方会露出 body 的白色底，形成割裂的"白色板块"。
   body 是 height:100% 的 flex 列容器，子项默认会被压缩，
   因此必须显式声明 flex: 1 0 auto，让容器高度由内容决定。 */
.legal {
  display: flex;
  flex-direction: column;
  flex: 1 0 auto;
  min-height: 100vh;
  box-sizing: border-box;
  background: var(--ds-bg-subtle);
  padding: 28px 20px 56px;
}

.legal__inner {
  flex: 1 0 auto;
  width: 100%;
  max-width: 820px;
  margin: 0 auto;
}

.legal__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

/* 返回按钮已统一为跨页面共用的 .page-back，本处的专属定义随之删除 */
.legal__tabs {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px;
  border-radius: var(--ds-radius);
  background: var(--ds-bg-subtle);
  border: 1px solid var(--ds-border);
}

.legal__tab {
  display: inline-flex;
  align-items: center;
  height: 32px;
  padding: 0 14px;
  border-radius: var(--ds-radius-sm);
  font-size: var(--ds-fs-sm);
  color: var(--ds-text-2);
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
}

.legal__tab:hover {
  color: var(--ds-blue-text);
}

.legal__tab.is-active {
  background: var(--ds-bg);
  color: var(--ds-blue-text);
  font-weight: 600;
  box-shadow: var(--ds-shadow-sm);
}

.legal__doc {
  background: var(--ds-bg);
  border: 1px solid var(--ds-border);
  border-radius: var(--ds-radius-lg);
  padding: var(--ds-card-pad);
  box-shadow: var(--ds-shadow-sm);
}

.legal__title {
  font-size: var(--ds-fs-2xl);
  font-weight: 700;
  color: var(--ds-text-1);
  margin-bottom: 6px;
  letter-spacing: 0.01em;
}

.legal__meta {
  font-size: var(--ds-fs-xs);
  color: var(--ds-text-4);
  padding-bottom: 18px;
  margin-bottom: 22px;
  border-bottom: 1px solid var(--ds-border);
}

.legal__h2 {
  font-size: var(--ds-fs-lg);
  font-weight: 650;
  color: var(--ds-text-1);
  margin: 26px 0 10px;
}

.legal__h2:first-of-type {
  margin-top: 0;
}

.legal__doc p {
  font-size: var(--ds-fs-md);
  line-height: 1.85;
  color: var(--ds-text-2);
  margin-bottom: 10px;
}

.legal__ul {
  margin: 8px 0 12px;
  padding-left: 22px;
}

.legal__ul li {
  font-size: var(--ds-fs-md);
  line-height: 1.85;
  color: var(--ds-text-2);
  margin-bottom: 6px;
}

.legal__doc code {
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
  font-size: 0.9em;
  padding: 1px 5px;
  border-radius: var(--ds-radius-xs);
  background: var(--ds-bg-subtle);
  border: 1px solid var(--ds-border);
  color: var(--ds-inline-code);
}

.legal__doc strong {
  font-weight: 600;
  color: var(--ds-text-1);
}

/* 用户中心右上角的条款入口（唯一一份定义：
   重复定义会让后面的 margin-left:auto 盖掉移动端媒体查询里的 margin-left:0） */
.uc__legal a {
  color: var(--ds-text-3);
  text-decoration: none;
  transition: color 0.15s;
}

.uc__legal a:hover {
  color: var(--ds-blue-text);
}

/* ======================================================================
   跨页面统一收口（放在所有组件基础规则之后、响应式之前）
   登录页 / 用户中心 / 反馈中心 / 管理后台 / 条款页共用的"页面级"元素，
   此前各处各写一份，字号、字重、颜色、返回按钮形状各不相同，
   翻页时会有"换了个站"的割裂感。这里统一定义一次，各组件不再重复声明。
   ====================================================================== */

/* 1) 页面主标题 + 副标题：五个整页视图完全一致 */
.auth-card__title,
.uc__title,
.feedback__title,
.admin__title,
.legal__title {
  margin: 0;
  font-size: var(--ds-fs-xl);
  font-weight: 700;
  line-height: 1.35;
  letter-spacing: -0.01em;
  color: var(--ds-text-1);
}

.auth-card__subtitle,
.uc__subtitle,
.feedback__subtitle,
.admin__subtitle {
  margin: 2px 0 0;
  font-size: var(--ds-fs-sm);
  line-height: 1.6;
  color: var(--ds-text-3);
}

/* 2) 区块标题（卡片内的三级标题）：统一字重与图标色 */
.uc-card__title,
.legal__doc h2 {
  font-size: var(--ds-fs-lg);
  font-weight: 600;
  color: var(--ds-text-1);
}

/* 3) 返回按钮：五个整页共用同一枚"圆形描边图标按钮"。
      此前用户中心是裸图标、反馈/管理后台是圆钮、条款页是带文字的胶囊，
      三种形状混用，这里统一为一种（36px，移动端不小于 36px）。 */
.page-back {
  width: 36px;
  height: 36px;
  flex: 0 0 auto;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: 1px solid var(--ds-border);
  background: var(--ds-bg);
  color: var(--ds-text-2);
  font-size: var(--ds-fs-base);
  cursor: pointer;
  transition: border-color 0.15s var(--ds-ease), color 0.15s var(--ds-ease), background 0.15s var(--ds-ease);
}

.page-back:hover {
  border-color: var(--ds-blue-text);
  color: var(--ds-blue-text);
  background: var(--ds-bg);
}

.page-back:focus-visible {
  outline: 2px solid var(--ds-blue);
  outline-offset: 2px;
}

.page-back .ic {
  width: 18px;
  height: 18px;
}

@media (max-width: 768px) {
  .legal {
    padding: 18px 12px 40px;
  }

/* 卡片内边距统一由 --ds-card-pad 提供（见文件末尾的移动端块），此处不再各自重写 */

  .legal__title {
    font-size: var(--ds-fs-xl);
  }

  .attach-item__info {
    max-width: 170px;
  }

  /* 窄屏一行放不下「名称 + 设为默认 + 开关」，改为两段式排布 */
  .uc-model-item {
    flex-wrap: wrap;
  }

  .uc-model-actions {
    width: 100%;
    justify-content: space-between;
    gap: 10px;
  }
}
/* ======================================================================
   反馈中心（用户端）
   ====================================================================== */
.sidebar__feedback {
  display: flex;
  align-items: center;
  gap: 7px;
  width: 100%;
  border: none;
  background: transparent;
  color: var(--ds-text-3);
  font-size: var(--ds-fs-sm);
  padding: 7px 10px;
  border-radius: var(--ds-radius-sm);
  cursor: pointer;
  margin-bottom: 8px;
  transition: background 0.15s, color 0.15s;
}
.sidebar__feedback:hover {
  background: var(--ds-bg-hover);
  color: var(--ds-text-1);
}
.sidebar__feedback .ic {
  width: 16px;
  height: 16px;
}

.feedback,
.admin {
  flex: 1 0 auto;
  min-height: 100vh;
  box-sizing: border-box;
  background: var(--ds-bg-subtle);
  padding: 28px 20px 56px;
}
.feedback__inner,
.admin__inner {
  width: 100%;
  margin: 0 auto;
}
.feedback__inner { max-width: 760px; }
.admin__inner { max-width: 1000px; }

.feedback__head,
.admin__head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
}
.feedback__title,
.admin__title {
  margin: 0;
  font-size: var(--ds-fs-xl);
  line-height: 1.35;
  color: var(--ds-text-1);
}
.feedback__subtitle,
.admin__subtitle {
  margin: 2px 0 0;
  font-size: var(--ds-fs-sm);
  color: var(--ds-text-3);
}
.feedback__head-text,
.admin__head-text { flex: 1; min-width: 0; }

.admin__count {
  font-size: var(--ds-fs-sm);
  color: var(--ds-text-2);
  background: var(--ds-bg);
  border: 1px solid var(--ds-border);
  border-radius: var(--ds-radius-pill);
  padding: 6px 14px;
  white-space: nowrap;
  flex: 0 0 auto;
  font-variant-numeric: tabular-nums;
}

.feedback__body {
  display: grid;
  grid-template-columns: 1fr 260px;
  gap: 20px;
  align-items: start;
}

.feedback__form,
.feedback__mine {
  background: var(--ds-card-bg);
  border: 1px solid var(--ds-card-border);
  border-radius: var(--ds-card-radius);
  padding: var(--ds-card-pad);
  box-shadow: var(--ds-card-shadow);
}
.feedback__form .field { margin-bottom: 14px; }
.feedback__form .field__label { margin-bottom: 6px; }
/* 详细描述：.input 默认是给 .input-wrap 里单行输入用的（height:100% / padding:0 16px），
   裸用会出现"宽度不撑满 + 右下角缩放柄 + 文字贴顶"三个问题，这里完整覆写 */
.feedback__form textarea.input {
  display: block;
  width: 100%;
  box-sizing: border-box;
  height: auto;
  min-height: 132px;
  resize: none; /* 高度随内容自动增长（见 app.js），不显示可拖拽缩放柄 */
  background: var(--ds-bg);
  border: 1px solid var(--ds-border);
  border-radius: var(--ds-radius);
  padding: 10px 12px;
  font-size: var(--ds-fs-base);
  line-height: 1.6;
  font-family: inherit;
  overflow-y: auto;
}
.feedback__form textarea.input:focus {
  border-color: var(--ds-blue);
  outline: none;
}
.feedback__form .btn--primary { margin-top: 4px; min-width: 140px; }

/* 反馈图片附件（表单内待传区 + 列表展示区共用） */
.fb-images {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.fb-images:not(:empty) { margin-bottom: 8px; }
.fb-image {
  position: relative;
  margin: 0;
  width: 76px;
  height: 76px;
  border-radius: var(--ds-radius-sm);
  overflow: hidden;
  border: 1px solid var(--ds-border);
  background: var(--ds-bg-subtle);
}
.fb-image__thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  cursor: zoom-in;
}
/* 图片读取中的占位（读取完成前不渲染 <img>，避免出现裂图） */
.fb-image__loading {
  display: block;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, var(--ds-bg-subtle) 25%, var(--ds-bg-hover) 37%, var(--ds-bg-subtle) 63%);
  background-size: 400% 100%;
  animation: fb-shimmer 1.2s ease-in-out infinite;
}
@keyframes fb-shimmer {
  0% { background-position: 100% 50%; }
  100% { background-position: 0 50%; }
}
.fb-images--view .fb-image__thumb {
  width: 72px;
  height: 72px;
}
.fb-image__remove {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 20px;
  height: 20px;
  border: none;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.fb-image__remove .ic { width: 11px; height: 11px; }
.fb-image__remove:hover { background: rgba(0, 0, 0, 0.75); }
.fb-images__tools {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.fb-images__hint {
  font-size: var(--ds-fs-xs);
  color: var(--ds-text-4);
}

/* 关联对话内容提示 */
.fb-ref {
  background: var(--ds-bg-subtle);
  border: 1px solid var(--ds-border-light);
  border-radius: var(--ds-radius-sm);
  padding: 10px 12px;
  margin-bottom: 14px;
}
.fb-ref__label {
  font-size: var(--ds-fs-xs);
  color: var(--ds-text-3);
  margin-bottom: 5px;
}
.fb-ref__snippet {
  font-size: var(--ds-fs-sm);
  color: var(--ds-text-2);
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 140px;
  overflow: auto;
}

.feedback__mine-title {
  margin: 0 0 12px;
  font-size: var(--ds-fs-md);
  color: var(--ds-text-1);
}
.feedback__mine-list { display: flex; flex-direction: column; gap: 10px; }
.fb-mine-item {
  border: 1px solid var(--ds-border-light);
  border-radius: var(--ds-radius-sm);
  padding: 10px 12px;
}
.fb-mine-item__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.fb-mine-item__title {
  font-size: var(--ds-fs-sm);
  font-weight: 600;
  color: var(--ds-text-1);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.fb-mine-item__meta {
  margin-top: 5px;
  font-size: var(--ds-fs-xs);
  color: var(--ds-text-3);
}
.fb-mine-empty {
  font-size: var(--ds-fs-sm);
  color: var(--ds-text-3);
}

/* ======================================================================
   反馈管理后台
   ====================================================================== */
/* 筛选条：统一成一个白色卡片容器 + 统一 38px 控件高度。
   此前搜索框沿用 .input-wrap 的 48px，而下拉是 ~34px、按钮 38px，
   同一行里三种高度，视觉上是「参差不齐」的（也是用户截图里最明显的问题）。 */
.admin__toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 14px;
  padding: var(--ds-card-pad);
  background: var(--ds-card-bg);
  border: 1px solid var(--ds-card-border);
  border-radius: var(--ds-card-radius);
  box-shadow: var(--ds-card-shadow);
}
.admin__toolbar .select {
  min-width: 130px;
  height: 38px;
  padding: 0 10px;
  font-size: var(--ds-fs-sm);
  color: var(--ds-text-2);
  cursor: pointer;
}
.admin__toolbar .btn {
  height: 38px;
}
.admin__search {
  flex: 1 1 200px;
  min-width: 160px;
  max-width: none;
  display: flex;
  align-items: center;
  gap: 8px;
  height: 38px;
  padding: 0 12px;
}
.admin__search .ic { width: 15px; height: 15px; color: var(--ds-text-3); flex: 0 0 auto; }
.admin__search .input { border: none; box-shadow: none; padding: 0; font-size: var(--ds-fs-md); }

.admin__list { display: flex; flex-direction: column; gap: 12px; }

.fb-card {
  background: var(--ds-card-bg);
  border: 1px solid var(--ds-card-border);
  border-radius: var(--ds-card-radius);
  padding: var(--ds-card-pad);
  box-shadow: var(--ds-card-shadow);
}
.fb-card__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.fb-card__title {
  margin: 0;
  font-size: var(--ds-fs-base);
  color: var(--ds-text-1);
  cursor: pointer;
}
.fb-card__meta {
  margin-top: 6px;
  font-size: var(--ds-fs-xs);
  color: var(--ds-text-3);
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
}
.fb-card__content {
  margin-top: 10px;
  font-size: var(--ds-fs-sm);
  line-height: 1.7;
  color: var(--ds-text-2);
  white-space: pre-wrap;
  word-break: break-word;
}
.fb-card__ref {
  margin-top: 10px;
  background: var(--ds-bg-subtle);
  border-radius: var(--ds-radius-sm);
  padding: 9px 12px;
  font-size: var(--ds-fs-xs);
  color: var(--ds-text-2);
}
.fb-card__ref .fb-card__ref-label {
  font-size: var(--ds-fs-xs);
  color: var(--ds-text-3);
  margin-bottom: 4px;
}
.fb-card__ref-snippet {
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 100px;
  overflow: auto;
}
.fb-card__reply {
  margin-top: 10px;
  background: var(--ds-blue-soft);
  border-radius: var(--ds-radius-sm);
  padding: 9px 12px;
  font-size: var(--ds-fs-sm);
  color: var(--ds-blue-text);
  white-space: pre-wrap;
  word-break: break-word;
}
.fb-card__reply-label { font-size: var(--ds-fs-xs); margin-bottom: 4px; opacity: 0.8; }

/* 状态徽标 */
.fb-status {
  font-size: var(--ds-fs-xs);
  border-radius: var(--ds-radius-pill);
  padding: 3px 10px;
  white-space: nowrap;
  flex: 0 0 auto;
}
/* 状态徽标文字：12px 小字需要 ≥4.5:1，原来的 #c46a1f / #1f8a4c 只有 3.6 / 4.0 */
.fb-status--open { background: #fff4e6; color: #9a5410; }
.fb-status--processing { background: var(--ds-blue-soft); color: var(--ds-blue-text); }
.fb-status--resolved { background: #e8f7ee; color: #156f3c; }
.fb-status--closed { background: var(--ds-bg-subtle); color: var(--ds-text-3); }

.fb-type {
  font-size: var(--ds-fs-xs);
  color: var(--ds-text-3);
  background: var(--ds-bg-subtle);
  border-radius: var(--ds-radius-sm);
  padding: 2px 8px;
  white-space: nowrap;
}

/* 卡片操作区（展开后） */
.fb-card__ops {
  margin-top: 12px;
  border-top: 1px solid var(--ds-border-light);
  padding-top: 12px;
  display: flex;
  align-items: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}
/* .input-wrap 默认 48px 固定高，但这里的 textarea 最小 56px，
   不放开高度会让文字超出描边框、缩放柄画在框外 */
.fb-card__ops .input-wrap {
  flex: 1;
  min-width: 240px;
  height: auto;
  min-height: 56px;
  align-items: stretch;
}
.fb-card__ops textarea.input {
  resize: vertical;
  height: 100%;
  min-height: 54px;
  line-height: 1.5;
  padding: 8px 10px;
  font-family: inherit;
}
.fb-card__ops .select { min-width: 120px; height: 38px; }

.admin__empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  text-align: center;
  padding: var(--ds-card-pad);
  color: var(--ds-text-3);
  background: var(--ds-card-bg);
  border: 1px solid var(--ds-card-border);
  border-radius: var(--ds-card-radius);
  box-shadow: var(--ds-card-shadow);
}
.admin__empty-icon {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: var(--ds-bg-subtle);
  color: var(--ds-text-4);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 6px;
}
.admin__empty-icon svg {
  width: 22px;
  height: 22px;
}
.admin__empty-title {
  font-size: var(--ds-fs-base);
  font-weight: 600;
  color: var(--ds-text-2);
}
.admin__empty-hint {
  font-size: var(--ds-fs-sm);
  color: var(--ds-text-4);
  line-height: 1.7;
  max-width: 32em;
}

@media (max-width: 820px) {
  .feedback__body { grid-template-columns: 1fr; }
}

/* ======================================================================
   移动端适配（≤640px）：聊天 composer、反馈中心、管理后台
   ====================================================================== */
@media (max-width: 640px) {
  /* 输入区工具行按钮同高。34px 与桌面一致：30px 在手机上小于可点面积下限 */
  :root {
    --ds-composer-btn-h: 34px;
  }

  /* 触控目标：移动端主控件的可点面积不小于 34px */
  .icon-btn {
    width: 34px;
    height: 34px;
  }
  .conv-item__actions .icon-btn {
    width: 30px;
    height: 30px;
  }
  .fb-image__remove {
    width: 24px;
    height: 24px;
  }
  .fb-image__remove .ic {
    width: 13px;
    height: 13px;
  }

  /* composer：输入框一行，下面「胶囊 + 模型 + 回形针 + 发送」挤在同一行。
     胶囊可横向滚动但不换行，否则工具行会被顶到下一行、发送按钮被模型按钮压住。 */
  .composer {
    gap: 4px;
    padding: 10px 8px 8px 12px;
    border-radius: 20px;
  }
  .composer__input {
    padding: 2px 0 0;
    min-height: 24px;
    font-size: var(--ds-fs-base);
  }
  .composer__bar {
    gap: 4px;
  }
  .composer__caps {
    flex: 1 1 auto;
    min-width: 0;
    justify-content: flex-start;
    gap: 4px;
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
  }
  .composer__caps::-webkit-scrollbar { display: none; }
  .cap {
    padding: 0 8px 0 7px;
    font-size: var(--ds-fs-xs);
    gap: 4px;
    flex: 0 0 auto;
  }
  .cap__ic { width: 12px; height: 12px; }
  .cap__txt { white-space: nowrap; }
  .composer__tools {
    margin-left: auto;
    gap: 4px;
    padding-bottom: 0;
  }
  /* 模型按钮压缩：隐藏装饰图标、标签截断，保证与胶囊同处一行。
     注意 max-width 必须同时给到 .model-switch 包装层——flex 换行按包装层的
     max-content 计算，只限按钮内层的话整行仍会因超宽被挤到下一行 */
  .model-switch__spark { display: none; }
  .model-switch {
    flex: 0 1 auto;
    min-width: 0;
    max-width: 32vw;
  }
  .model-switch__btn {
    min-width: 0;
    max-width: 100%;
    padding: 0 8px 0 10px;
    gap: 4px;
  }
  .model-switch__label {
    min-width: 0;
    max-width: 30vw;
  }

  /* 消息气泡与头像间距 */
  .messages__inner {
    padding: 14px 12px 4px;
  }

  /* 反馈中心 */
  .feedback,
  .admin {
    padding: 16px 12px 40px;
  }
  .feedback__title,
  .admin__title {
    font-size: var(--ds-fs-xl);
  }
  .feedback__subtitle,
  .admin__subtitle {
    font-size: var(--ds-fs-xs);
  }
  .feedback__head,
  .admin__head {
    margin-bottom: 14px;
    gap: 8px;
  }
  /* 卡片内边距统一由 --ds-card-pad 提供，见文件末尾的移动端统一块 */
  .feedback__form textarea.input {
    min-height: 108px;
    font-size: var(--ds-fs-base);
  }
  .fb-image { width: 64px; height: 64px; }
  .fb-images--view .fb-image__thumb { width: 64px; height: 64px; }

  /* 管理后台：选填两列，搜索框与「刷新」同一行（内边距同走令牌） */
  .admin__toolbar {
    gap: 8px;
  }
  .admin__toolbar .select {
    flex: 1 1 40%;
    min-width: 0;
    height: 38px;
  }
  .admin__search {
    flex: 1 1 160px;
    max-width: none;
    min-width: 0;
    border: 1px solid var(--ds-border);
    border-radius: var(--ds-radius);
    height: 38px;
  }
  .admin__empty {
    padding: 32px 16px 36px;
  }
  /* 卡片内边距统一由 --ds-card-pad 提供，见文件末尾的移动端统一块 */
  .fb-card { /* 保持卡片外观，内边距随令牌 */ }
  .fb-card__ops {
    flex-direction: column;
    align-items: stretch;
  }
  .fb-card__ops .input-wrap { min-width: 0; }
  .fb-card__ops .select,
  .fb-card__ops .btn { width: 100%; }
  /* 反馈类型分段选择器在窄屏可换行，避免 320px 级别的横向溢出 */
  .seg {
    flex-wrap: wrap;
  }
}

/* ==========================================================================
   服务后台（账户管理 + 头像审核）
   --------------------------------------------------------------------------
   页面骨架直接复用 .admin*（同一套底色、标题、筛选条），细节类名用 .svc-*，
   与反馈后台的 .fb-card 区分开。颜色/圆角/字号全部走 --ds-* 令牌，
   移动端规则集中放在本节的 ≤640px 查询里。
   ========================================================================== */

.svc-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.svc-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 38px;
  padding: 0 16px;
  border: 1px solid var(--ds-border);
  background: var(--ds-card-bg);
  border-radius: var(--ds-radius-pill);
  color: var(--ds-text-2);
  font-size: var(--ds-fs-md);
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s var(--ds-ease), border-color 0.15s var(--ds-ease);
}
.svc-tab:hover { background: var(--ds-bg-hover); }
.svc-tab .ic { width: 16px; height: 16px; }
.svc-tab.is-active {
  background: var(--ds-blue-soft);
  border-color: var(--ds-blue);
  color: var(--ds-blue-text);
}
.svc-tab__badge {
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: var(--ds-radius-pill);
  background: var(--ds-danger);
  color: #fff;
  font-size: var(--ds-fs-2xs);
  font-variant-numeric: tabular-nums;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.svc-list { display: flex; flex-direction: column; gap: 12px; }

/* ---- 账户卡片 ---- */
.svc-card {
  background: var(--ds-card-bg);
  border: 1px solid var(--ds-card-border);
  border-radius: var(--ds-card-radius);
  padding: var(--ds-card-pad);
  box-shadow: var(--ds-card-shadow);
}
.svc-card__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.svc-card__id { display: flex; align-items: center; gap: 10px; min-width: 0; }
.svc-card__idtext { min-width: 0; }
.svc-card__name {
  font-size: var(--ds-fs-base);
  font-weight: 600;
  color: var(--ds-text-1);
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.svc-card__mail {
  font-size: var(--ds-fs-xs);
  color: var(--ds-text-3);
  margin-top: 2px;
  word-break: break-all;
}
.svc-avatar {
  width: 40px;
  height: 40px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--ds-blue-soft);
  color: var(--ds-blue-text);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--ds-fs-md);
  font-weight: 600;
  overflow: hidden;
}
.svc-avatar--lg { width: 64px; height: 64px; font-size: var(--ds-fs-xl); }
.svc-avatar__img { width: 100%; height: 100%; object-fit: cover; display: block; }

.svc-tag,
.svc-badge {
  font-size: var(--ds-fs-2xs);
  border-radius: var(--ds-radius-pill);
  padding: 2px 8px;
  white-space: nowrap;
  flex: 0 0 auto;
}
.svc-tag { background: var(--ds-bg-subtle); color: var(--ds-text-3); }
.svc-badge.is-ok { background: #e8f7ee; color: #156f3c; }
.svc-badge.is-danger { background: var(--ds-danger-soft); color: var(--ds-danger-text); }
.svc-badge.is-warn { background: #fff4e6; color: #9a5410; }
/* 头像状态：与账户状态徽标同形，靠底色区分，不抢主徽标的视觉重量 */
.svc-badge--avatar-pending { background: #fff4e6; color: #9a5410; }
.svc-badge--avatar-approved { background: #e8f7ee; color: #156f3c; }
.svc-badge--avatar-rejected { background: var(--ds-danger-soft); color: var(--ds-danger-text); }
.svc-badge--avatar-none { background: var(--ds-bg-subtle); color: var(--ds-text-4); }

/* 关键字段网格：桌面三列，窄屏自动降列（见文末移动端块） */
.svc-card__grid {
  margin-top: 14px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px 16px;
}
.svc-card__grid--detail { margin-top: 0; }
.svc-card__grid--tight { margin-top: 10px; gap: 6px 12px; }
.svc-metric { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.svc-metric__label { font-size: var(--ds-fs-xs); color: var(--ds-text-3); }
.svc-metric__value {
  font-size: var(--ds-fs-sm);
  color: var(--ds-text-1);
  font-variant-numeric: tabular-nums;
  word-break: break-word;
}
.svc-card__note {
  margin-top: 10px;
  background: var(--ds-danger-soft);
  color: var(--ds-danger-text);
  border-radius: var(--ds-radius-sm);
  padding: 8px 12px;
  font-size: var(--ds-fs-xs);
  line-height: 1.6;
  word-break: break-word;
}

/* 操作区：一行铺不下就换行，按钮之间保持同一间距 */
.svc-card__ops {
  margin-top: 14px;
  border-top: 1px solid var(--ds-border-light);
  padding-top: 12px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.svc-card__ops .btn {
  height: 34px;
  font-size: var(--ds-fs-sm);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.svc-card__ops .ic { width: 15px; height: 15px; }

/* ---- 分页 ---- */
.svc-pager {
  margin-top: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}
.svc-pager:empty { display: none; }
.svc-pager__text {
  font-size: var(--ds-fs-sm);
  color: var(--ds-text-3);
  font-variant-numeric: tabular-nums;
}
.svc-page {
  width: 34px;
  height: 34px;
  border-radius: var(--ds-radius-sm);
  border: 1px solid var(--ds-border);
  background: var(--ds-card-bg);
  color: var(--ds-text-2);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.svc-page:hover:not(:disabled) { background: var(--ds-bg-hover); }
.svc-page:disabled { opacity: 0.45; cursor: not-allowed; }
.svc-page .ic { width: 16px; height: 16px; }

/* ---- 加载中 / 空 / 失败 ---- */
.svc-state {
  background: var(--ds-card-bg);
  border: 1px solid var(--ds-card-border);
  border-radius: var(--ds-card-radius);
  box-shadow: var(--ds-card-shadow);
  padding: 32px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  text-align: center;
}
.svc-state__icon {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--ds-bg-subtle);
  color: var(--ds-text-4);
  display: flex;
  align-items: center;
  justify-content: center;
}
.svc-state__icon .ic,
.svc-state__icon svg { width: 22px; height: 22px; }
.svc-state__title { font-size: var(--ds-fs-base); font-weight: 600; color: var(--ds-text-2); }
.svc-state__hint {
  font-size: var(--ds-fs-sm);
  color: var(--ds-text-4);
  line-height: 1.7;
  max-width: 32em;
}
.svc-state__retry { margin-top: 4px; }
.svc-state--error .svc-state__icon { background: var(--ds-danger-soft); color: var(--ds-danger-text); }
.svc-state--error .svc-state__title { color: var(--ds-danger-text); }
/* 加载中：让刷新图标转起来，避免"卡住了"的错觉 */
.svc-state--loading .svc-state__icon svg { animation: spin 0.9s linear infinite; }

/* ---- 详情面板 ---- */
.svc-panel {
  background: var(--ds-card-bg);
  border: 1px solid var(--ds-card-border);
  border-radius: var(--ds-card-radius);
  box-shadow: var(--ds-card-shadow);
  padding: var(--ds-card-pad);
  margin-bottom: 12px;
}
.svc-panel__title { margin: 0 0 14px; font-size: var(--ds-fs-lg); color: var(--ds-text-1); }
.svc-panel__sub { margin: 18px 0 8px; font-size: var(--ds-fs-md); color: var(--ds-text-2); }
.svc-detail__back { margin-bottom: 12px; display: inline-flex; align-items: center; gap: 6px; }
.svc-detail__back .ic { width: 15px; height: 15px; }
.svc-detail__id { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }

/* 用量进度条 */
.svc-bar {
  margin-top: 14px;
  height: 8px;
  border-radius: var(--ds-radius-pill);
  background: var(--ds-bg-subtle);
  overflow: hidden;
}
.svc-bar__fill { height: 100%; background: var(--ds-blue); border-radius: inherit; }
.svc-bar__hint { margin-top: 6px; font-size: var(--ds-fs-xs); color: var(--ds-text-3); }

/* ---- 表格（近期用量 / 对话列表）：窄屏横向滚动而不是撑破页面 ---- */
.svc-table__scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.svc-table { width: 100%; border-collapse: collapse; font-size: var(--ds-fs-sm); }
.svc-table th,
.svc-table td {
  padding: 8px 10px;
  text-align: left;
  border-bottom: 1px solid var(--ds-border-light);
  color: var(--ds-text-2);
  white-space: nowrap;
}
.svc-table th { font-size: var(--ds-fs-xs); color: var(--ds-text-3); font-weight: 500; }
.svc-table tbody tr:last-child td { border-bottom: none; }
.svc-table .is-num { text-align: right; font-variant-numeric: tabular-nums; }
.svc-table__title {
  white-space: normal;
  word-break: break-word;
  max-width: 22em;
}

/* ---- 头像审核 ---- */
.svc-card--review { padding: var(--ds-card-pad); }
.svc-review { display: flex; gap: 16px; align-items: flex-start; }
.svc-review__img {
  width: 120px;
  height: 120px;
  flex: 0 0 auto;
  border-radius: var(--ds-radius);
  overflow: hidden;
  border: 1px solid var(--ds-border-light);
  background: var(--ds-bg-subtle);
}
.svc-review__thumb { width: 100%; height: 100%; object-fit: cover; display: block; cursor: zoom-in; }
.svc-review__img.is-none {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ds-text-4);
  font-size: var(--ds-fs-xs);
}
.svc-review__img.is-none .ic { width: 22px; height: 22px; margin-bottom: 4px; }
.svc-review__img.is-none span { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.svc-review__img.is-none em { font-style: normal; }
.svc-review__info { flex: 1 1 auto; min-width: 0; }
.svc-review__current {
  margin-top: 10px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--ds-border-light);
  cursor: zoom-in;
}
.svc-review__ops {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 108px;
}
.svc-review__ops .btn { height: 34px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.svc-review__ops .ic { width: 15px; height: 15px; }
.svc-review__done { font-size: var(--ds-fs-xs); color: var(--ds-text-4); text-align: right; }

/* ---- 通用弹窗（改密码 / 封禁 / 注销 / 驳回理由） ---- */
.svc-modal {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  box-sizing: border-box;
}
.svc-modal__mask { position: absolute; inset: 0; background: rgba(15, 18, 25, 0.45); }
.svc-modal__card {
  position: relative;
  width: 100%;
  max-width: 460px;
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  background: var(--ds-card-bg);
  border: 1px solid var(--ds-card-border);
  border-radius: var(--ds-radius-lg);
  box-shadow: var(--ds-shadow-lg);
  display: flex;
  flex-direction: column;
}
.svc-modal__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px 12px;
}
.svc-modal__title { margin: 0; font-size: var(--ds-fs-lg); color: var(--ds-text-1); word-break: break-all; }
.svc-modal__body { padding: 0 18px; }
.svc-modal__foot {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 16px 18px 18px;
}
.svc-modal__foot .btn { min-width: 92px; justify-content: center; }
.svc-form { padding-bottom: 2px; }
.svc-form__text { font-size: var(--ds-fs-sm); color: var(--ds-text-2); line-height: 1.7; }
.svc-form__text.is-danger { color: var(--ds-danger-text); }
.svc-form__hint { margin-top: 10px; font-size: var(--ds-fs-xs); color: var(--ds-text-4); line-height: 1.7; }
.svc-form__preview {
  margin-top: 12px;
  width: 140px;
  height: 140px;
  object-fit: cover;
  border-radius: var(--ds-radius);
  border: 1px solid var(--ds-border-light);
  display: block;
}
.svc-form textarea.input {
  display: block;
  width: 100%;
  box-sizing: border-box;
  min-height: 76px;
  resize: vertical;
  background: var(--ds-bg);
  border: 1px solid var(--ds-border);
  border-radius: var(--ds-radius);
  padding: 8px 10px;
  font-size: var(--ds-fs-base);
  line-height: 1.6;
  font-family: inherit;
}
.svc-form .field { margin-bottom: 12px; }
.svc-form .field__label { margin-bottom: 6px; }

/* 用户中心的头像状态徽标（审核中 / 未通过） */
.uc-badge--avatar-pending { background: #fff4e6; color: #9a5410; }
.uc-badge--avatar-rejected { background: var(--ds-danger-soft); color: var(--ds-danger-text); }
.uc-badge--avatar-approved { background: #e8f7ee; color: #156f3c; }
.uc-badge--avatar-none { background: var(--ds-bg-subtle); color: var(--ds-text-4); }

/* 移动端：卡片改单列、操作按钮铺满、审核卡片纵向排 */
@media (max-width: 640px) {
  .svc-tabs { gap: 6px; }
  .svc-tab { height: 38px; padding: 0 12px; font-size: var(--ds-fs-sm); }

  .svc-card__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 12px; }
  .svc-card__grid--detail { grid-template-columns: 1fr; }

  .svc-card__head { flex-direction: column; align-items: stretch; gap: 10px; }
  .svc-card__head .btn { width: 100%; justify-content: center; }

  /* 操作按钮：≤3 个时一行排开，多了自动换行；触控目标 ≥34px */
  .svc-card__ops { gap: 8px; }
  .svc-card__ops .btn { flex: 1 1 calc(50% - 4px); min-width: 0; justify-content: center; }
  .svc-card__ops .btn--danger { flex: 1 1 100%; }

  .svc-review { flex-direction: column; gap: 12px; }
  .svc-review__img { width: 100%; height: auto; aspect-ratio: 1 / 1; }
  .svc-review__ops { flex-direction: row; width: 100%; min-width: 0; }
  .svc-review__ops .btn { flex: 1 1 0; height: 38px; }

  .svc-detail__id { gap: 10px; }
  .svc-avatar--lg { width: 52px; height: 52px; }

  .svc-state { padding: 28px 16px 32px; }
  .svc-modal { padding: 14px; }
  .svc-modal__foot .btn { flex: 1 1 0; min-width: 0; }
}

/* 极窄屏（≤360px）：关键字段改单列，避免"注册时间"被挤成两行 */
@media (max-width: 360px) {
  .svc-card__grid { grid-template-columns: 1fr; }
  .svc-card__ops .btn { flex: 1 1 100%; }
}

/* ==========================================================================
   十、视觉精修（本次升级）：更克制的描边与阴影、更统一的圆角与留白
   --------------------------------------------------------------------------
   说明：这一节刻意放在文件最后，用于「整体气质」层面的微调而不动原有结构；
   会与 ≤640px 移动端排布重合的属性，一律放进 min-width 查询里，避免把手机端
   已经调好的换行/间距覆盖掉。
   ========================================================================== */

/* ---- 1. 侧栏：减少硬描边，靠留白与圆角分层 ---- */
.sidebar {
  border-right-color: var(--ds-border-light);
}

.sidebar__logo {
  font-size: var(--ds-fs-lg);
  letter-spacing: -0.01em;
}

.sidebar__logo .brand-avatar {
  width: 28px;
  height: 28px;
  border-radius: var(--ds-radius-sm);
}

@media (min-width: 641px) {
  .btn-new {
    height: 40px;
    border-color: var(--ds-border-light);
    /* 与其余按钮同族字号（原来是 13px，与 14px 的行内按钮不同套）；
       更高的 40px 与白底是刻意的层级区分——它是侧栏的主操作 */
    font-size: var(--ds-fs-md);
    box-shadow: var(--ds-shadow-sm);
  }
}

.btn-new:hover {
  border-color: var(--ds-blue-border);
}

.conv-item {
  height: 38px;
}

.conv-item.is-active {
  box-shadow: inset 0 0 0 1px rgba(57, 100, 254, 0.1);
}

/* ---- 2. 顶栏：模型徽标改为中性色，让蓝色只留给主操作 ---- */
.main__badge {
  background: var(--ds-bg-subtle);
  border: 1px solid var(--ds-border-light);
  color: var(--ds-text-3);
  font-weight: 500;
}

/* ---- 3. 欢迎屏 ---- */
.welcome__logo {
  width: 56px;
  height: 56px;
  border-radius: var(--ds-radius-lg);
}

.welcome__title {
  font-size: var(--ds-fs-2xl);
  letter-spacing: -0.02em;
  margin: 20px 0 24px;
}

.suggest {
  border-color: var(--ds-border-light);
  border-radius: var(--ds-radius-lg);
  box-shadow: var(--ds-shadow-sm);
  transition: border-color 0.16s var(--ds-ease), background 0.16s var(--ds-ease),
    color 0.16s var(--ds-ease), box-shadow 0.16s var(--ds-ease), transform 0.16s var(--ds-ease);
}

.suggest:hover {
  border-color: var(--ds-blue-border);
  background: var(--ds-bg);
  color: var(--ds-blue-text);
  box-shadow: var(--ds-shadow);
  transform: translateY(-1px);
}

/* ---- 4. 消息：用户气泡改用极浅的品牌蓝，助手保持无气泡排版 ---- */
.msg {
  gap: 14px;
}

.msg__avatar {
  width: 30px;
  height: 30px;
  flex-basis: 30px;
}

.msg--user .msg__bubble {
  background: var(--ds-blue-soft);
  border-radius: 18px 6px 18px 18px;
  padding: 10px 15px;
}

.msg--assistant .msg__avatar {
  box-shadow: 0 2px 6px rgba(57, 100, 254, 0.22);
}

/* ---- 5. 输入区：更大圆角 + 更柔和的聚焦光晕 ----
   圆角与基础样式里的 22px 保持一致（这里只负责桌面端的边框颜色与光晕） */
.composer {
  border-radius: 22px;
  border-color: var(--ds-border-light);
}

.composer:hover {
  border-color: var(--ds-border);
}

.composer.is-focus {
  border-color: var(--ds-blue-border);
  box-shadow: 0 0 0 4px rgba(57, 100, 254, 0.1);
}

.btn-send:not(:disabled) {
  box-shadow: 0 2px 8px rgba(57, 100, 254, 0.28);
}

/* ---- 6. 参考来源：细分隔线 + 域名弱化，读起来更像引用而不是链接墙 ---- */
.md-sources {
  margin-top: 18px;
  border-top-color: var(--ds-border-light);
  padding-top: 12px;
}

.md-sources__list {
  gap: 2px;
}

.md-sources__item {
  padding: 3px 0;
}

.md-sources__host {
  color: var(--ds-text-4);
  font-size: var(--ds-fs-xs);
}

.md-sources__sort {
  background: var(--ds-bg-subtle);
  border-color: var(--ds-border-light);
}

.md-sources__sort-btn.is-active {
  background: var(--ds-bg);
  color: var(--ds-text-1);
  box-shadow: none;
}

.md-sources__more {
  background: var(--ds-bg-subtle);
  border-color: var(--ds-border-light);
}

.md-sources__more:hover {
  background: var(--ds-bg-hover);
}

/* 深色下纯黄块太刺眼，改成半透明黄底 + 亮黄字 */
:root[data-theme='dark'] .md-hl {
  background: rgba(250, 204, 21, 0.22);
  color: #fde68a;
}

/* ---- 7. 卡片一致性：用户中心 / 反馈中心 / 管理后台统一描边与阴影 ---- */
.uc-card,
.feedback__form,
.feedback__mine,
.admin__toolbar,
.admin__empty,
.fb-card,
.svc-card,
.svc-panel,
.svc-state {
  border-color: var(--ds-border-light);
  box-shadow: var(--ds-shadow-sm);
}

/* ---- 8. 移动端：缩小头像与欢迎屏尺寸，保持同一套观感 ---- */
@media (max-width: 640px) {
  .msg__avatar {
    width: 28px;
    height: 28px;
    flex-basis: 28px;
  }

  .msg--user .msg__bubble {
    border-radius: 16px 6px 16px 16px;
    padding: 9px 13px;
  }

  .welcome__logo {
    width: 52px;
    height: 52px;
  }

  .welcome__title {
    font-size: var(--ds-fs-xl);
    margin: 16px 0 20px;
  }

  .composer {
    border-radius: var(--ds-radius-lg);
  }
}

/* ==========================================================================
   十、Cookie 同意提示（首次访问出现）
   设计：右下角浮动卡片，不遮挡主体交互；通过 --cookie-h 把固定铺满的 .app
   顶上去，避免盖住输入框；选择与 .env-banner 相同的「高度变量 + 让位」套路。
   ========================================================================== */
.cookie-consent {
  position: fixed;
  left: 20px;
  right: 20px;
  bottom: 20px;
  /* 低于 toast(100)，高于灯箱(90)：toast 提示要能盖在它上面 */
  z-index: 95;
  display: flex;
  justify-content: center;
  pointer-events: none;
}

.cookie-consent__card {
  pointer-events: auto;
  width: min(560px, 100%);
  max-height: calc(100vh - 40px);
  /* 移动端浏览器工具栏会让 100vh 大于可视区，dvh 跟随动态视口更准 */
  max-height: calc(100dvh - 40px);
  overflow-y: auto;
  background: var(--ds-bg);
  border: 1px solid var(--ds-border);
  border-radius: var(--ds-radius-lg);
  box-shadow: var(--ds-shadow-lg);
  padding: 18px 20px 16px;
  animation: cookie-in 0.28s var(--ds-ease);
}

.cookie-consent__head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.cookie-consent__icon {
  color: var(--ds-blue);
  flex: 0 0 auto;
}

.cookie-consent__icon svg {
  width: 17px;
  height: 17px;
}

.cookie-consent__title {
  margin: 0;
  font-size: var(--ds-fs-base);
  font-weight: 600;
  color: var(--ds-text-1);
}

.cookie-consent__desc {
  margin: 0;
  font-size: var(--ds-fs-sm);
  line-height: 1.75;
  color: var(--ds-text-2);
}

.cookie-consent__desc code {
  background: var(--ds-bg-subtle);
  border: 1px solid var(--ds-border-light);
  border-radius: var(--ds-radius-xs);
  padding: 1px 5px;
  font-size: var(--ds-fs-xs);
  color: var(--ds-text-1);
}

.cookie-consent__actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 14px;
}

.cookie-consent__current {
  margin: 10px 0 0;
  font-size: var(--ds-fs-xs);
  color: var(--ds-text-4);
}

.cookie-consent__link {
  display: inline-block;
  margin-top: 10px;
  font-size: var(--ds-fs-xs);
  color: var(--ds-blue-text);
  text-decoration: none;
}

.cookie-consent__link:hover {
  color: var(--ds-blue);
  text-decoration: underline;
}

@keyframes cookie-in {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
}

/* Cookie 卡片占位：把固定铺满的 .app（含输入框）顶上去，避免被盖住。
   与 body.has-env-banner 同套路，且必须写在同一条规则之后（同特异性靠顺序取胜）。 */
body.has-cookie-consent .app:not(.hidden) {
  bottom: var(--cookie-h, 0px);
}

/* 条款页是文档级滚动，卡片浮在最下面会挡住结尾；给它留出等高的底部留白 */
body.has-cookie-consent .legal {
  padding-bottom: calc(var(--cookie-h, 0px) + 24px);
}

/* 用户中心顶部的「Cookie 设置」按钮：与旁边的条款链接保持同一种视觉 */
.uc__legal-btn {
  border: none;
  background: none;
  padding: 0;
  font: inherit;
  font-size: var(--ds-fs-sm);
  color: var(--ds-text-3);
  cursor: pointer;
  transition: color 0.15s var(--ds-ease);
}

.uc__legal-btn:hover {
  color: var(--ds-blue-text);
  text-decoration: underline;
}

:root[data-theme='dark'] .cookie-consent__card {
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.6);
}

:root[data-theme='dark'] .cookie-consent__desc code {
  background: #1e2025;
}

/* 移动端：底部贴边满宽，两个按钮改成上下堆叠（主按钮在上，单手更好点） */
@media (max-width: 640px) {
  .cookie-consent {
    left: 12px;
    right: 12px;
    bottom: 12px;
  }

  .cookie-consent__card {
    padding: 15px 15px 13px;
    border-radius: var(--ds-radius-lg);
  }

  .cookie-consent__desc {
    font-size: var(--ds-fs-sm);
    line-height: 1.7;
  }

  .cookie-consent__actions {
    flex-direction: column-reverse;
    gap: 8px;
    margin-top: 12px;
  }

  .cookie-consent__actions .btn {
    width: 100%;
    height: 42px;
  }
}

/* ---- 9. 登录/注册页：浅灰底 + 白色卡片，桌面端更有"成品感"；
        移动端保持满宽（卡片在窄屏只会浪费空间） ---- */
.auth-card__logo {
  justify-content: flex-start;
  margin-bottom: 28px;
}

@media (min-width: 641px) {
  .auth-page {
    background: var(--ds-bg-subtle);
  }

  .auth-card {
    max-width: 424px;
    background: var(--ds-bg);
    border: 1px solid var(--ds-border-light);
    border-radius: var(--ds-radius-lg);
    padding: var(--ds-card-pad);
    box-shadow: var(--ds-shadow);
  }
}

:root[data-theme='dark'] .auth-page {
  background: var(--ds-bg-subtle);
}

:root[data-theme='dark'] .auth-card {
  background: var(--ds-bg);
}

/* ======================================================================
   移动端统一适配（窄屏 ≤1024px 或粗指针设备）
   ⚠ 关键点：触屏没有 hover，凡是"悬停才显示"的界面必须在 pointer:coarse 下常显，
   否则这些功能在手机上等于不存在（会话的重命名/删除、消息的点赞/复制、代码块的复制按钮）。
   ====================================================================== */
@media (max-width: 1024px), (pointer: coarse) {
  /* ---- 1) 悬停才出现的操作，改为常显（触屏没有 hover） ---- */
  .conv-item__actions {
    display: flex;
  }
  .msg__actions,
  .md-copy {
    opacity: 1;
  }

  /* ---- 2) 触控目标：可点控件不小于 36px ---- */
  .icon-btn {
    width: 36px;
    height: 36px;
  }
  .avatar--button {
    width: 36px;
    height: 36px;
  }
  .msg__actions .icon-btn {
    width: 34px;
    height: 34px;
  }
  .conv-item__actions .icon-btn {
    width: 32px;
    height: 32px;
  }
  .seg__btn {
    min-height: 36px;
    padding: 7px 13px;
  }
  .page-back {
    width: 38px;
    height: 38px;
  }
  /* 模型选择面板里的单选与开关：整块 label 都是点击热区 */
  .uc-model-default,
  .uc-switch {
    min-height: 36px;
  }
  .uc-model-default input {
    width: 16px;
    height: 16px;
  }
  .uc-model-tag {
    padding: 2px 8px;
  }
  /* 下拉框在手机上不低于 36px（桌面仍是紧凑高度） */
  .select {
    min-height: 36px;
  }
  /* Cookie 卡片里的「查看隐私政策」文字链补足热区 */
  .cookie-consent__link {
    display: inline-block;
    padding: 8px 0;
  }
  /* 登录页页脚的友情链接同样补足 */
  .site-footer__link {
    display: inline-block;
    padding: 8px 2px;
  }
  /* 用户中心头部的条款入口是文字链/小按钮，手机上补足可点面积 */
  .uc__legal a,
  .uc__legal-btn {
    display: inline-block;
    padding: 8px 2px;
  }
}

/* 跨页面统一的移动端留白节奏（≤768px）：
   用户中心 / 反馈中心 / 管理后台 / 条款页共用同一套页面边距与卡片内边距，
   此前分别是 28/20/56、16/12/40、16/12/40、18/12/40，翻页时留白会跳变 */
@media (max-width: 768px) {
  /* 四个整页视图同一套页面边距 */
  .uc,
  .feedback,
  .admin,
  .legal {
    padding: 18px 14px 44px;
  }
  /* 卡片内边距只在这里降一档，所有卡片自动跟随 */
  :root {
    --ds-card-pad: 18px;
  }
  .uc-card__desc {
    margin-bottom: 18px;
  }
}

/* ==========================================================================
   八、移动端优先的聊天界面（≤768px）
   参照 DeepSeek 手机端：顶部标题栏（历史记录 / 新建会话）、消息流式铺开、
   底部固定自适应输入框，配色与间距沿用既有设计令牌，只在这里改排布。
   桌面端（>768px）完全不受影响：以下规则全部包在断点内。
   ========================================================================== */

@media (max-width: 768px) {
  /* ---------- 1) 刘海屏 / 手势条安全区 ----------
     <meta viewport-fit=cover> 已开启，四个方向的内凹都用 env() 补回来，
     否则顶部标题会被状态栏压住、底部输入框会被 home 指示条压住。 */
  .main__head {
    flex: 0 0 auto;
    height: auto;
    min-height: 50px;
    padding: calc(6px + env(safe-area-inset-top, 0px)) 6px 6px;
    /* DeepSeek 手机端：标题栏是半透明毛玻璃 + 1px 分隔线 */
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: saturate(180%) blur(12px);
    -webkit-backdrop-filter: saturate(180%) blur(12px);
  }

  .main__title {
    /* 标题居中：左右两个按钮等宽（36px），中间区域自行吸收剩余宽度 */
    flex: 1 1 auto;
    max-width: none;
    text-align: center;
    font-size: var(--ds-fs-md);
    font-weight: 600;
  }

  .main__new {
    flex: 0 0 auto;
  }

  /* 侧栏抽屉同样要躲开刘海与手势条 */
  .sidebar {
    padding-top: env(safe-area-inset-top, 0px);
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }

  /* ---------- 2) 消息区 ---------- */
  .messages {
    /* 橡皮筋滚动不要带动整页，也不要触发下拉刷新 */
    overscroll-behavior-y: contain;
    -webkit-overflow-scrolling: touch;
  }

  .messages__inner {
    max-width: none;
    padding: 14px max(12px, env(safe-area-inset-left, 0px)) 10px
      max(12px, env(safe-area-inset-right, 0px));
  }

  .msg {
    /* 手机端不显示头像（DeepSeek 同款）：靠左右对齐 + 气泡底色区分角色 */
    gap: 0;
    margin-bottom: 20px;
  }

  .msg__avatar {
    display: none;
  }

  .msg--user .msg__body {
    max-width: 86%;
  }

  .msg--user .msg__bubble {
    background: var(--ds-user-bubble);
    color: var(--ds-user-bubble-text);
    border-radius: 18px 18px 6px 18px;
    padding: 10px 14px;
    font-size: var(--ds-fs-base);
    line-height: 1.7;
  }

  /* 助手回答：左对齐、无气泡、通栏，与 DeepSeek 一致 */
  .msg--assistant .msg__bubble {
    padding: 0;
  }

  /* 可折叠的思考过程：手机上给它一个浅色容器，折叠态一眼能看出可点 */
  .md-reasoning__summary {
    font-size: var(--ds-fs-md);
    padding: 4px 0;
    min-height: 32px;
  }

  .md-reasoning__body {
    max-height: 45vh;
    font-size: var(--ds-fs-sm);
  }

  /* 回答下方的复制 / 重新生成：触屏没有 hover，这里已经常显，
     再把图标按钮排布收紧一点，避免挤到第二行 */
  .msg__actions {
    margin-top: 8px;
    gap: 4px;
    flex-wrap: wrap;
  }

  /* ---------- 3) 底部输入区（固定在底部 + 自适应高度） ---------- */
  .composer-wrap {
    padding: 8px max(10px, env(safe-area-inset-left, 0px))
      calc(8px + env(safe-area-inset-bottom, 0px))
      max(10px, env(safe-area-inset-right, 0px));
    /* 移动端顶部的渐隐遮罩会盖住最后一条消息，改成实底 + 分隔线更干净 */
    background: var(--ds-bg);
    border-top: 1px solid var(--ds-border-light);
  }

  .composer {
    /* 输入框与发送按钮包在同一颗大圆角卡片里（DeepSeek 手机端同款） */
    border-radius: 22px;
    padding: 12px 10px 10px 14px;
    gap: 4px;
  }

  /* 能力开关：手机上靠左排，与右侧「模型 + 回形针 + 发送」形成同一行。
     必须是可收缩 + 内部横向滚动：胶囊一多就把工具行挤到下一行，
     表现为输入框下方空出一行、发送按钮被模型按钮压住点不动。 */
  .composer__bar {
    gap: 6px;
  }

  .composer__caps {
    justify-content: flex-start;
    gap: 6px;
    flex: 1 1 auto;
    min-width: 0;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .composer__caps::-webkit-scrollbar {
    display: none;
  }

  .composer__input {
    font-size: var(--ds-fs-base);
    max-height: 132px;
    padding: 2px 0 0;
  }

  .composer__disclaimer {
    margin-top: 6px;
    font-size: var(--ds-fs-2xs);
  }

  /* ---------- 4) 欢迎屏 ---------- */
  .welcome {
    min-height: 46vh;
    padding: 16px 4px;
  }

  .welcome__title {
    font-size: var(--ds-fs-lg);
    margin: 14px 0 20px;
  }

  /* ---------- 5) 参考来源 ---------- */
  .md-sources {
    margin-top: 10px;
  }

  .md-sources__list {
    max-height: none;
  }

  /* ---------- 6) 软键盘弹出时收缩固定布局 ----------
     .app 是 position:fixed; inset:0，虚拟键盘不会改变视口高度，
     结果输入框被键盘盖住。这里由 app.js 把键盘遮挡高度写进 --kb-offset。 */
  html.view-app .app:not(.hidden) {
    bottom: var(--kb-offset, 0px);
  }
}

/* 暗色：移动端标题栏与输入区的毛玻璃/实底同样要跟随主题 */
:root[data-theme='dark'] .main__head {
  background: rgba(21, 22, 26, 0.92);
}

@media (max-width: 768px) {
  :root[data-theme='dark'] .composer-wrap {
    background: var(--ds-bg);
    border-top-color: var(--ds-border-light);
  }
}
