/* h5_aicoder/style.css：手机端样式，VS Code 蓝风格，跟随系统深浅色 */
/* 颜色取自桌面端 ui/theme_manager.py：primary #007acc，深色底 #1e1e1e / #252526 / #2d2d2d */
:root {
  --bg: #ffffff;
  --bar: #f3f3f3;
  --surface: #ffffff;
  --surface-active: #e4e6f1;
  --border: #d4d4d4;
  --text: #1e1e1e;
  --text-muted: #6e6e6e;
  --text-faint: #a0a0a0;
  --primary: #007acc;
  --primary-active: #005f9e;
  --primary-disabled: #8cc4e6;
  --status-accent: #007acc;
  --bubble-me: #cfe8fc;
  --bubble-me-text: #1e1e1e;
  --sys-bg: #e5e5e5;
  --sys-text: #616161;
  --input-bg: #ffffff;
  --danger: #c0392b;
  --success: #008800;
  color-scheme: light;
}
[data-theme="dark"] {
  --bg: #1e1e1e;
  --bar: #252526;
  --surface: #2d2d2d;
  --surface-active: #37373d;
  --border: #3c3c3c;
  --text: #cccccc;
  --text-muted: #858585;
  --text-faint: #6b6b6b;
  --primary: #007acc;
  --primary-active: #1177bb;
  --primary-disabled: #1b4d6b;
  --status-accent: #7ec8f5;
  --bubble-me: #264f78;
  --bubble-me-text: #ffffff;
  --sys-bg: #3c3c3c;
  --sys-text: #cccccc;
  --input-bg: #3c3c3c;
  --danger: #f48771;
  --success: #4ec9b0;
  color-scheme: dark;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }

html, body {
  height: 100%;
  background: var(--bar);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

.view { display: none; flex-direction: column; height: 100%; }
.view.active { display: flex; }

.navbar {
  display: flex;
  align-items: center;
  gap: 8px;
  height: calc(48px + env(safe-area-inset-top));
  padding: 0 12px;
  padding-top: env(safe-area-inset-top);
  background: var(--bar);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.navbar-title {
  flex: 1;
  font-size: 17px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.nav-btn {
  border: none;
  background: transparent;
  color: var(--primary);
  font-size: 15px;
  padding: 6px 4px;
  cursor: pointer;
}
.theme-btn { display: flex; align-items: center; padding: 6px 4px; }
/* 共享按钮：独立悬挂在聊天框右上角，只有图标、无背景条，不占用导航栏高度 */
#view-chat { position: relative; }
.share-btn {
  position: absolute;
  top: calc(48px + env(safe-area-inset-top) + 8px);
  right: 22px;
  z-index: 5;
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
}
/* 共享者列表：紧贴共享按钮下方，纵向列出发起人和所有协作者，不拦截点击 */
.share-sharers {
  position: absolute;
  top: calc(48px + env(safe-area-inset-top) + 34px);
  right: 22px;
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  max-width: 45%;
  font-size: 12px;
  color: var(--text-muted);
  pointer-events: none;
}
.share-sharers[hidden] { display: none; }
.share-sharer { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.btn-icon { display: block; width: 22px; height: 22px; }
.status-text { font-size: 12px; color: var(--text-muted); white-space: nowrap; }
/* 聊天头部：返回按钮之后是小图标 + 对话标题，占满中间区域；状态文字靠右 */
.chat-head { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; }
.chat-avatar { width: 28px; height: 28px; border-radius: 6px; flex-shrink: 0; }
.chat-title {
  font-size: 16px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#chat-status { margin-left: auto; }
/* PC 端聊天框右上角的主题、退出按钮，手机端不显示 */
.pc-actions { display: none; align-items: center; gap: 4px; }
/* 桌面端在线状态圆点：在线绿色，离线灰色 */
.dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 4px;
  border-radius: 50%;
  background: var(--text-faint);
  vertical-align: middle;
}
.dot.on { background: var(--success); }

/* 登录 */
.login-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 48px 28px;
}
.logo {
  width: 72px;
  height: 72px;
  margin: 0 auto 16px;
  border-radius: 16px;
  background: var(--primary);
  color: #fff;
  font-size: 28px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}
.logo img { display: block; width: 100%; height: 100%; border-radius: 16px; }
.login-form input {
  height: 48px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--input-bg);
  color: var(--text);
  font-size: 16px;
  outline: none;
}
.login-form input:focus { border-color: var(--primary); }
.primary-btn {
  height: 48px;
  margin-top: 8px;
  border: none;
  border-radius: 6px;
  background: var(--primary);
  color: #fff;
  font-size: 17px;
  cursor: pointer;
}
.primary-btn:active { background: var(--primary-active); }
.wecom-login-btn {
  height: 48px;
  border: 1px solid var(--primary);
  border-radius: 6px;
  background: transparent;
  color: var(--primary);
  font-size: 17px;
  cursor: pointer;
}
.wecom-login-btn:active { background: var(--input-bg); }
.error-text { min-height: 20px; color: var(--danger); font-size: 14px; text-align: center; }

/* 对话列表 */
/* 列表页已去掉顶部导航栏，安全区留白移到页面本身 */
#view-list { padding-top: calc(env(safe-area-inset-top) + 12px); background: var(--bar); }
/* 聊天页与列表页保持一致，顶部导航同样下移 */
#view-chat { padding-top: calc(env(safe-area-inset-top) + 12px); background: var(--bar); }
.session-list {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: env(safe-area-inset-bottom);
}
.group-title {
  padding: 14px 16px 6px;
  font-size: 13px;
  color: var(--text-muted);
}
.session-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  cursor: pointer;
}
.session-item:active { background: var(--surface-active); }
.avatar {
  width: 44px;
  height: 44px;
  border-radius: 6px;
  background: var(--primary);
  color: #fff;
  font-size: 16px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
/* 对话列表头像为图片：去掉底色，图片铺满圆角方块 */
.session-item .avatar { background: none; position: relative; }
.avatar img { display: block; width: 100%; height: 100%; border-radius: 6px; }
.session-main { flex: 1; min-width: 0; }
.session-title {
  font-size: 16px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.session-sub {
  margin-top: 4px;
  font-size: 13px;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.session-side { font-size: 12px; color: var(--text-faint); flex-shrink: 0; align-self: flex-start; }
.running-tag { color: var(--success); }
/* 运行中：小圆圈转动，对应桌面端标题后的 ◐◓◑◒ 动画 */
.spin-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  margin-right: 6px;
  border: 2px solid var(--primary);
  border-right-color: transparent;
  border-radius: 50%;
  vertical-align: middle;
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
/* 任务完成且未查看：绿点贴在头像右上角（圆形图片的透明区域），点进对话后消除 */
.done-dot {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 2px var(--surface);
}
/* 没有对话时居中显示，颜色比正文浅（浅色主题）/ 灰（深色主题） */
#view-list { position: relative; }
.empty-tip {
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  transform: translateY(-50%);
  text-align: center;
  color: var(--text-faint);
}
.list-stats {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  padding-bottom: calc(10px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--border);
  background: var(--bar);
  font-size: 12px;
  line-height: 1.6;
  color: var(--text-muted);
}
/* 页脚中间的统计文字占满剩余宽度并居中，状态与皮肤按钮靠两侧 */
.list-total { flex: 1; min-width: 0; text-align: center; }

/* 对话详情 */
.message-list {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 12px 10px;
  /* 允许长按选中聊天内容并复制 */
  -webkit-user-select: text;
  user-select: text;
  -webkit-touch-callout: default;
}
.msg-row { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; margin-bottom: 14px; }
.msg-row.me { align-items: flex-end; }
.msg-name { font-size: 12px; color: var(--text-muted); padding: 0 4px; }
.bubble {
  max-width: 88%;
  padding: 9px 12px;
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  font-size: 15px;
  line-height: 1.55;
  word-break: break-word;
}
.msg-row.me .bubble { background: var(--bubble-me); color: var(--bubble-me-text); }
/* AI 气泡与提示消息（sys-text）同宽：撑满消息区，不再按内容收缩 */
.msg-row:not(.me) .bubble { width: 100%; max-width: 100%; }
/* 已发出但桌面端还未存档的消息：淡化显示，并标注正在等待应用 */
.msg-row.pending .bubble { opacity: 0.6; }
.pending-tag { font-size: 12px; color: var(--text-muted); padding: 0 4px; }
.msg-row .text { white-space: pre-wrap; }
.msg-row .text + .text { margin-top: 8px; }
/* 气泡右上角复制按钮：与桌面端气泡一致，手机端和 PC 端共用 */
.copy-btn {
  float: right;
  margin: -4px -6px 4px 8px;
  width: 24px;
  height: 24px;
  padding: 0;
  border: none;
  border-radius: 4px;
  background: transparent;
  opacity: 0.6;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.copy-btn:active { background: var(--surface-active); opacity: 1; }
.copy-btn img { display: block; width: 14px; height: 14px; }
/* AI 正文 Markdown 渲染：颜色取自桌面端 codex_chat_view.py（浅色 friendly、深色 monokai 配色） */
:root {
  --code-bg: #eef2f5;
  --code-fg: #1e1e1e;
  --code-tag: #3a7a8c;
  --hl-keyword: #007020;
  --hl-type: #902000;
  --hl-func: #06287e;
  --hl-class: #0e84b5;
  --hl-string: #4070a0;
  --hl-number: #40a070;
  --hl-comment: #60a0b0;
  --hl-operator: #666666;
  --hl-meta: #55aa22;
  --hl-attr: #4f9fcf;
  --hl-name: #062873;
  --hl-var: #19177c;
}
[data-theme="dark"] {
  --code-bg: #1b1e24;
  --code-fg: #f8f8f2;
  --code-tag: #7fb8c9;
  --hl-keyword: #66d9ef;
  --hl-type: #66d9ef;
  --hl-func: #a6e22e;
  --hl-class: #a6e22e;
  --hl-string: #e6db74;
  --hl-number: #ae81ff;
  --hl-comment: #75715e;
  --hl-operator: #f92672;
  --hl-meta: #f92672;
  --hl-attr: #a6e22e;
  --hl-name: #f92672;
  --hl-var: #f8f8f2;
}
.md > :first-child { margin-top: 0; }
.md > :last-child { margin-bottom: 0; }
.md p { margin: 0 0 10px; }
.md strong, .md b { font-weight: 700; }
.md h1, .md h2, .md h3, .md h4 { margin: 12px 0 6px; font-weight: 700; line-height: 1.35; }
.md h1 { font-size: 1.35em; }
.md h2 { font-size: 1.2em; }
.md h3, .md h4 { font-size: 1.05em; }
.md ul, .md ol { margin: 5px 0 10px; padding-left: 24px; }
.md ul { list-style-type: disc; }
.md ol { list-style-type: decimal; }
.md li { margin: 4px 0; }
.md li > p { margin: 0 0 4px; }
.md blockquote { margin: 6px 0; padding-left: 10px; border-left: 3px solid var(--code-tag); color: var(--text-muted); }
.md a { color: var(--code-tag); text-decoration: underline; }
.md hr { margin: 10px 0; border: none; border-top: 1px solid var(--border); }
.md code { padding: 1px 4px; border-radius: 3px; background: var(--code-bg); color: var(--code-tag); font-family: Consolas, monospace; font-size: 0.92em; }
.md table { border-collapse: collapse; margin: 8px 0; }
.md th, .md td { border: 1px solid var(--border); padding: 4px 8px; }
.md th { background: var(--code-bg); }
/* 代码卡片：顶部语言名 + 正文高亮，与桌面端代码块一致 */
.code-card { margin: 8px 0; border: 1px solid var(--border); border-radius: 6px; background: var(--code-bg); overflow: hidden; }
.code-head { display: flex; align-items: center; justify-content: space-between; padding: 3px 5px 3px 9px; border-bottom: 1px solid var(--border); font-size: 12px; color: var(--text-muted); }
/* 代码块头部右侧的复制按钮：样式同气泡复制按钮，点击后显示绿勾 */
.code-copy {
  width: 22px;
  height: 22px;
  padding: 0;
  border: none;
  border-radius: 4px;
  background: transparent;
  opacity: 0.6;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.code-copy:active { background: var(--surface-active); opacity: 1; }
.code-copy img { display: block; width: 14px; height: 14px; }
.code-copy.copied { opacity: 1; }
.copy-btn.copied { opacity: 1; }
.code {
  margin: 0;
  padding: 14px 16px;
  background: var(--code-bg);
  color: var(--code-fg);
  font-family: Consolas, monospace;
  font-size: 13px;
  line-height: 1.45;
  white-space: pre-wrap;
  overflow-x: auto;
}
.md .hljs-keyword, .md .hljs-selector-tag, .md .hljs-literal, .md .hljs-built_in { color: var(--hl-keyword); }
.md .hljs-type { color: var(--hl-type); }
.md .hljs-title.function_ { color: var(--hl-func); }
.md .hljs-title.class_ { color: var(--hl-class); }
.md .hljs-string, .md .hljs-regexp { color: var(--hl-string); }
.md .hljs-number { color: var(--hl-number); }
.md .hljs-comment, .md .hljs-quote { color: var(--hl-comment); font-style: italic; }
.md .hljs-operator { color: var(--hl-operator); }
.md .hljs-meta { color: var(--hl-meta); }
.md .hljs-attr, .md .hljs-attribute { color: var(--hl-attr); }
.md .hljs-name, .md .hljs-tag { color: var(--hl-name); }
.md .hljs-variable, .md .hljs-symbol { color: var(--hl-var); }
.typing-dots {
  display: inline-flex;
  gap: 4px;
  margin-left: 4px;
  vertical-align: middle;
}
.typing-dots span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-muted);
  animation: typing-bounce 1.2s ease-in-out infinite;
}
.typing-dots span:nth-child(2) { animation-delay: 0.15s; }
.typing-dots span:nth-child(3) { animation-delay: 0.3s; }
@keyframes typing-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-4px); opacity: 1; }
}
.sys-text {
  margin: 4px auto 14px;
  padding: 4px 10px;
  border-radius: 4px;
  background: var(--sys-bg);
  color: var(--sys-text);
  font-size: 12px;
  text-align: center;
  white-space: pre-wrap;
}

/* 输入栏 */
.input-bar {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 8px 10px;
  padding-bottom: calc(8px + env(safe-area-inset-bottom));
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 24px;
  flex-shrink: 0;
}
.input-bar textarea {
  flex: 1;
  min-width: 0;
  min-height: 38px;
  max-height: 120px;
  padding: 8px 10px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--text);
  font-size: 16px;
  font-family: inherit;
  line-height: 1.4;
  white-space: pre-wrap;
  overflow-y: auto;
  resize: none;
  outline: none;
}
.input-bar textarea:focus { outline: none; }
@media (max-width: 899px) {
  #input-text { min-height: 24px; padding-top: 0; padding-bottom: 0; line-height: 24px; }
  #input-text.expanded { min-height: 96px; }
}
.icon-btn {
  width: 38px;
  height: 38px;
  padding: 0;
  border: none;
  border-radius: 6px;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
}
.icon-btn:active { background: var(--surface-active); }
.icon-btn img { display: block; width: 26px; height: 26px; }
.icon-btn:disabled { opacity: 0.4; }
.stop-btn img { width: 28px; height: 28px; }
/* 聊天头部：返回图标、组合切换、停止按钮（停止与发送无关，运行中随时可点） */
.back-btn { display: flex; align-items: center; padding: 6px 4px; }
/* 组合下拉框：与深浅色主题一致的小型选择框 */
.group-btn {
  max-width: 35%;
  padding: 4px 6px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--input-bg);
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  outline: none;
}
.group-btn:focus { border-color: var(--primary); }
/* 输入框上方工具条：组合、工作区两个下拉框平分宽度，停止按钮靠右（停止与发送无关，运行中随时可点） */
.chat-toolbar {
  flex-shrink: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 6px 10px 0;
  background: transparent;
}
.chat-toolbar .group-btn { flex: 1; min-width: 0; max-width: none; }
.chat-toolbar .stop-btn { margin-left: auto; }
.chat-toolbar .workspace-multi-btn { flex: 0 0 auto; }
.ws-selection-indicator {
  flex: 0 0 100%;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
  padding: 0 2px 2px;
  color: var(--text-muted);
  font-size: 12px;
  line-height: 18px;
}
.ws-selection-item { display: inline-flex; align-items: center; gap: 5px; max-width: 100%; }
.ws-selection-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--primary); flex: 0 0 7px; }
.ws-selection-item span:last-child { overflow-wrap: anywhere; }
/* 列表顶部「开启新对话」按钮：与桌面端一致的胶囊样式，图标 16px */
.new-chat-btn {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 44px;
  margin: 10px 10px 0;
  border: 1px solid var(--border);
  border-radius: 25px;
  background: var(--surface-active);
  color: var(--text);
  font-family: inherit;
  font-size: 15px;
  cursor: pointer;
}
.new-chat-btn:active { border-color: var(--primary); }
.new-chat-icon { display: block; width: 16px; height: 16px; }
/* 列表顶部页签栏：横向滚动，当前页签用主题色 */
.tab-bar {
  flex-shrink: 0;
  display: flex;
  gap: 8px;
  padding: 8px 10px;
  overflow-x: auto;
  background: var(--bar);
  border-bottom: 1px solid var(--border);
}
.tab-btn {
  flex-shrink: 0;
  padding: 4px 12px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--input-bg);
  color: var(--text-muted);
  font-family: inherit;
  font-size: 14px;
  white-space: nowrap;
}
.tab-btn.active { color: #ffffff; background: var(--primary); border-color: var(--primary); }
.stop-btn { display: flex; align-items: center; padding: 6px 4px; }
.stop-btn[hidden] { display: none; }
.stop-btn:disabled { opacity: 0.4; }
/* 运行状态条：停止、处理中组合与累计步数同一行 */
.run-status {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 14px;
  font-size: 12px;
  color: var(--text-muted);
  background: transparent;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.run-status[hidden] { display: none; }
.processing-status { display: flex; align-items: center; gap: 6px; flex: 0 0 auto; min-width: 0; }
.run-status .stop-btn { padding: 0 4px; }
.processing-label { color: var(--status-accent); font-weight: 600; }
.run-status #run-status-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.run-status .typing-dots { margin-left: 0; gap: 3px; }
.run-status .typing-dots span {
  width: 4px;
  height: 4px;
  background: var(--status-accent);
  animation: status-dot-pulse 1.2s ease-in-out infinite;
}
.run-status .typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.run-status .typing-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes status-dot-pulse {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 1; }
}
/* 待发送图片的缩略图 */
.img-preview {
  flex-shrink: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 8px 10px 0;
  background: transparent;
}
.img-preview .thumb {
  position: relative;
  width: 56px;
  height: 56px;
  border: 1px solid var(--border);
  border-radius: 4px;
  overflow: hidden;
}
.img-preview .thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }
.img-preview .thumb button {
  position: absolute;
  top: 0;
  right: 0;
  width: 20px;
  height: 20px;
  border: none;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  font-size: 12px;
  cursor: pointer;
}

