/* =====================================================================
   专业工作模式 (ChatGPT-Style Work Mode Workspace + Vision Upload)
   ===================================================================== */

/* 座舱右上角极简图标入口（仅图标圆钮，沉浸模式下自动隐藏） */
.cabin-work-btn {
  position: fixed;
  top: calc(14px + env(safe-area-inset-top));
  right: 16px;
  z-index: 25;
  width: 38px;
  height: 38px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(15, 22, 36, 0.56);
  backdrop-filter: blur(18px) saturate(160%);
  -webkit-backdrop-filter: blur(18px) saturate(160%);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: rgba(241, 245, 249, 0.88);
  cursor: pointer;
  transition: opacity 0.22s ease, background 0.18s ease, transform 0.16s ease, border-color 0.18s ease;
}

.cabin-work-btn:hover {
  background: rgba(30, 41, 59, 0.82);
  border-color: rgba(56, 189, 248, 0.45);
  color: #ffffff;
  transform: translateY(-1px);
}

body.immersive .cabin-work-btn,
body.work-mode-active .cabin-work-btn {
  opacity: 0;
  pointer-events: none;
}

/* 工作模式全屏层（OLED 纯黑深色 / 纯白浅色，与 iOS Safari 顶底栏 100% 零接缝融合） */
html.work-mode-active,
html.work-mode-active body,
body.work-mode-active {
  background: #000000 !important;
  height: 100% !important;
}

body.work-mode-active #stage-wrap {
  visibility: hidden !important;
}

html.work-mode-active.wm-light,
html.work-mode-active.wm-light body,
body.work-mode-active.wm-light {
  background: #ffffff !important;
}

.work-mode-layer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  width: 100%;
  z-index: 60;
  display: none;
  flex-direction: column;
  background: #000000;
  color: #e2e8f0;
  overscroll-behavior: none;
  -webkit-user-select: text;
  user-select: text;
  -webkit-touch-callout: default;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "SF Pro Text", "Segoe UI", sans-serif;
  animation: wmFadeIn 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

.work-mode-layer.open {
  display: flex;
}

@keyframes wmFadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* 顶部极简导航栏 */
.wm-header {
  flex-shrink: 0;
  height: calc(54px + env(safe-area-inset-top));
  padding: env(safe-area-inset-top) 18px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(0, 0, 0, 0.90);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.wm-brand {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  flex: 1;
}

.wm-brand-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #22d3ee;
  box-shadow: 0 0 10px rgba(34, 211, 238, 0.7);
}

.wm-brand-title {
  font-size: 14.5px;
  font-weight: 600;
  color: #f8fafc;
  letter-spacing: 0.01em;
}

.wm-brand-sub {
  font-size: 11.5px;
  color: #64748b;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.wm-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.wm-hdr-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.10);
  color: #cbd5e1;
  font-size: 12.5px;
  font-weight: 500;
  white-space: nowrap;
  flex-shrink: 0;
  cursor: pointer;
  transition: all 0.16s ease;
}

.wm-hdr-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
}

.wm-hdr-btn-accent {
  background: rgba(6, 182, 212, 0.14);
  border-color: rgba(6, 182, 212, 0.35);
  color: #67e8f9;
}

.wm-hdr-btn-accent:hover {
  background: rgba(6, 182, 212, 0.26);
  color: #ffffff;
}

.wm-hdr-icon-btn {
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: 50%;
}

/* 消息时间线主视口 */
.wm-messages-scroll {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 24px 16px 28px;
  scroll-behavior: smooth;
  scrollbar-width: thin;
  scrollbar-color: rgba(148, 163, 184, 0.25) transparent;
}

.wm-messages-scroll::-webkit-scrollbar { width: 6px; }
.wm-messages-scroll::-webkit-scrollbar-track { background: transparent; }
.wm-messages-scroll::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.25);
  border-radius: 999px;
}

.wm-messages-inner {
  max-width: 780px;
  width: 100%;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

/* 空白欢迎态 */
.wm-empty {
  margin: 7vh auto 0;
  max-width: 640px;
  width: 100%;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.wm-empty h2 {
  font-size: 24px;
  font-weight: 600;
  color: #f8fafc;
  letter-spacing: -0.01em;
  margin: 0;
}

.wm-empty p {
  font-size: 13.5px;
  color: #94a3b8;
  margin: 0 0 18px;
}

.wm-starter-grid {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  text-align: left;
}

.wm-starter-card {
  padding: 13px 15px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: #cbd5e1;
  cursor: pointer;
  transition: all 0.16s ease;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.wm-starter-card:hover {
  background: rgba(255, 255, 255, 0.07);
  border-color: rgba(56, 189, 248, 0.35);
  transform: translateY(-1px);
}

.wm-starter-card strong {
  font-size: 13.5px;
  color: #f1f5f9;
  font-weight: 600;
}

.wm-starter-card span {
  font-size: 12px;
  color: #94a3b8;
}

/* 消息气泡与 AI 排版 */
.wm-msg {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.wm-msg-user {
  align-items: flex-end;
}

.wm-user-images {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  max-width: 82%;
}

.wm-user-img {
  max-width: 220px;
  max-height: 220px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  object-fit: cover;
  cursor: zoom-in;
  transition: transform 0.16s ease, border-color 0.16s ease;
}

.wm-user-img:hover {
  transform: scale(1.02);
  border-color: rgba(56, 189, 248, 0.55);
}

.wm-user-bubble {
  max-width: 82%;
  padding: 11px 16px;
  border-radius: 18px 18px 4px 18px;
  background: #1b2436;
  border: 1px solid rgba(255, 255, 255, 0.09);
  color: #f8fafc;
  font-size: 14.8px;
  line-height: 1.62;
  white-space: pre-wrap;
  word-break: break-word;
}

.wm-msg-assistant {
  align-items: flex-start;
}

.wm-ai-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  font-weight: 600;
  color: #94a3b8;
}

.wm-ai-avatar {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: conic-gradient(from 140deg, #06b6d4, #6366f1, #06b6d4);
  flex-shrink: 0;
}

.wm-ai-body {
  width: 100%;
  font-size: 15px;
  line-height: 1.72;
  color: #e2e8f0;
  word-break: break-word;
}

.wm-ai-body p { margin: 0 0 11px; }
.wm-ai-body p:last-child { margin-bottom: 0; }
.wm-ai-body h1, .wm-ai-body h2, .wm-ai-body h3, .wm-ai-body h4 {
  color: #f8fafc;
  font-weight: 600;
  margin: 18px 0 8px;
  line-height: 1.35;
}
.wm-ai-body h1 { font-size: 1.35em; }
.wm-ai-body h2 { font-size: 1.18em; }
.wm-ai-body h3 { font-size: 1.05em; }
.wm-ai-body ul, .wm-ai-body ol {
  margin: 6px 0 12px 22px;
  padding: 0;
}
.wm-ai-body li { margin: 4px 0; }
.wm-ai-body blockquote {
  margin: 10px 0;
  padding: 8px 14px;
  border-left: 3px solid #22d3ee;
  background: rgba(34, 211, 238, 0.06);
  color: #cbd5e1;
  border-radius: 0 8px 8px 0;
}
.wm-ai-body hr {
  border: none;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  margin: 16px 0;
}
.wm-ai-body a {
  color: #38bdf8;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.wm-ai-body code.wm-inline-code {
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.88em;
  padding: 2px 6px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.08);
  color: #7dd3fc;
}

/* 代码块卡片 + 一键复制 */
.wm-code-block {
  margin: 12px 0;
  border-radius: 12px;
  overflow: hidden;
  background: #0d1220;
  border: 1px solid rgba(255, 255, 255, 0.09);
}

.wm-code-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 12px;
  background: rgba(255, 255, 255, 0.04);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 11.5px;
  color: #94a3b8;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

.wm-code-head-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.wm-code-copy,
.wm-code-download {
  padding: 3px 9px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.10);
  color: #cbd5e1;
  font-size: 11.5px;
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.15s ease;
}

.wm-code-copy:hover,
.wm-code-download:hover {
  background: rgba(255, 255, 255, 0.15);
  color: #ffffff;
}

.wm-code-block pre {
  margin: 0;
  padding: 13px 14px;
  overflow-x: auto;
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  font-size: 13px;
  line-height: 1.58;
  color: #e2e8f0;
}

/* Markdown 表格 */
.wm-table-wrap {
  width: 100%;
  overflow-x: auto;
  margin: 12px 0;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.09);
}

.wm-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

.wm-table th, .wm-table td {
  padding: 9px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  text-align: left;
}

.wm-table th {
  background: rgba(255, 255, 255, 0.05);
  color: #f8fafc;
  font-weight: 600;
}

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

/* 流式输出光标 */
.wm-typing-dot {
  display: inline-block;
  width: 8px;
  height: 15px;
  background: #38bdf8;
  border-radius: 2px;
  vertical-align: text-bottom;
  margin-left: 3px;
  animation: wmBlink 0.9s infinite;
}

@keyframes wmBlink {
  0%, 50% { opacity: 1; }
  51%, 100% { opacity: 0.15; }
}

/* AI 消息底部工具栏 */
.wm-msg-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 2px;
}