/* 提示 */
.toast {
  position: fixed;
  left: 50%;
  bottom: 96px;
  transform: translateX(-50%);
  max-width: 80%;
  padding: 10px 16px;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.75);
  color: #fff;
  font-size: 14px;
  text-align: center;
  z-index: 10;
}

/* 共享设置面板：手机端从底部弹出，宽屏下居中限宽 */
.sheet { position: fixed; inset: 0; z-index: 20; display: flex; align-items: flex-end; justify-content: center; }
.sheet-mask { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.4); }
.sheet-panel {
  position: relative;
  width: 100%;
  max-width: 480px;
  max-height: 80%;
  display: flex;
  flex-direction: column;
  padding: 16px 16px calc(16px + env(safe-area-inset-bottom));
  border-radius: 12px 12px 0 0;
  background: var(--surface);
  color: var(--text);
}
.sheet-title { font-size: 17px; font-weight: 600; text-align: center; }
.sheet-hint { margin: 8px 0; min-height: 18px; font-size: 13px; color: var(--text-muted); text-align: center; }
.share-users {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 6px;
}
.workspace-options { max-height: 52vh; }
.share-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 15px;
}
.share-user:last-child { border-bottom: none; }
.share-user input { width: 18px; height: 18px; accent-color: var(--primary); }
.sheet-actions { display: flex; gap: 8px; margin-top: 12px; }
.sheet-btn {
  flex: 1;
  height: 44px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  font-size: 15px;
  cursor: pointer;
}
.sheet-btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.sheet-btn.danger { color: var(--danger); }