.wm-act-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 9px;
  border-radius: 8px;
  background: transparent;
  border: 1px solid transparent;
  color: #64748b;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.wm-act-btn:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.08);
  color: #e2e8f0;
}

.wm-act-btn.wm-act-danger.armed {
  background: rgba(239, 68, 68, 0.14);
  border-color: rgba(239, 68, 68, 0.38);
  color: #f87171;
}

.wm-act-more-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.wm-btn-more {
  padding: 4px 8px;
  font-weight: 600;
  letter-spacing: 1px;
}

.wm-act-popover {
  position: absolute;
  bottom: calc(100% + 6px);
  left: 0;
  min-width: 158px;
  padding: 5px;
  border-radius: 11px;
  background: rgba(15, 23, 42, 0.96);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.48);
  z-index: 40;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.wm-act-popover[hidden] {
  display: none !important;
}

.wm-act-menu-item {
  width: 100%;
  justify-content: flex-start;
  padding: 7px 10px;
  border-radius: 7px;
  font-size: 12.5px;
  white-space: nowrap;
}

.wm-hdr-undo {
  margin-left: auto;
  padding: 2px 8px;
  border-radius: 7px;
  border: 1px solid transparent;
  background: transparent;
  color: #64748b;
  font-size: 11.5px;
  font-weight: 500;
  cursor: pointer;
  opacity: 0.72;
  transition: all 0.15s ease;
}

.wm-hdr-undo:hover {
  opacity: 1;
  background: rgba(255, 255, 255, 0.06);
  color: #e2e8f0;
}

.wm-hdr-undo.armed {
  opacity: 1;
  background: rgba(239, 68, 68, 0.15);
  border-color: rgba(239, 68, 68, 0.4);
  color: #f87171;
}

/* 内嵌多模态卡片（生图 / 生视频 / 邮件草稿 · 零弹窗对话内闭环） */
.wm-media-slot,
.wm-think-slot {
  width: 100%;
}

.wm-media-card {
  margin-top: 10px;
  max-width: 540px;
  width: 100%;
  border-radius: 14px;
  overflow: hidden;
  background: #0f172a;
  border: 1px solid rgba(255, 255, 255, 0.10);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.28);
  position: relative;
}

.wm-media-loading {
  width: 100%;
  aspect-ratio: var(--wm-ratio, 1);
  max-height: 380px;
  position: relative;
  overflow: hidden;
  background: radial-gradient(circle at center, rgba(6, 182, 212, 0.10) 0%, rgba(15, 23, 42, 0.85) 75%);
}

.wm-media-stage {
  position: relative;
  background: #050811;
}

.wm-media-fadein {
  animation: wmMediaFadeIn 0.28s ease-out;
}

@keyframes wmMediaFadeIn {
  from { opacity: 0; transform: scale(0.99); }
  to { opacity: 1; transform: scale(1); }
}

.wm-media-img {
  width: 100%;
  max-height: 460px;
  object-fit: contain;
  display: block;
  cursor: zoom-in;
  background: #050811;
}

.wm-media-vid {
  width: 100%;
  max-height: 440px;
  display: block;
  background: #000;
}

.wm-media-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 11px;
  background: rgba(15, 23, 42, 0.92);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.wm-media-meta {
  font-size: 11.5px;
  color: #94a3b8;
  max-width: 170px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.wm-media-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
}

.wm-media-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 9px;
  border-radius: 7px;
  border: 1px solid rgba(255, 255, 255, 0.11);
  background: rgba(255, 255, 255, 0.05);
  color: #cbd5e1;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.wm-media-btn:hover {
  background: rgba(255, 255, 255, 0.13);
  border-color: rgba(255, 255, 255, 0.22);
  color: #ffffff;
}

.wm-media-btn-primary {
  background: rgba(6, 182, 212, 0.16);
  border-color: rgba(6, 182, 212, 0.36);
  color: #67e8f9;
}

.wm-media-btn-primary:hover {
  background: rgba(6, 182, 212, 0.28);
  color: #ffffff;
}

.wm-media-prompt-box {
  display: none;
  padding: 9px 12px;
  font-size: 12px;
  line-height: 1.55;
  color: #cbd5e1;
  background: rgba(2, 6, 23, 0.72);
  border-top: 1px solid rgba(255, 255, 255, 0.07);
  word-break: break-word;
}

.wm-media-prompt-box.open {
  display: block;
}

.wm-media-error {
  padding: 13px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: rgba(127, 29, 29, 0.24);
}

.wm-media-error-text {
  font-size: 13px;
  color: #fca5a5;
  line-height: 1.45;
  word-break: break-word;
}

/* 工作模式极简纯图灯箱（仅点击图片时按需打开） */
.wm-lightbox {
  position: fixed;
  inset: 0;
  z-index: 950;
  display: none;
  background: #000000;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}

.wm-lightbox.open {
  display: block;
  animation: wmMediaFadeIn 0.16s ease-out;
}

.wm-lb-stage {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  touch-action: none;
}

.wm-lightbox-img {
  width: 100vw;
  height: 100dvh;
  max-width: 100vw;
  max-height: 100dvh;
  object-fit: contain;
  transform-origin: center center;
  will-change: transform, opacity;
  cursor: grab;
}

.wm-lightbox-img.animating {
  transition: transform 0.22s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.18s ease;
}

.wm-lb-counter {
  position: fixed;
  top: calc(14px + env(safe-area-inset-top));
  left: 16px;
  z-index: 6;
  font-size: 12px;
  font-weight: 600;
  color: rgba(248, 250, 252, 0.85);
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.45);
  pointer-events: none;
}

.wm-lightbox-close {
  position: fixed;
  top: calc(12px + env(safe-area-inset-top));
  right: 16px;
  z-index: 6;
  width: 34px;
  height: 34px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(15, 23, 42, 0.48);
  color: #f8fafc;
  font-size: 20px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.16s ease;
}

.wm-lightbox-close:hover {
  background: rgba(255, 255, 255, 0.18);
}

.wm-mail-card {
  margin-top: 10px;
  padding: 12px 15px;
  border-radius: 12px;
  background: rgba(6, 182, 212, 0.08);
  border: 1px solid rgba(6, 182, 212, 0.28);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  max-width: 520px;
  width: 100%;
}

.wm-mail-card-info {
  font-size: 13px;
  color: #cbd5e1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.wm-mail-card-info strong { color: #f8fafc; }

/* 底部专业输入坞 (ChatGPT Composer) */
.wm-composer-wrap {
  flex-shrink: 0;
  padding: 10px 16px calc(16px + env(safe-area-inset-bottom));
  background: linear-gradient(180deg, rgba(0, 0, 0, 0) 0%, #000000 24%);
}

.wm-composer {
  position: relative;
  max-width: 780px;
  width: 100%;
  margin: 0 auto;
  border-radius: 24px;
  background: #121620;
  border: 1px solid rgba(255, 255, 255, 0.11);
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.42);
  padding: 5px 6px 5px 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.wm-composer:focus-within {
  border-color: rgba(56, 189, 248, 0.45);
  box-shadow: 0 12px 38px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(56, 189, 248, 0.18);
}

.wm-composer.drag-over {
  border-color: #22d3ee;
  background: rgba(6, 182, 212, 0.08);
}

/* 待上传图片缩略图条 */
.wm-attach-strip {
  display: none;
  flex-wrap: wrap;
  gap: 8px;
  padding: 2px 2px 4px;
}

.wm-attach-strip.has-items {
  display: flex;
}

.wm-attach-item {
  position: relative;
  width: 64px;
  height: 64px;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: #090d16;
}

.wm-attach-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.wm-attach-remove {
  position: absolute;
  top: 3px;
  right: 3px;
  width: 19px;
  height: 19px;
  border-radius: 50%;
  border: none;
  background: rgba(0, 0, 0, 0.78);
  color: #f8fafc;
  font-size: 11px;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.wm-attach-remove:hover {
  background: #ef4444;
}

.wm-textarea {
  flex: 1;
  min-width: 0;
  width: 100%;
  border: none;
  outline: none;
  resize: none;
  background: transparent;
  color: #f8fafc;
  font-family: inherit;
  font-size: 15px;
  line-height: 22px;
  max-height: 180px;
  min-height: 34px;
  overflow-y: auto;
  scrollbar-width: none;
  padding: 6px 2px;
  box-sizing: border-box;
}

.wm-textarea::-webkit-scrollbar {
  display: none;
}

.wm-textarea::placeholder {
  color: #64748b;
}

.wm-pill-row {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  width: 100%;
}

.wm-active-chips {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
  padding: 2px 4px 2px;
}

.wm-composer-right {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.wm-upload-icon-btn,
.wm-plus-btn,
.wm-mic-icon-btn {
  width: 34px;
  height: 34px;
  padding: 0;
  justify-content: center;
  background: transparent;
  border-color: transparent;
  color: #cbd5e1;
}

.wm-plus-btn:hover,
.wm-mic-icon-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: transparent;
  color: #f8fafc;
}

.wm-plus-btn[aria-expanded="true"] {
  background: rgba(56, 189, 248, 0.16);
  border-color: rgba(56, 189, 248, 0.40);
  color: #7dd3fc;
}

.wm-plus-popover {
  position: absolute;
  bottom: calc(100% + 10px);
  left: 0;
  width: min(168px, calc(100vw - 32px));
  padding: 6px;
  border-radius: 14px;
  background: rgba(13, 18, 30, 0.96);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid rgba(255, 255, 255, 0.13);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.55);
  z-index: 95;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.wm-plus-popover[hidden] {
  display: none !important;
}

.wm-plus-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  padding: 9px 11px;
  border-radius: 9px;
  border: 1px solid transparent;
  background: transparent;
  color: #e2e8f0;
  font-size: 13px;
  text-align: left;
  cursor: pointer;
  transition: background 0.14s ease, color 0.14s ease;
}

.wm-plus-item:hover {
  background: rgba(255, 255, 255, 0.07);
}

.wm-plus-item[aria-pressed="true"] {
  background: rgba(56, 189, 248, 0.14);
  color: #7dd3fc;
}

.wm-plus-item-left {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.wm-plus-check {
  font-size: 11.5px;
  font-weight: 600;
  color: #38bdf8;
}

.wm-tool-btn {
  height: 34px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
  color: #cbd5e1;
  font-size: 13px;
  white-space: nowrap;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  transition: all 0.16s ease;
}

.wm-tool-btn:hover {
  background: rgba(255, 255, 255, 0.11);
  color: #ffffff;
}

@keyframes wm-mic-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.35); }
  50% { box-shadow: 0 0 0 4px rgba(239, 68, 68, 0); }
}

.wm-tool-btn.listening,
.wm-mic-icon-btn.listening {
  background: rgba(239, 68, 68, 0.22);
  border-color: rgba(239, 68, 68, 0.52);
  color: #fca5a5;
  animation: wm-mic-pulse 1.5s ease-in-out infinite;
}

.wm-send-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(135deg, #06b6d4 0%, #3b82f6 100%);
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.16s ease;
  flex-shrink: 0;
}

.wm-send-btn:hover {
  filter: brightness(1.1);
  transform: scale(1.04);
}

.wm-send-btn:disabled {
  opacity: 0.38;
  cursor: not-allowed;
  transform: none;
}

.wm-send-btn.is-voice-mode {
  background: #2563eb;
  color: #ffffff;
}

.wm-send-btn.is-stop {
  background: #ef4444;
}

.wm-composer-hint {
  max-width: 780px;
  margin: 6px auto 0;
  text-align: center;
  font-size: 11px;
  color: #475569;
}

@media (max-width: 640px) {
  .wm-header {
    height: calc(50px + env(safe-area-inset-top));
    padding: env(safe-area-inset-top) 10px 0;
    gap: 8px;
    background: #000000 !important;
  }
  .work-mode-layer.theme-light .wm-header {
    background: #ffffff !important;
  }
  .wm-composer-wrap {
    padding: 6px 10px calc(10px + env(safe-area-inset-bottom));
    background: #000000 !important;
  }
  .work-mode-layer.theme-light .wm-composer-wrap {
    background: #ffffff !important;
  }
  .wm-brand { gap: 7px; }
  .wm-brand-dot { width: 7px; height: 7px; flex-shrink: 0; }
  .wm-brand-title { font-size: 14px; max-width: none; }
  .wm-brand-sub { display: none; }
  .wm-header-actions { gap: 6px; }
  .wm-hdr-label,
  .wm-hdr-label-full,
  .wm-think-label-full { display: none; }
  #wm-theme-btn,
  #wm-export-chat-btn,
  #wm-exit-btn {
    width: 32px;
    height: 32px;
    padding: 0;
    border-radius: 50%;
    font-size: 14px;
  }
  .wm-messages-scroll {
    padding: 12px 12px 18px;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
  }
  .wm-messages-inner { gap: 16px; }
  .wm-empty {
    margin: 5vh auto 0;
    gap: 8px;
  }
  .wm-empty h2 {
    font-size: 20px;
    line-height: 1.3;
  }
  .wm-empty p {
    font-size: 12.5px;
    line-height: 1.5;
    margin: 0 0 12px;
    padding: 0 6px;
  }
  .wm-starter-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }
  .wm-starter-card {
    padding: 11px 11px;
    border-radius: 13px;
    gap: 4px;
  }
  .wm-starter-card strong {
    font-size: 13px;
    line-height: 1.3;
  }
  .wm-starter-card span {
    font-size: 11.5px;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }
  .wm-user-bubble {
    max-width: 88%;
    font-size: 14.5px;
    padding: 9px 13px;
  }
  .wm-ai-body {
    font-size: 14.5px;
  }
  .wm-media-card {
    max-width: 100%;
    border-radius: 12px;
  }
  .wm-media-bar {
    padding: 7px 9px;
    gap: 6px;
  }
  .wm-media-meta {
    max-width: 100%;
    font-size: 11px;
  }
  .wm-media-btn {
    padding: 4px 8px;
    font-size: 11.5px;
  }
  .wm-composer {
    border-radius: 24px;
    padding: 4px 6px 4px 6px;
    gap: 4px;
  }
  .wm-textarea {
    font-size: 16px;
    line-height: 22px;
    min-height: 34px;
    max-height: 130px;
    padding: 6px 2px;
  }
  .wm-pill-row { gap: 4px; }
  .wm-tool-btn {
    height: 30px;
    padding: 0 8px;
    font-size: 12px;
    gap: 3px;
    flex-shrink: 0;
  }
  .wm-code-btn {
    max-width: 110px;
  }
  .wm-composer-right { gap: 2px; }
  .wm-send-btn,
  .wm-upload-icon-btn,
  .wm-plus-btn,
  .wm-mic-icon-btn {
    width: 34px;
    height: 34px;
    padding: 0;
  }
  .wm-composer-hint { display: none; }
  .wm-sidebar {
    width: min(82vw, 300px);
  }
  .wm-header,
  .wm-composer-wrap,
  .wm-plus-popover,
  .wm-ws-popover,
  .wm-code-block-hdr {
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
  }
}