/* PC 端占位提示：仅宽屏下由 body[data-view="list"] 显示，手机端始终隐藏 */
.chat-placeholder { display: none; }
.chat-placeholder-logo { width: 56px; height: 56px; border-radius: 14px; }
.chat-placeholder-title { font-size: 22px; font-weight: 600; }
.chat-placeholder-sub { font-size: 14px; color: var(--text-muted); }

/* ==================== PC 网页版（宽屏 ≥ 900px，参考 DeepSeek 网页版） ====================
 * 左侧对话列表、右侧聊天区并排；消息与输入框居中限宽；输入框为圆角卡片悬浮在底部。
 * body[data-view] 由 app.js 的 showView 写入，列表与聊天区据此一起显示。
 * 手机端样式不受影响。
 */
@media (min-width: 900px) {
  :root {
    --side: #f9f9f9;
    --side-hover: #ebebeb;
    --pc-width: 800px;
  }
  [data-theme="dark"] {
    --side: #171717;
    --side-hover: #2a2a2a;
  }

  html, body { overflow: hidden; background: var(--bg); }
  body { display: flex; }
  body[data-view="list"] #view-chat,
  body[data-view="chat"] #view-list { display: flex; }

  #view-login { flex: 1; }
  #view-login .login-form { width: 100%; max-width: 380px; margin: 0 auto; }

  /* 未选中对话时：聊天区只显示居中的占位提示，隐藏导航栏和输入框 */
  body[data-view="list"] #view-chat > :not(.chat-placeholder) { display: none; }
  body[data-view="list"] .chat-placeholder {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: var(--text-muted);
  }

  /* 左侧对话列表 */
  #view-list {
    flex: 0 0 340px;
    width: 340px;
    padding-top: 12px;
    background: var(--side);
    border-right: 1px solid var(--border);
  }
  .new-chat-btn {
    height: 40px;
    margin: 4px 12px 8px;
    border-radius: 10px;
    background: var(--input-bg);
  }
  .new-chat-btn:hover { background: var(--side-hover); }
  .tab-bar { background: var(--side); }
  .session-list { padding: 4px 8px; }
  .session-item {
    padding: 9px 10px;
    margin-bottom: 2px;
    gap: 10px;
    background: transparent;
    border: none;
    border-radius: 10px;
  }
  .session-item:hover { background: var(--side-hover); }
  .session-item.active { background: var(--surface-active); }
  .session-item .avatar { width: 28px; height: 28px; }
  .session-title { font-size: 14px; }
  .session-sub { font-size: 12px; }
  .list-stats { background: var(--side); }

  /* 右侧聊天区 */
  #view-chat { flex: 1; min-width: 0; padding-top: 0; background: var(--bg); }
  #view-chat .navbar { height: 52px; padding: 0 20px; background: var(--bg); border-bottom: none; }
  /* 主题、退出按钮保留在对话列表底部（与桌面端侧边栏底部一致），聊天框右上角的 .pc-actions 保持隐藏 */
  #back-btn { display: none; }
  .chat-title { font-size: 15px; }

  .message-list {
    display: flex;
    flex-direction: column;
    padding: 24px 0;
  }
  .message-list > * {
    width: min(var(--pc-width), calc(100% - 40px));
    margin-left: auto;
    margin-right: auto;
  }
  .msg-row { margin-bottom: 20px; }
  .msg-row .bubble { font-size: 16px; }
  .msg-row.me .bubble { width: 80%; max-width: 80%; border-radius: 18px; padding: 10px 16px; }
  /* 亮色下 AI 气泡与 PC 聊天区同为白底（--surface 与 --bg 相同），单独给一层底色 */
  .msg-row:not(.me) .bubble { background: var(--bar); }

  .chat-toolbar,
  .run-status,
  .img-preview {
    width: min(var(--pc-width), calc(100% - 40px));
    margin: 0 auto;
    background: transparent;
  }

  /* 输入框：圆角卡片，文字区与按钮同处一个卡片内 */
  .input-bar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 38px;
    grid-template-rows: 38px 38px;
    column-gap: 8px;
    row-gap: 4px;
    width: min(var(--pc-width), calc(100% - 40px));
    margin: 0 auto 20px;
    padding: 10px 12px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 22px;
    box-shadow: none;
  }
  /* PC 端输入框高度为手机端的两倍，超过后由 app.js 的 autoGrow 限制上限 */
  .input-bar textarea {
    grid-column: 1;
    grid-row: 1 / span 2;
    min-height: 76px;
    border: none;
    background: transparent;
    padding: 6px 4px;
  }
  .input-bar #send-btn { grid-column: 2; grid-row: 1; }
  .input-bar #add-img-btn { grid-column: 2; grid-row: 2; }
  /* 模型组合、工作区下拉框与输入框之间留出空间，不再挨在一起 */
  .chat-toolbar { padding-bottom: 12px; }
}