/* =====================================================================
   浅色模式 (Apple / ChatGPT Light Theme)
   ===================================================================== */
.work-mode-layer.theme-light,
.work-mode-layer.theme-light .wm-shell,
.work-mode-layer.theme-light .wm-main,
.work-mode-layer.theme-light .wm-messages-scroll {
  background: #ffffff;
  color: #0f172a;
}

.work-mode-layer.theme-light .wm-header {
  background: #ffffff;
  border-bottom-color: rgba(15, 23, 42, 0.07);
}

.work-mode-layer.theme-light .wm-brand-dot {
  background: #0284c7;
  box-shadow: 0 0 8px rgba(2, 132, 199, 0.45);
}

.work-mode-layer.theme-light .wm-brand-title {
  color: #0f172a;
}

.work-mode-layer.theme-light .wm-brand-sub {
  color: #64748b;
  background: #f1f5f9;
  border-color: rgba(15, 23, 42, 0.07);
}

.work-mode-layer.theme-light .wm-hdr-btn {
  background: #ffffff;
  border-color: rgba(15, 23, 42, 0.11);
  color: #334155;
}

.work-mode-layer.theme-light .wm-hdr-btn:hover {
  background: #e2e8f0;
  color: #0f172a;
}

.work-mode-layer.theme-light .wm-hdr-btn-accent {
  background: #e0f2fe;
  border-color: rgba(2, 132, 199, 0.28);
  color: #0369a1;
}

.work-mode-layer.theme-light .wm-hdr-btn-accent:hover {
  background: #bae6fd;
  color: #0c4a6e;
}

.work-mode-layer.theme-light .wm-messages-scroll {
  scrollbar-color: rgba(15, 23, 42, 0.18) transparent;
}
.work-mode-layer.theme-light .wm-messages-scroll::-webkit-scrollbar-thumb {
  background: rgba(15, 23, 42, 0.18);
}

.work-mode-layer.theme-light .wm-empty h2 {
  color: #0f172a;
}

.work-mode-layer.theme-light .wm-empty p {
  color: #64748b;
}

.work-mode-layer.theme-light .wm-starter-card {
  background: #ffffff;
  border-color: rgba(15, 23, 42, 0.09);
  color: #334155;
}

.work-mode-layer.theme-light .wm-starter-card:hover {
  background: #f1f5f9;
  border-color: rgba(2, 132, 199, 0.38);
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.05);
}

.work-mode-layer.theme-light .wm-starter-card strong {
  color: #0f172a;
}

.work-mode-layer.theme-light .wm-starter-card span {
  color: #64748b;
}

.work-mode-layer.theme-light .wm-user-img {
  border-color: rgba(15, 23, 42, 0.12);
}

.work-mode-layer.theme-light .wm-user-bubble {
  background: #f1f5f9;
  border-color: rgba(15, 23, 42, 0.07);
  color: #0f172a;
}

.work-mode-layer.theme-light .wm-ai-header {
  color: #475569;
}

.work-mode-layer.theme-light .wm-ai-body {
  color: #1e293b;
}

.work-mode-layer.theme-light .wm-ai-body h1,
.work-mode-layer.theme-light .wm-ai-body h2,
.work-mode-layer.theme-light .wm-ai-body h3,
.work-mode-layer.theme-light .wm-ai-body h4 {
  color: #0f172a;
}

.work-mode-layer.theme-light .wm-ai-body blockquote {
  background: #f0f9ff;
  border-left-color: #0284c7;
  color: #334155;
}

.work-mode-layer.theme-light .wm-ai-body hr {
  border-top-color: rgba(15, 23, 42, 0.10);
}

.work-mode-layer.theme-light .wm-ai-body a {
  color: #0284c7;
}

.work-mode-layer.theme-light .wm-ai-body code.wm-inline-code {
  background: #f1f5f9;
  color: #0369a1;
  border: 1px solid rgba(15, 23, 42, 0.06);
}

.work-mode-layer.theme-light .wm-code-block {
  background: #f8fafc;
  border-color: rgba(15, 23, 42, 0.11);
}

.work-mode-layer.theme-light .wm-code-head {
  background: #f1f5f9;
  border-bottom-color: rgba(15, 23, 42, 0.08);
  color: #475569;
}

.work-mode-layer.theme-light .wm-code-copy,
.work-mode-layer.theme-light .wm-code-download {
  background: #ffffff;
  border-color: rgba(15, 23, 42, 0.14);
  color: #334155;
}

.work-mode-layer.theme-light .wm-code-copy:hover,
.work-mode-layer.theme-light .wm-code-download:hover {
  background: #e2e8f0;
  color: #0f172a;
}

.work-mode-layer.theme-light .wm-code-block pre {
  color: #0f172a;
}

.work-mode-layer.theme-light .wm-table-wrap {
  border-color: rgba(15, 23, 42, 0.10);
}

.work-mode-layer.theme-light .wm-table th {
  background: #f8fafc;
  color: #0f172a;
}

.work-mode-layer.theme-light .wm-table th,
.work-mode-layer.theme-light .wm-table td {
  border-bottom-color: rgba(15, 23, 42, 0.08);
}

.work-mode-layer.theme-light .wm-act-btn {
  color: #64748b;
}

.work-mode-layer.theme-light .wm-act-btn:hover {
  background: #f1f5f9;
  border-color: rgba(15, 23, 42, 0.08);
  color: #0f172a;
}

.work-mode-layer.theme-light .wm-act-popover {
  background: rgba(255, 255, 255, 0.98);
  border-color: rgba(15, 23, 42, 0.12);
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.14);
}

.work-mode-layer.theme-light .wm-act-btn.wm-act-danger.armed,
.work-mode-layer.theme-light .wm-hdr-undo.armed {
  background: rgba(239, 68, 68, 0.1);
  border-color: rgba(239, 68, 68, 0.32);
  color: #dc2626;
}

.work-mode-layer.theme-light .wm-hdr-undo:hover {
  background: #f1f5f9;
  color: #0f172a;
}

.work-mode-layer.theme-light .wm-media-card {
  background: #ffffff;
  border-color: rgba(15, 23, 42, 0.12);
  box-shadow: 0 6px 20px rgba(15, 23, 42, 0.08);
}

.work-mode-layer.theme-light .wm-media-loading {
  background: radial-gradient(circle at center, rgba(2, 132, 199, 0.08) 0%, #f1f5f9 75%);
}

.work-mode-layer.theme-light .canvas-progress-meta {
  color: #334155;
  text-shadow: none;
}

.work-mode-layer.theme-light .canvas-progress-track {
  background: rgba(15, 23, 42, 0.08);
}

.work-mode-layer.theme-light .wm-media-stage,
.work-mode-layer.theme-light .wm-media-img {
  background: #f1f5f9;
}

.work-mode-layer.theme-light .wm-media-bar {
  background: #f8fafc;
  border-top-color: rgba(15, 23, 42, 0.08);
}

.work-mode-layer.theme-light .wm-media-meta {
  color: #64748b;
}

.work-mode-layer.theme-light .wm-media-btn {
  background: #ffffff;
  border-color: rgba(15, 23, 42, 0.13);
  color: #334155;
}

.work-mode-layer.theme-light .wm-media-btn:hover {
  background: #e2e8f0;
  color: #0f172a;
}

.work-mode-layer.theme-light .wm-media-btn-primary {
  background: #e0f2fe;
  border-color: rgba(2, 132, 199, 0.32);
  color: #0369a1;
}

.work-mode-layer.theme-light .wm-media-btn-primary:hover {
  background: #bae6fd;
  color: #0c4a6e;
}

.work-mode-layer.theme-light .wm-media-prompt-box {
  background: #f1f5f9;
  color: #334155;
  border-top-color: rgba(15, 23, 42, 0.08);
}

.work-mode-layer.theme-light .wm-media-error {
  background: #fef2f2;
}

.work-mode-layer.theme-light .wm-media-error-text {
  color: #b91c1c;
}

.work-mode-layer.theme-light .wm-lightbox {
  background: rgba(248, 250, 252, 0.94);
}

.work-mode-layer.theme-light .wm-lightbox-close {
  background: #ffffff;
  border-color: rgba(15, 23, 42, 0.14);
  color: #0f172a;
}

.work-mode-layer.theme-light .wm-mail-card {
  background: #f0f9ff;
  border-color: rgba(2, 132, 199, 0.25);
}

.work-mode-layer.theme-light .wm-mail-card-info {
  color: #334155;
}
.work-mode-layer.theme-light .wm-mail-card-info strong {
  color: #0f172a;
}

.work-mode-layer.theme-light .wm-composer-wrap {
  background: #ffffff;
}

.work-mode-layer.theme-light .wm-composer {
  background: #ffffff;
  border-color: rgba(15, 23, 42, 0.12);
  box-shadow: 0 2px 12px rgba(15, 23, 42, 0.04);
}

.work-mode-layer.theme-light .wm-composer:focus-within {
  border-color: rgba(2, 132, 199, 0.55);
  box-shadow: 0 10px 32px rgba(2, 132, 199, 0.12), 0 0 0 1px rgba(2, 132, 199, 0.15);
}

.work-mode-layer.theme-light .wm-textarea {
  color: #0f172a;
}

.work-mode-layer.theme-light .wm-textarea::placeholder {
  color: #94a3b8;
}

.work-mode-layer.theme-light .wm-tool-btn {
  background: #f1f5f9;
  border-color: rgba(15, 23, 42, 0.08);
  color: #334155;
}

.work-mode-layer.theme-light .wm-tool-btn:hover {
  background: #e2e8f0;
  color: #0f172a;
}

.work-mode-layer.theme-light .wm-plus-btn,
.work-mode-layer.theme-light .wm-mic-icon-btn {
  background: transparent;
  border-color: transparent;
  color: #0f172a;
}

.work-mode-layer.theme-light .wm-plus-btn:hover,
.work-mode-layer.theme-light .wm-mic-icon-btn:hover {
  background: rgba(15, 23, 42, 0.06);
  border-color: transparent;
  color: #0f172a;
}

.work-mode-layer.theme-light .wm-mic-icon-btn.listening,
.work-mode-layer.theme-light .wm-mic-icon-btn.listening:hover {
  background: rgba(239, 68, 68, 0.14);
  border-color: rgba(239, 68, 68, 0.45);
  color: #dc2626;
}

.work-mode-layer.theme-light .wm-attach-item {
  border-color: rgba(15, 23, 42, 0.12);
  background: #f1f5f9;
}

.work-mode-layer.theme-light .wm-composer-hint {
  color: #94a3b8;
}

/* =====================================================================
   ChatGPT 风格可折叠历史对话侧边栏 (Dark & Light + Mobile Drawer)
   ===================================================================== */
.wm-shell {
  display: flex;
  width: 100%;
  height: 100%;
  overflow: hidden;
  position: relative;
}

.wm-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  height: 100%;
}

.wm-icon-btn {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
  color: #cbd5e1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.16s ease;
}

.wm-icon-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
}

.wm-sidebar {
  width: 260px;
  flex-shrink: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  background: #000000;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  padding: calc(10px + env(safe-area-inset-top)) 10px calc(12px + env(safe-area-inset-bottom));
  box-sizing: border-box;
  transition: margin-left 0.22s cubic-bezier(0.16, 1, 0.3, 1), transform 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 40;
}

.work-mode-layer.sb-collapsed .wm-sidebar {
  margin-left: -260px;
}

.wm-sb-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(4px);
  z-index: 35;
}

.wm-sb-top {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.wm-sb-new-btn {
  flex: 1;
  height: 36px;
  padding: 0 12px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.10);
  background: rgba(255, 255, 255, 0.05);
  color: #f1f5f9;
  font-size: 13px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  cursor: pointer;
  transition: all 0.16s ease;
}

.wm-sb-new-btn:hover {
  background: rgba(6, 182, 212, 0.16);
  border-color: rgba(6, 182, 212, 0.40);
  color: #ffffff;
}

.wm-sb-search-wrap {
  margin-bottom: 10px;
}

.wm-sb-search {
  width: 100%;
  height: 32px;
  padding: 0 10px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
  color: #e2e8f0;
  font-size: 12.5px;
  outline: none;
  box-sizing: border-box;
  transition: border-color 0.16s ease;
}

.wm-sb-search:focus {
  border-color: rgba(56, 189, 248, 0.45);
}

.wm-sb-search::placeholder {
  color: #64748b;
}

.wm-sb-list {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding-right: 2px;
  scrollbar-width: thin;
  scrollbar-color: rgba(148, 163, 184, 0.2) transparent;
}

.wm-sb-empty {
  padding: 28px 12px;
  text-align: center;
  font-size: 12px;
  color: #64748b;
  line-height: 1.5;
}

.wm-sb-group {
  font-size: 11px;
  font-weight: 600;
  color: #64748b;
  padding: 10px 8px 4px;
  letter-spacing: 0.03em;
}

.wm-sb-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 8px 9px;
  border-radius: 9px;
  color: #cbd5e1;
  font-size: 13px;
  cursor: pointer;
  touch-action: manipulation;
  transition: background 0.14s ease, color 0.14s ease;
  position: relative;
}

@media (hover: hover) and (pointer: fine) {
  .wm-sb-item:hover {
    background: rgba(255, 255, 255, 0.06);
    color: #ffffff;
  }
}

.wm-sb-item.active {
  background: rgba(6, 182, 212, 0.14);
  color: #ffffff;
  font-weight: 500;
}

.wm-sb-title {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.wm-sb-rename-input {
  flex: 1;
  min-width: 0;
  height: 24px;
  padding: 0 6px;
  border-radius: 5px;
  border: 1px solid #38bdf8;
  background: #0f172a;
  color: #ffffff;
  font-size: 12.5px;
  outline: none;
}

.wm-sb-item-actions {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  opacity: 0;
  transition: opacity 0.14s ease;
  flex-shrink: 0;
}

.wm-sb-item.active .wm-sb-item-actions {
  opacity: 1;
}

@media (hover: hover) and (pointer: fine) {
  .wm-sb-item:hover .wm-sb-item-actions {
    opacity: 1;
  }
}

/* 触屏设备常显操作图标，彻底规避 iOS Safari 首次点击仅触发 :hover 的双点问题 */
@media (hover: none), (pointer: coarse) {
  .wm-sb-item-actions {
    opacity: 0.72;
  }
}

.wm-sb-act {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  border: none;
  background: transparent;
  color: #94a3b8;
  font-size: 11.5px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.14s ease;
}

.wm-sb-act:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
}

.wm-sb-act.del:hover {
  background: rgba(239, 68, 68, 0.22);
  color: #fca5a5;
}

.wm-brand-title {
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 移动端抽屉式侧边栏（关闭时零阴影、完全不可见，彻底杜绝左侧灰边渗漏） */
@media (max-width: 768px) {
  .wm-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: min(82vw, 300px);
    height: 100%;
    height: 100dvh;
    margin-left: 0 !important;
    transform: translateX(-100%);
    box-shadow: none;
    visibility: hidden;
    pointer-events: none;
    transition: transform 0.22s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.22s ease;
  }
  .work-mode-layer.sb-mobile-open .wm-sidebar {
    transform: translateX(0);
    box-shadow: 12px 0 36px rgba(0, 0, 0, 0.45);
    visibility: visible;
    pointer-events: auto;
  }
  .work-mode-layer.theme-light.sb-mobile-open .wm-sidebar {
    box-shadow: 8px 0 28px rgba(15, 23, 42, 0.14);
  }
  .work-mode-layer.sb-mobile-open .wm-sb-backdrop {
    display: block;
  }
  .wm-brand-title {
    flex: 1;
    min-width: 0;
    max-width: none;
  }
}

/* 侧边栏浅色模式适配（纯白 #ffffff 与主画布统一） */
.work-mode-layer.theme-light .wm-sidebar {
  background: #ffffff;
  border-right-color: rgba(15, 23, 42, 0.08);
}

.work-mode-layer.theme-light .wm-icon-btn {
  background: #ffffff;
  border-color: rgba(15, 23, 42, 0.11);
  color: #475569;
}

.work-mode-layer.theme-light .wm-icon-btn:hover {
  background: #e2e8f0;
  color: #0f172a;
}

.work-mode-layer.theme-light .wm-sb-new-btn {
  background: #ffffff;
  border-color: rgba(15, 23, 42, 0.12);
  color: #0f172a;
}

.work-mode-layer.theme-light .wm-sb-new-btn:hover {
  background: #e0f2fe;
  border-color: rgba(2, 132, 199, 0.35);
  color: #0369a1;
}

.work-mode-layer.theme-light .wm-sb-search {
  background: #ffffff;
  border-color: rgba(15, 23, 42, 0.12);
  color: #0f172a;
}

.work-mode-layer.theme-light .wm-sb-item {
  color: #334155;
}

@media (hover: hover) and (pointer: fine) {
  .work-mode-layer.theme-light .wm-sb-item:hover {
    background: rgba(15, 23, 42, 0.055);
    color: #0f172a;
  }
}

.work-mode-layer.theme-light .wm-sb-item.active {
  background: #e0f2fe;
  color: #0369a1;
}

.work-mode-layer.theme-light .wm-sb-rename-input {
  background: #ffffff;
  color: #0f172a;
}

.work-mode-layer.theme-light .wm-sb-act {
  color: #64748b;
}

.work-mode-layer.theme-light .wm-sb-act:hover {
  background: rgba(15, 23, 42, 0.09);
  color: #0f172a;
}

.work-mode-layer.theme-light .wm-sb-act.del:hover {
  background: #fee2e2;
  color: #dc2626;
}

/* =====================================================================
   深度思考开关、可折叠思考过程面板、流式错误内联重试
   ===================================================================== */
.wm-think-btn.active,
.wm-search-btn.active,
.wm-code-btn.active {
  background: rgba(6, 182, 212, 0.18);
  border-color: rgba(6, 182, 212, 0.45);
  color: #67e8f9;
}

.wm-think-btn.active:hover,
.wm-search-btn.active:hover,
.wm-code-btn.active:hover {
  background: rgba(6, 182, 212, 0.28);
  color: #ffffff;
}

.wm-ws-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.wm-ws-pill {
  max-width: 150px;
  background: rgba(56, 189, 248, 0.10);
  border-color: rgba(56, 189, 248, 0.32);
  color: #7dd3fc;
}

.wm-ws-pill span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.wm-ws-pill:hover,
.wm-ws-pill[aria-expanded="true"] {
  background: rgba(56, 189, 248, 0.22);
  color: #ffffff;
}

.wm-ws-popover {
  position: absolute;
  bottom: calc(100% + 10px);
  left: 0;
  width: min(310px, calc(100vw - 32px));
  padding: 10px;
  border-radius: 14px;
  background: rgba(13, 18, 30, 0.96);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid rgba(255, 255, 255, 0.13);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.55);
  z-index: 95;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.wm-ws-popover[hidden] {
  display: none !important;
}

.wm-code-btn {
  max-width: 165px;
}

.wm-code-btn span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.wm-ws-pop-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.wm-ws-pop-title {
  font-size: 11.5px;
  font-weight: 600;
  color: #94a3b8;
  padding: 0 2px;
}

.wm-ws-off-btn {
  padding: 2px 8px;
  border-radius: 6px;
  border: 1px solid rgba(239, 68, 68, 0.32);
  background: rgba(239, 68, 68, 0.10);
  color: #f87171;
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
}

.wm-ws-off-btn:hover {
  background: rgba(239, 68, 68, 0.22);
  color: #fecaca;
}

.wm-ws-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 180px;
  overflow-y: auto;
}

.wm-ws-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  padding: 7px 10px;
  border-radius: 9px;
  border: 1px solid transparent;
  background: rgba(255, 255, 255, 0.04);
  color: #e2e8f0;
  font-size: 12.5px;
  text-align: left;
  cursor: pointer;
  transition: background 0.14s ease, border-color 0.14s ease;
}

.wm-ws-item:hover {
  background: rgba(56, 189, 248, 0.12);
}

.wm-ws-item.active {
  background: rgba(56, 189, 248, 0.18);
  border-color: rgba(56, 189, 248, 0.42);
  color: #7dd3fc;
}

.wm-ws-item-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.wm-ws-item-meta {
  flex-shrink: 0;
  font-size: 11px;
  color: #64748b;
}

.wm-ws-pop-add {
  display: flex;
  align-items: center;
  gap: 6px;
  padding-top: 4px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.wm-ws-input {
  flex: 1;
  min-width: 0;
  padding: 6px 9px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(0, 0, 0, 0.45);
  color: #f1f5f9;
  font-size: 12.5px;
  outline: none;
}

.wm-ws-input:focus {
  border-color: rgba(56, 189, 248, 0.55);
}

.wm-ws-add-btn {
  flex-shrink: 0;
  padding: 6px 11px;
  border-radius: 8px;
  border: 1px solid rgba(56, 189, 248, 0.45);
  background: rgba(14, 165, 233, 0.20);
  color: #7dd3fc;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.wm-ws-add-btn:hover {
  background: rgba(14, 165, 233, 0.34);
  color: #ffffff;
}

@media (max-width: 768px) {
  .wm-ws-wrap {
    position: static;
  }
  .wm-ws-popover {
    left: 0;
    right: 0;
    width: auto;
    bottom: calc(100% + 8px);
  }
}

.wm-agent-box {
  margin: 4px 0 10px;
  border-radius: 10px;
  border: 1px solid rgba(168, 85, 247, 0.26);
  background: rgba(15, 23, 42, 0.56);
  overflow: hidden;
  max-width: 100%;
}

.wm-agent-summary {
  padding: 7px 11px;
  font-size: 12px;
  font-weight: 500;
  color: #d8b4fe;
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  user-select: none;
}

.wm-agent-summary::-webkit-details-marker {
  display: none;
}

.wm-agent-summary::after {
  content: "▾";
  font-size: 11px;
  opacity: 0.7;
  transition: transform 0.18s ease;
}

.wm-agent-box:not([open]) .wm-agent-summary::after {
  transform: rotate(-90deg);
}

.wm-agent-steps {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 6px 10px 10px;
  border-top: 1px solid rgba(148, 163, 184, 0.10);
}

.wm-agent-step {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 5px 8px;
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.05);
  font-size: 12px;
}

.wm-agent-step-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: #e2e8f0;
}

.wm-agent-step-status {
  flex-shrink: 0;
  font-size: 11px;
  color: #94a3b8;
}

.wm-agent-step-detail {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px;
  color: #94a3b8;
  white-space: pre-wrap;
  word-break: break-all;
  max-height: 90px;
  overflow-y: auto;
}

.wm-agent-resume-wrap {
  margin-top: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.wm-agent-resume-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 10px;
  border: 1px solid rgba(56, 189, 248, 0.45);
  background: rgba(14, 165, 233, 0.16);
  color: #7dd3fc;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.wm-agent-resume-btn:hover {
  background: rgba(14, 165, 233, 0.28);
  color: #ffffff;
}

.wm-sources-box {
  margin: 4px 0 10px;
  border-radius: 10px;
  border: 1px solid rgba(56, 189, 248, 0.22);
  background: rgba(15, 23, 42, 0.52);
  overflow: hidden;
  max-width: 100%;
}

.wm-sources-summary {
  padding: 7px 11px;
  font-size: 12px;
  font-weight: 500;
  color: #7dd3fc;
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  user-select: none;
}

.wm-sources-summary::-webkit-details-marker {
  display: none;
}

.wm-sources-summary::after {
  content: "▾";
  font-size: 11px;
  opacity: 0.7;
  transition: transform 0.18s ease;
}

.wm-sources-box:not([open]) .wm-sources-summary::after {
  transform: rotate(-90deg);
}

.wm-source-list {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 6px 10px 10px;
  border-top: 1px solid rgba(148, 163, 184, 0.10);
}

.wm-source-item {
  display: flex;
  align-items: baseline;
  gap: 7px;
  padding: 5px 8px;
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.05);
  color: #cbd5e1;
  text-decoration: none;
  font-size: 12px;
  line-height: 1.4;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.wm-source-item:hover {
  background: rgba(56, 189, 248, 0.10);
  border-color: rgba(56, 189, 248, 0.28);
  color: #ffffff;
}

.wm-source-idx {
  flex-shrink: 0;
  font-size: 11px;
  font-weight: 600;
  color: #38bdf8;
}

.wm-source-title {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.wm-source-domain {
  flex-shrink: 0;
  font-size: 11px;
  color: #64748b;
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.wm-think-box {
  margin: 4px 0 10px;
  border-radius: 10px;
  border: 1px solid rgba(148, 163, 184, 0.16);
  background: rgba(15, 23, 42, 0.55);
  overflow: hidden;
  max-width: 100%;
}

.wm-think-summary {
  padding: 7px 11px;
  font-size: 12px;
  font-weight: 500;
  color: #94a3b8;
  cursor: pointer;
  user-select: none;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 6px;
}

.wm-think-summary::-webkit-details-marker {
  display: none;
}

.wm-think-summary::after {
  content: "▾";
  margin-left: auto;
  font-size: 11px;
  opacity: 0.7;
  transition: transform 0.15s ease;
}

.wm-think-box:not([open]) .wm-think-summary::after {
  transform: rotate(-90deg);
}

.wm-think-content {
  padding: 6px 12px 10px;
  border-top: 1px solid rgba(148, 163, 184, 0.10);
  font-size: 12.5px;
  line-height: 1.6;
  color: #94a3b8;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 220px;
  overflow-y: auto;
}

.wm-ai-error {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 13px;
  border-radius: 10px;
  background: rgba(127, 29, 29, 0.24);
  border: 1px solid rgba(248, 113, 113, 0.26);
  color: #fca5a5;
  font-size: 13px;
}

.wm-ai-error-acts {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.work-mode-layer.theme-light .wm-think-btn.active,
.work-mode-layer.theme-light .wm-search-btn.active,
.work-mode-layer.theme-light .wm-code-btn.active {
  background: #e0f2fe;
  border-color: rgba(2, 132, 199, 0.42);
  color: #0369a1;
}

.work-mode-layer.theme-light .wm-think-btn.active:hover,
.work-mode-layer.theme-light .wm-search-btn.active:hover,
.work-mode-layer.theme-light .wm-code-btn.active:hover {
  background: #bae6fd;
  color: #0c4a6e;
}

.work-mode-layer.theme-light .wm-ws-pill {
  background: #f0f9ff;
  border-color: rgba(2, 132, 199, 0.30);
  color: #0369a1;
}

.work-mode-layer.theme-light .wm-ws-pill:hover,
.work-mode-layer.theme-light .wm-ws-pill[aria-expanded="true"] {
  background: #e0f2fe;
  color: #0c4a6e;
}

.work-mode-layer.theme-light .wm-ws-popover,
.work-mode-layer.theme-light .wm-plus-popover {
  background: rgba(255, 255, 255, 0.98);
  border-color: rgba(15, 23, 42, 0.12);
  box-shadow: 0 14px 36px rgba(15, 23, 42, 0.14);
}

.work-mode-layer.theme-light .wm-plus-btn[aria-expanded="true"] {
  background: #e0f2fe;
  border-color: rgba(2, 132, 199, 0.38);
  color: #0369a1;
}

.work-mode-layer.theme-light .wm-plus-item {
  color: #1e293b;
}

.work-mode-layer.theme-light .wm-plus-item:hover {
  background: #f1f5f9;
}

.work-mode-layer.theme-light .wm-plus-item[aria-pressed="true"] {
  background: #e0f2fe;
  color: #0369a1;
}

.work-mode-layer.theme-light .wm-plus-check {
  color: #0284c7;
}

.work-mode-layer.theme-light .wm-ws-pop-title {
  color: #64748b;
}

.work-mode-layer.theme-light .wm-ws-off-btn {
  border-color: rgba(239, 68, 68, 0.28);
  background: rgba(239, 68, 68, 0.08);
  color: #dc2626;
}

.work-mode-layer.theme-light .wm-ws-off-btn:hover {
  background: rgba(239, 68, 68, 0.16);
}

.work-mode-layer.theme-light .wm-ws-item {
  background: #f8fafc;
  color: #1e293b;
}

.work-mode-layer.theme-light .wm-ws-item:hover {
  background: #f0f9ff;
}

.work-mode-layer.theme-light .wm-ws-item.active {
  background: #e0f2fe;
  border-color: rgba(2, 132, 199, 0.35);
  color: #0369a1;
}

.work-mode-layer.theme-light .wm-ws-pop-add {
  border-top-color: rgba(15, 23, 42, 0.08);
}

.work-mode-layer.theme-light .wm-ws-input {
  background: #ffffff;
  border-color: rgba(15, 23, 42, 0.14);
  color: #0f172a;
}

.work-mode-layer.theme-light .wm-ws-add-btn {
  background: #e0f2fe;
  border-color: rgba(2, 132, 199, 0.38);
  color: #0369a1;
}

.work-mode-layer.theme-light .wm-agent-box {
  background: #faf5ff;
  border-color: rgba(147, 51, 234, 0.22);
}

.work-mode-layer.theme-light .wm-agent-summary {
  color: #7e22ce;
}

.work-mode-layer.theme-light .wm-agent-steps {
  border-top-color: rgba(15, 23, 42, 0.08);
}

.work-mode-layer.theme-light .wm-agent-step {
  background: #ffffff;
  border-color: rgba(15, 23, 42, 0.08);
}

.work-mode-layer.theme-light .wm-agent-step-head {
  color: #0f172a;
}

.work-mode-layer.theme-light .wm-agent-step-detail {
  color: #475569;
}

.work-mode-layer.theme-light .wm-agent-resume-btn {
  background: #e0f2fe;
  border-color: rgba(2, 132, 199, 0.42);
  color: #0369a1;
}

.work-mode-layer.theme-light .wm-agent-resume-btn:hover {
  background: #bae6fd;
  color: #0c4a6e;
}

.work-mode-layer.theme-light .wm-sources-box {
  background: #f8fafc;
  border-color: rgba(2, 132, 199, 0.22);
}

.work-mode-layer.theme-light .wm-sources-summary {
  color: #0284c7;
}

.work-mode-layer.theme-light .wm-source-list {
  border-top-color: rgba(15, 23, 42, 0.08);
}

.work-mode-layer.theme-light .wm-source-item {
  background: #ffffff;
  border-color: rgba(15, 23, 42, 0.08);
  color: #334155;
}

.work-mode-layer.theme-light .wm-source-item:hover {
  background: #f0f9ff;
  border-color: rgba(2, 132, 199, 0.3);
  color: #0f172a;
}

.work-mode-layer.theme-light .wm-source-idx {
  color: #0284c7;
}

.work-mode-layer.theme-light .wm-think-box {
  background: #f8fafc;
  border-color: rgba(15, 23, 42, 0.10);
}

.work-mode-layer.theme-light .wm-think-summary {
  color: #64748b;
}

.work-mode-layer.theme-light .wm-think-content {
  color: #475569;
  border-top-color: rgba(15, 23, 42, 0.08);
}

.work-mode-layer.theme-light .wm-ai-error {
  background: #fef2f2;
  border-color: #fecaca;
  color: #b91c1c;
}

/* =====================================================================
   文档附件胶囊（输入栏待发芯片 & 对话内文档卡片，深浅色双适配）
   ===================================================================== */
.wm-attach-file {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 230px;
  padding: 6px 26px 6px 8px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: #e2e8f0;
  box-sizing: border-box;
}

.wm-attach-file.is-parsing {
  opacity: 0.78;
  border-style: dashed;
}

.wm-file-badge {
  flex-shrink: 0;
  min-width: 34px;
  height: 28px;
  padding: 0 5px;
  border-radius: 7px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  background: rgba(56, 189, 248, 0.18);
  color: #7dd3fc;
}

.wm-file-badge.ext-pdf { background: rgba(239, 68, 68, 0.20); color: #fca5a5; }
.wm-file-badge.ext-doc { background: rgba(59, 130, 246, 0.22); color: #93c5fd; }
.wm-file-badge.ext-xls { background: rgba(16, 185, 129, 0.22); color: #6ee7b7; }
.wm-file-badge.ext-ppt { background: rgba(249, 115, 22, 0.22); color: #fdba74; }
.wm-file-badge.ext-code { background: rgba(168, 85, 247, 0.22); color: #d8b4fe; }

.wm-file-info {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.wm-file-name {
  font-size: 12.5px;
  font-weight: 500;
  color: #f1f5f9;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.wm-file-meta {
  font-size: 10.5px;
  color: #94a3b8;
  white-space: nowrap;
}

.wm-user-files {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 7px;
  margin-bottom: 6px;
  max-width: 100%;
}

.wm-file-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 280px;
  padding: 7px 11px 7px 8px;
  border-radius: 12px;
  background: rgba(30, 41, 59, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #e2e8f0;
  text-align: left;
}

.work-mode-layer.theme-light .wm-attach-file {
  background: #f8fafc;
  border-color: rgba(15, 23, 42, 0.14);
  color: #0f172a;
}

.work-mode-layer.theme-light .wm-file-name {
  color: #0f172a;
}

.work-mode-layer.theme-light .wm-file-meta {
  color: #64748b;
}

.work-mode-layer.theme-light .wm-file-badge { background: #e0f2fe; color: #0369a1; }
.work-mode-layer.theme-light .wm-file-badge.ext-pdf { background: #fee2e2; color: #b91c1c; }
.work-mode-layer.theme-light .wm-file-badge.ext-doc { background: #dbeafe; color: #1d4ed8; }
.work-mode-layer.theme-light .wm-file-badge.ext-xls { background: #d1fae5; color: #047857; }
.work-mode-layer.theme-light .wm-file-badge.ext-ppt { background: #ffedd5; color: #c2410c; }
.work-mode-layer.theme-light .wm-file-badge.ext-code { background: #f3e8ff; color: #7e22ce; }

.work-mode-layer.theme-light .wm-file-pill {
  background: #f1f5f9;
  border-color: rgba(15, 23, 42, 0.11);
  color: #0f172a;
}

/* User Bubble Edit / Recall Actions & Agent Guard Cue */
.wm-user-actions {
  justify-content: flex-end;
  opacity: 0;
  transition: opacity 0.16s ease;
}
.wm-msg-user:hover .wm-user-actions,
.wm-msg-user:focus-within .wm-user-actions {
  opacity: 1;
}
@media (hover: none), (pointer: coarse) {
  .wm-user-actions {
    opacity: 0.78;
  }
}
.wm-user-edit-wrap {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: min(560px, 86vw);
  padding: 10px 12px;
  border-radius: 16px;
  background: rgba(30, 41, 59, 0.72);
  border: 1px solid rgba(56, 189, 248, 0.45);
}
html.wm-light .wm-user-edit-wrap {
  background: #f1f5f9;
  border-color: rgba(37, 99, 235, 0.45);
}
.wm-user-edit-box {
  width: 100%;
  min-height: 64px;
  max-height: 220px;
  resize: vertical;
  border: none;
  outline: none;
  background: transparent;
  color: inherit;
  font: inherit;
  font-size: 14.5px;
  line-height: 1.5;
}
.wm-user-edit-btns {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}
.wm-composer.wm-coding-active {
  border-color: rgba(245, 158, 11, 0.58) !important;
  box-shadow: 0 0 0 1px rgba(245, 158, 11, 0.25), 0 8px 24px rgba(245, 158, 11, 0.10) !important;
}
