/* ==========================================================================
   知流对话站 · Chat Styles (严格对齐 SPEC-V2-DELTA §3 & §8)
   ========================================================================== */

html, body {
  height: 100%;
  overflow: hidden;
}

/* ---------- 无钥匙极简页面 (DELTA §3.10) ---------- */
.keyless-shell {
  display: none;
  position: fixed;
  inset: 0;
  background-color: var(--surface);
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 24px;
  z-index: 200;
}
html.is-keyless .keyless-shell {
  display: flex;
}
html.is-keyless .app-shell {
  display: none !important;
}
.keyless-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}
.keyless-brand-name {
  font-size: 20px;
  font-weight: 500;
  letter-spacing: -0.01em;
  color: var(--on-surface);
}
.keyless-note {
  font-size: 14.5px;
  color: var(--on-surface-muted);
}

/* ---------- 主体外壳 ---------- */
.app-shell {
  display: flex;
  width: 100vw;
  height: 100dvh;
  position: relative;
  overflow: hidden;
}

.drawer-scrim {
  display: none;
  position: fixed;
  inset: 0;
  background: var(--backdrop-scrim);
  z-index: 25;
  opacity: 0;
  transition: opacity var(--duration-normal) var(--ease-emphasized);
}

/* ==========================================================================
   左侧可折叠会话栏 (桌面 268px / 折叠 64px)
   ========================================================================== */
.sidebar {
  width: var(--sidebar-width);
  height: 100%;
  background-color: var(--surface-container-low);
  display: flex;
  flex-direction: column;
  padding: 12px 10px calc(12px + env(safe-area-inset-bottom, 0px));
  transition: width 0.35s var(--ease-emphasized),
              background-color 0.55s var(--ease-emphasized),
              transform 0.35s var(--ease-emphasized);
  flex-shrink: 0;
  z-index: 30;
  position: relative;
}
.sidebar.collapsed {
  width: var(--sidebar-collapsed);
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 44px;
  padding: 0 4px 0 10px;
  margin-bottom: 8px;
}
.sidebar.collapsed .sidebar-header {
  padding: 0 4px;
  justify-content: center;
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 10px;
  position: relative;
  cursor: default;
  min-width: 0;
}
.sidebar.collapsed .brand-lockup {
  display: none;
}
.brand-name {
  font-size: 16px;
  font-weight: 500;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 停留 1 秒彩蛋提示：当前色调与天气 */
.brand-lockup .mood-tooltip {
  position: absolute;
  left: 0;
  top: calc(100% + 8px);
  background: var(--surface-popover);
  backdrop-filter: blur(18px);
  box-shadow: var(--elevation-popover);
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  font-size: 12px;
  color: var(--on-surface-variant);
  white-space: nowrap;
  opacity: 0;
  transform: translateY(-4px);
  pointer-events: none;
  transition: opacity 0.25s var(--ease-emphasized) 1s,
              transform 0.25s var(--ease-emphasized) 1s;
  z-index: 60;
  display: flex;
  align-items: center;
  gap: 6px;
}
.brand-lockup:hover .mood-tooltip {
  opacity: 1;
  transform: translateY(0);
}
.mood-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--brand-gradient);
  flex-shrink: 0;
}

/* 侧栏主操作（无重底色，悬停出 8% 状态层） */
.sidebar-actions {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-bottom: 12px;
}
.side-item {
  display: flex;
  align-items: center;
  gap: 12px;
  height: 40px;
  padding: 0 12px;
  border-radius: var(--radius-pill);
  color: var(--on-surface-variant);
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  transition: background-color 0.15s ease, color 0.15s ease, border-radius 0.2s var(--ease-emphasized);
}
.side-item:hover {
  background-color: var(--state-hover);
  color: var(--on-surface);
}
.side-item:active {
  background-color: var(--state-active);
  border-radius: var(--radius-md);
}
.side-item .shortcut-hint {
  margin-left: auto;
  font-size: 11px;
  color: var(--on-surface-muted);
  opacity: 0;
  transition: opacity 0.15s ease;
}
.side-item:hover .shortcut-hint {
  opacity: 1;
}
.sidebar.collapsed .side-item {
  padding: 0;
  justify-content: center;
  width: 44px;
  margin: 0 auto;
}
.sidebar.collapsed .side-item span {
  display: none;
}

/* 会话历史列表 */
.sidebar-history-header {
  font-size: 12px;
  font-weight: 500;
  color: var(--on-surface-muted);
  padding: 4px 12px 2px;
}
.sidebar.collapsed .sidebar-history-header {
  display: none;
}
.sidebar-history {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding-right: 2px;
  transition: opacity 0.2s ease;
}
.sidebar.collapsed .sidebar-history {
  opacity: 0;
  pointer-events: none;
}

.history-group-label {
  font-size: 11px;
  font-weight: 500;
  color: var(--on-surface-muted);
  padding: 10px 12px 4px;
}
.history-empty {
  font-size: 12.5px;
  color: var(--on-surface-muted);
  padding: 16px 12px;
}
.history-row {
  display: flex;
  align-items: center;
  height: 36px;
  padding: 0 8px 0 12px;
  border-radius: 18px;
  font-size: 13.5px;
  color: var(--on-surface-variant);
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
  position: relative;
  gap: 6px;
  flex-shrink: 0;
}
.history-row:hover {
  background-color: var(--state-hover);
  color: var(--on-surface);
}
.history-row.active {
  background-color: var(--secondary-container);
  color: var(--on-secondary-container);
  font-weight: 500;
}
.history-row .pin-mark {
  width: 12px;
  height: 12px;
  color: var(--primary);
  flex-shrink: 0;
}
.history-row .title-text {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.history-row .row-more {
  opacity: 0;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: var(--on-surface-variant);
  transition: opacity 0.15s ease, background-color 0.15s ease;
  flex-shrink: 0;
}
.history-row:hover .row-more,
.history-row.menu-open .row-more {
  opacity: 1;
}
.history-row .row-more:hover {
  background-color: var(--state-active);
}

/* 侧栏底部 */
.sidebar-footer {
  margin-top: auto;
  padding: 8px 4px 0 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
}
.sidebar.collapsed .sidebar-footer {
  padding-left: 0;
  padding-right: 0;
  justify-content: center;
}
.local-badge {
  font-size: 11px;
  color: var(--on-surface-muted);
  display: flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}
.local-badge::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background-color: var(--on-surface-muted);
  opacity: 0.6;
}
.sidebar.collapsed .local-badge {
  display: none;
}

/* 通用浮动菜单 (行 ⋯ 菜单 / 底部 ⋯ 菜单 / 主题三态菜单) */
.popover-menu {
  position: fixed;
  min-width: 196px;
  background: var(--surface-popover);
  backdrop-filter: blur(22px);
  border-radius: 20px;
  padding: 6px;
  box-shadow: var(--elevation-popover);
  opacity: 0;
  transform: scale(0.95) translateY(4px);
  pointer-events: none;
  transition: opacity 0.16s var(--ease-emphasized), transform 0.2s var(--ease-emphasized);
  z-index: 70;
}
.popover-menu.open {
  opacity: 1;
  transform: scale(1) translateY(0);
  pointer-events: auto;
}
.menu-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 14px;
  font-size: 13.5px;
  color: var(--on-surface);
  text-align: left;
  transition: background-color 0.14s ease;
}
.menu-item:hover {
  background-color: var(--state-hover);
}
.menu-item.danger {
  color: var(--error);
}
.menu-item.active {
  background-color: var(--secondary-container);
  color: var(--on-secondary-container);
  font-weight: 500;
}
.menu-item .menu-hint {
  margin-left: auto;
  font-size: 11.5px;
  color: var(--on-surface-muted);
}
.menu-sep {
  height: 1px;
  background: var(--outline-variant);
  opacity: 0.45;
  margin: 4px 10px;
}

/* ==========================================================================
   主视口与顶部极简栏
   ========================================================================== */
.main-stage {
  flex: 1;
  min-width: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}

.topbar {
  height: 56px;
  padding: 0 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
  z-index: 15;
  flex-shrink: 0;
}
.topbar::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -20px;
  height: 20px;
  background: linear-gradient(to bottom, var(--surface) 15%, transparent 100%);
  pointer-events: none;
}
.topbar-left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 40px;
}
.mobile-menu-btn {
  display: none;
}
.topbar-center-title {
  font-size: 14px;
  color: var(--on-surface-variant);
  font-weight: 500;
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity 0.25s var(--ease-emphasized), transform 0.25s var(--ease-emphasized);
  max-width: 48vw;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: center;
}
.topbar-center-title.visible {
  opacity: 1;
  transform: translateY(0);
}
.topbar-right {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 40px;
  justify-content: flex-end;
}

.mobile-search-btn {
  display: none;
}

/* 应用切换器 */
.app-switcher-wrap,
.theme-menu-wrap {
  position: relative;
}
.unread-dot {
  position: absolute;
  top: 7px;
  right: 7px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--primary);
  pointer-events: none;
  display: none;
}
.unread-dot.show {
  display: block;
}
.app-switcher-menu,
.theme-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 210px;
  background: var(--surface-popover);
  backdrop-filter: blur(20px);
  border-radius: 20px;
  padding: 6px;
  box-shadow: var(--elevation-popover);
  opacity: 0;
  transform: scale(0.95) translateY(-6px);
  transform-origin: top right;
  pointer-events: none;
  transition: opacity 0.18s var(--ease-emphasized), transform 0.22s var(--ease-emphasized);
  z-index: 45;
}
.theme-menu {
  width: 168px;
}
.app-switcher-menu.open,
.theme-menu.open {
  opacity: 1;
  transform: scale(1) translateY(0);
  pointer-events: auto;
}
.switcher-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 14px;
  font-size: 13.5px;
  color: var(--on-surface);
  transition: background-color 0.15s ease;
}
.switcher-item:hover {
  background-color: var(--state-hover);
}
.switcher-item.current {
  background-color: var(--secondary-container);
  color: var(--on-secondary-container);
  font-weight: 500;
}
.switcher-badge {
  margin-left: auto;
  font-size: 11px;
  color: var(--primary);
  font-weight: 500;
}

/* ==========================================================================
   对话站主视口：黄金落点 + 450ms 平滑沉底
   ========================================================================== */
.chat-viewport {
  flex: 1;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}

.message-stream {
  flex: 1;
  overflow-y: auto;
  padding: 20px 24px 190px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s var(--ease-emphasized);
}
.chat-viewport.in-conversation .message-stream {
  opacity: 1;
  pointer-events: auto;
}
.message-column {
  max-width: var(--max-w-chat);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 26px;
}

/* 回到底部浮动按钮 */
.scroll-bottom-btn {
  position: absolute;
  right: 24px;
  bottom: 140px;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--surface-popover);
  backdrop-filter: blur(16px);
  box-shadow: var(--elevation-popover);
  display: grid;
  place-items: center;
  color: var(--on-surface);
  opacity: 0;
  transform: translateY(10px) scale(0.9);
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.22s var(--ease-emphasized);
  z-index: 16;
}
.scroll-bottom-btn.visible {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

/* 空状态舞台：视口 ~38% 黄金落点 */
.composer-stage {
  position: absolute;
  left: 0;
  right: 0;
  top: 38%;
  transform: translateY(-38%);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0 24px;
  transition: top 0.45s var(--ease-emphasized),
              transform 0.45s var(--ease-emphasized),
              padding 0.45s var(--ease-emphasized);
  z-index: 12;
}
.chat-viewport.in-conversation .composer-stage {
  top: 100%;
  transform: translateY(-100%);
  padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  padding-top: 24px;
  background: linear-gradient(to top, var(--surface) 74%, transparent 100%);
}

/* 问候语 */
.hero-greeting {
  width: 100%;
  max-width: 720px;
  margin-bottom: 28px;
  padding-left: 6px;
  transition: opacity 0.24s ease,
              transform 0.3s var(--ease-emphasized),
              max-height 0.35s var(--ease-emphasized),
              margin 0.35s ease;
  max-height: 120px;
}
.chat-viewport.in-conversation .hero-greeting {
  opacity: 0;
  transform: translateY(-12px);
  max-height: 0;
  margin-bottom: 0;
  pointer-events: none;
  overflow: hidden;
}
.hero-greeting h1 {
  font-size: clamp(1.75rem, 3.2vw, 2.5rem);
  font-weight: 400;
  line-height: 1.2;
  letter-spacing: -0.02em;
  color: var(--on-surface);
}

/* 极淡水平天际线光带 */
.horizon-band {
  position: absolute;
  width: min(860px, 92vw);
  height: 128px;
  top: calc(100% - 36px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--horizon-glow);
  filter: blur(22px);
  pointer-events: none;
  z-index: -1;
  transition: opacity 0.4s ease;
}
.chat-viewport.in-conversation .horizon-band {
  opacity: 0;
}

/* ==========================================================================
   双层结构 Composer + 4 秒柔光渐变描边
   ========================================================================== */
.composer-wrap {
  width: 100%;
  max-width: 720px;
  position: relative;
}
.composer-box {
  background-color: var(--surface-container-low);
  border-radius: var(--radius-xl);
  padding: 16px 16px 8px;
  position: relative;
  transition: background-color 0.25s var(--ease-emphasized);
}

@keyframes gradientFlow {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}
.composer-box::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: var(--radius-xl);
  padding: 1.5px;
  background: linear-gradient(108deg, var(--g1), var(--g2), var(--g3), var(--g2), var(--g1));
  background-size: 220% 220%;
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  opacity: 0;
  transition: opacity 0.28s var(--ease-emphasized);
  pointer-events: none;
}
.composer-box:focus-within::before {
  opacity: 0.85;
  animation: gradientFlow 4s ease-in-out 1;
}
.composer-box:focus-within {
  background-color: var(--surface-container);
}

/* 附件与引用胶囊 */
.composer-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
}
.composer-chips:empty {
  display: none;
}
.context-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  height: 30px;
  padding: 0 8px 0 10px;
  border-radius: 10px;
  background-color: var(--surface-container-high);
  font-size: 12.5px;
  color: var(--on-surface);
  cursor: pointer;
  transition: background-color 0.15s ease;
}
.context-chip:hover {
  background-color: var(--surface-container-highest);
}
.context-chip .chip-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 240px;
}
.context-chip .chip-thumb {
  width: 18px;
  height: 18px;
  border-radius: 4px;
  object-fit: cover;
}
.context-chip .chip-remove {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: var(--on-surface-variant);
  flex-shrink: 0;
}
.context-chip .chip-remove:hover {
  background-color: var(--state-active);
}

.composer-textarea {
  width: 100%;
  min-height: 28px;
  max-height: 180px;
  resize: none;
  font-size: 16px;
  line-height: 1.55;
  color: var(--on-surface);
  overflow-y: auto;
}
.composer-textarea::placeholder {
  color: var(--on-surface-muted);
}

/* 工具行 */
.composer-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 40px;
  margin-top: 6px;
  margin-left: -6px;
  gap: 8px;
}
.composer-toolbar-left {
  display: flex;
  align-items: center;
  gap: 4px;
  position: relative;
}
.composer-toolbar-right {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.kb-toggle-pill {
  height: 30px;
  padding: 0 10px;
  border-radius: var(--radius-pill);
  font-size: 12px;
  font-weight: 500;
  color: var(--on-surface-variant);
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: background-color 0.15s ease, color 0.15s ease;
  white-space: nowrap;
}
.kb-toggle-pill:hover {
  background-color: var(--state-hover);
  color: var(--on-surface);
}
.kb-toggle-pill.active {
  background-color: var(--secondary-container);
  color: var(--on-secondary-container);
}

.attach-btn-wrap {
  position: relative;
}
.icon-btn.disabled-hint {
  opacity: 0.4;
}

/* 模型触发按钮 */
.model-trigger {
  height: 36px;
  padding: 0 10px 0 12px;
  border-radius: var(--radius-pill);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 500;
  color: var(--on-surface-variant);
  transition: background-color 0.15s ease, color 0.15s ease;
  max-width: 240px;
  min-width: 0;
}
.model-trigger:hover,
.model-trigger.open {
  background-color: var(--state-hover);
  color: var(--on-surface);
}
.model-trigger.open {
  background-color: var(--surface-container);
}
.model-trigger .model-label-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.model-trigger .chevron {
  width: 15px;
  height: 15px;
  transition: transform 0.22s var(--ease-emphasized);
  flex-shrink: 0;
}
.model-trigger.open .chevron {
  transform: rotate(180deg);
}

/* 三柱思考强度指示器 (4px 宽，高 6 / 9 / 12px，间距 2px，圆角 1px — DELTA §3.5) */
.thinking-bars {
  display: inline-flex;
  align-items: flex-end;
  gap: 2px;
  height: 12px;
  flex-shrink: 0;
}
.thinking-bars span {
  width: 4px;
  border-radius: 1px;
  border: 1px solid var(--on-surface-muted);
  background-color: transparent;
  transition: background-color 0.2s ease, border-color 0.2s ease;
}
.thinking-bars span:nth-child(1) { height: 6px; }
.thinking-bars span:nth-child(2) { height: 9px; }
.thinking-bars span:nth-child(3) { height: 12px; }
.thinking-bars[data-level="low"] span:nth-child(1),
.thinking-bars[data-level="med"] span:nth-child(1),
.thinking-bars[data-level="med"] span:nth-child(2),
.thinking-bars[data-level="high"] span,
.thinking-bars[data-level="on"] span {
  background-color: var(--primary);
  border-color: var(--primary);
}
.thinking-bars.hidden {
  display: none !important;
}

/* 微光胶囊思考动效 (ChatGPT 同款微光胶囊，可通过控制台外观页切换) */
.thinking-shimmer-pill {
  display: none;
  position: relative;
  overflow: hidden;
  align-items: center;
  gap: 5px;
  height: 22px;
  padding: 0 9px;
  border-radius: var(--radius-pill);
  background: var(--secondary-container);
  color: var(--on-secondary-container);
  font-size: 11.5px;
  font-weight: 500;
  line-height: 1;
  flex-shrink: 0;
  transition: background-color 0.2s ease, color 0.2s ease, transform 0.22s var(--ease-spring), opacity 0.2s ease;
}
.thinking-shimmer-pill .shimmer-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.85;
}
.thinking-shimmer-pill::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(110deg, transparent 22%, rgba(255, 255, 255, 0.42) 50%, transparent 78%);
  background-size: 200% 100%;
  animation: thinkingShimmerSweep 2.4s ease-in-out infinite;
  pointer-events: none;
}
html[data-mode="dark"] .thinking-shimmer-pill::after {
  background: linear-gradient(110deg, transparent 22%, rgba(255, 255, 255, 0.22) 50%, transparent 78%);
  background-size: 200% 100%;
}
.thinking-shimmer-pill[data-level="off"] {
  background: var(--surface-container-high);
  color: var(--on-surface-muted);
}
.thinking-shimmer-pill[data-level="off"]::after {
  animation: none;
  opacity: 0;
}
.thinking-shimmer-pill.shimmer-pulse {
  transform: scale(1.06);
}
.thinking-shimmer-pill.hidden {
  display: none !important;
}

@keyframes thinkingShimmerSweep {
  0% { background-position: 180% 0; }
  100% { background-position: -180% 0; }
}
@keyframes thinkingTextShimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

html[data-thinking-style="shimmer"] .thinking-bars {
  display: none;
}
html[data-thinking-style="shimmer"] .thinking-shimmer-pill:not(.hidden) {
  display: inline-flex;
}
html[data-thinking-style="bars"] .thinking-shimmer-pill {
  display: none;
}

/* 无可用模型内联引导 */
.no-model-inline-guide {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  padding: 10px 14px;
  border-radius: var(--radius-lg);
  background: var(--surface-container);
  color: var(--on-surface-variant);
  font-size: 13px;
  line-height: 1.5;
}
.no-model-inline-guide[hidden] {
  display: none !important;
}

/* 发送 / 停止按钮 36px 圆形 */
.send-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background-color: var(--surface-container-high);
  color: var(--on-surface-muted);
  transition: background-color 0.15s var(--ease-emphasized),
              color 0.15s ease,
              transform 0.15s var(--ease-emphasized);
  flex-shrink: 0;
}
.send-btn:disabled {
  opacity: 0.42;
  cursor: not-allowed;
  transform: none !important;
}
.send-btn.ready,
.send-btn.streaming {
  background-color: var(--primary);
  color: var(--on-primary);
}
.send-btn.ready:hover,
.send-btn.streaming:hover {
  transform: scale(1.04);
}
.send-btn.ready:active,
.send-btn.streaming:active {
  transform: scale(0.95);
}

/* 底部快捷项：M3 轻胶囊 */
.minimal-starters {
  margin-top: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
  max-width: 720px;
  transition: opacity 0.2s ease;
}
.chat-viewport.in-conversation .minimal-starters {
  display: none;
}
.starter-link {
  font-size: 13px;
  font-weight: 500;
  color: var(--on-surface-variant);
  background-color: var(--surface-container-low);
  padding: 7px 14px;
  border-radius: var(--radius-pill);
  transition: background-color 0.16s ease, color 0.16s ease, transform 0.14s ease;
}
.starter-link:hover {
  background-color: var(--surface-container-high);
  color: var(--on-surface);
}
.starter-link:active {
  transform: scale(0.98);
}

.composer-footnote {
  display: none;
  text-align: center;
  font-size: 12px;
  color: var(--on-surface-muted);
  margin-top: 8px;
}
.chat-viewport.in-conversation .composer-footnote {
  display: block;
}

/* ==========================================================================
   模型与思考强度弹出面板 (同心圆角 24px -> 16px)
   ========================================================================== */
.sheet-handle {
  display: none;
}
.model-popover {
  position: absolute;
  right: 0;
  bottom: calc(100% + 8px);
  width: 320px;
  max-height: min(520px, calc(100vh - 140px));
  display: flex;
  flex-direction: column;
  background: var(--surface-popover);
  backdrop-filter: blur(22px);
  border-radius: var(--radius-xl);
  padding: 8px;
  box-shadow: var(--elevation-popover);
  opacity: 0;
  transform: scale(0.96) translateY(8px);
  transform-origin: bottom right;
  pointer-events: none;
  transition: opacity 0.15s var(--ease-emphasized), transform 0.22s var(--ease-emphasized);
  z-index: 45;
}
.model-popover.open {
  opacity: 1;
  transform: scale(1) translateY(0);
  pointer-events: auto;
}
.popover-section-title {
  font-size: 12px;
  font-weight: 500;
  color: var(--on-surface-muted);
  padding: 6px 12px 4px;
}
.model-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.model-empty-notice {
  padding: 16px 12px;
  font-size: 13px;
  color: var(--on-surface-muted);
  text-align: center;
  line-height: 1.5;
}
.model-option {
  width: 100%;
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: var(--radius-lg);
  text-align: left;
  transition: background-color 0.15s ease;
}
.model-option:hover,
.model-option.kbd-focus {
  background-color: var(--state-hover);
}
.model-option.selected {
  background-color: color-mix(in srgb, var(--secondary-container) 50%, transparent);
}
.model-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
  font-weight: 500;
  color: var(--on-surface);
}
.model-think-label {
  font-size: 12px;
  color: var(--on-surface-variant);
  flex-shrink: 0;
}
.model-cap-tag {
  font-size: 11px;
  font-weight: 500;
  padding: 1px 7px;
  border-radius: var(--radius-pill);
  background-color: var(--surface-container-high);
  color: var(--on-surface-variant);
  flex-shrink: 0;
}
.model-check {
  width: 18px;
  height: 18px;
  color: var(--primary);
  opacity: 0;
  flex-shrink: 0;
}
.model-option.selected .model-check {
  opacity: 1;
}
.model-chevron {
  width: 16px;
  height: 16px;
  color: var(--on-surface-variant);
  opacity: 0.7;
  flex-shrink: 0;
}

/* 思考强度子菜单（行内弹出，覆盖在列表上方） */
.thinking-submenu {
  position: absolute;
  right: 8px;
  width: 188px;
  background: var(--surface-popover);
  backdrop-filter: blur(22px);
  border-radius: var(--radius-lg);
  box-shadow: var(--elevation-popover);
  padding: 4px;
  z-index: 60;
  display: none;
}
.thinking-submenu.open {
  display: block;
}
.thinking-submenu-title {
  font-size: 12px;
  font-weight: 500;
  color: var(--on-surface-muted);
  padding: 8px 10px 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.thinking-submenu-option {
  width: 100%;
  min-height: 40px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: var(--radius-lg);
  font-size: 13.5px;
  color: var(--on-surface);
  text-align: left;
}
.thinking-submenu-option:hover {
  background-color: var(--state-hover);
}
.thinking-submenu-option > span:first-child {
  flex: 1;
}
.thinking-submenu-option.selected {
  color: var(--primary);
  font-weight: 500;
}
.thinking-submenu-check {
  width: 16px;
  height: 16px;
  color: var(--primary);
  opacity: 0;
  flex-shrink: 0;
}
.thinking-submenu-option.selected .thinking-submenu-check {
  opacity: 1;
}

/* ==========================================================================
   斜杠 `/` 与 `@` 引用弹出菜单
   ========================================================================== */
.command-suggest-popover {
  position: absolute;
  left: 0;
  bottom: calc(100% + 10px);
  width: min(360px, 100%);
  background: var(--surface-popover);
  backdrop-filter: blur(22px);
  border-radius: var(--radius-xl);
  padding: 8px;
  box-shadow: var(--elevation-popover);
  opacity: 0;
  transform: translateY(6px);
  pointer-events: none;
  transition: opacity 0.16s ease, transform 0.2s var(--ease-emphasized);
  z-index: 45;
  max-height: 320px;
  overflow-y: auto;
}
.command-suggest-popover.open {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}
.suggest-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 11px;
  border-radius: var(--radius-lg);
  text-align: left;
  transition: background-color 0.14s ease;
}
.suggest-item:hover,
.suggest-item.kbd-focus {
  background-color: var(--state-hover);
}
.suggest-item-body {
  flex: 1;
  min-width: 0;
}
.suggest-item-title {
  font-size: 13.5px;
  font-weight: 500;
  color: var(--on-surface);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.suggest-item-desc {
  font-size: 12px;
  color: var(--on-surface-variant);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.suggest-tag {
  font-size: 11px;
  padding: 2px 7px;
  border-radius: 6px;
  background-color: var(--surface-container-high);
  color: var(--on-surface-variant);
  font-family: var(--font-mono);
  flex-shrink: 0;
}

/* ==========================================================================
   消息气泡与「汇流」流光 AI 头像
   ========================================================================== */
.msg-user {
  align-self: flex-end;
  max-width: 78%;
  background-color: var(--user-bubble);
  color: var(--on-user-bubble);
  padding: 10px 16px;
  border-radius: 20px 6px 20px 20px;
  font-size: 15.5px;
  line-height: 1.6;
  word-break: break-word;
  position: relative;
}
.msg-user-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 6px;
}
.msg-user-chip {
  font-size: 11.5px;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  background: rgba(0, 0, 0, 0.07);
}
html[data-mode="dark"] .msg-user-chip {
  background: rgba(255, 255, 255, 0.1);
}
.msg-user-images {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 6px;
}
.msg-user-images img {
  max-width: 180px;
  max-height: 140px;
  border-radius: 12px;
  object-fit: cover;
}

.msg-ai {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  width: 100%;
  position: relative;
}
.huiliu-avatar {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  margin-top: 2px;
  color: var(--on-surface-variant);
}
.huiliu-avatar path {
  stroke: currentColor;
  transition: stroke 0.3s ease;
}
.huiliu-avatar circle {
  fill: currentColor;
  transition: transform 0.3s ease, opacity 0.3s ease;
}
@keyframes streamPulse {
  0% { stroke-dashoffset: 28; opacity: 0.55; }
  50% { stroke-dashoffset: 0; opacity: 1; }
  100% { stroke-dashoffset: -28; opacity: 0.55; }
}
@keyframes dotBreathe {
  0%, 100% { transform: scale(0.88); opacity: 0.7; }
  50% { transform: scale(1.18); opacity: 1; }
}
.huiliu-streaming path {
  stroke: url(#brandGrad);
  stroke-dasharray: 28;
  animation: streamPulse 1.6s var(--ease-emphasized) infinite;
}
.huiliu-streaming path:nth-child(2) { animation-delay: 0.18s; }
.huiliu-streaming path:nth-child(3) { animation-delay: 0.36s; }
.huiliu-streaming circle {
  fill: var(--g3);
  transform-box: fill-box;
  transform-origin: center;
  animation: dotBreathe 1.6s ease-in-out infinite;
}

.msg-ai-body {
  flex: 1;
  min-width: 0;
  font-size: 16px;
  line-height: 1.75;
}

/* 可折叠思考过程 */
.thought-block {
  margin-bottom: 10px;
}
.thought-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--on-surface-variant);
  padding: 4px 10px 4px 0;
  border-radius: var(--radius-pill);
}
.thought-toggle:hover {
  color: var(--on-surface);
}
html[data-thinking-style="shimmer"] .thought-block.is-thinking .thought-toggle {
  position: relative;
  overflow: hidden;
  padding: 5px 12px;
  background: var(--secondary-container);
  color: var(--on-secondary-container);
}
html[data-thinking-style="shimmer"] .thought-block.is-thinking .thought-status {
  background: linear-gradient(90deg, var(--on-secondary-container) 25%, var(--primary) 50%, var(--on-secondary-container) 75%);
  background-size: 200% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: thinkingTextShimmer 1.8s linear infinite;
  font-weight: 500;
}
.instant-dismiss,
.instant-dismiss * {
  transition: none !important;
}
.thought-toggle .chevron {
  width: 14px;
  height: 14px;
  transition: transform 0.2s var(--ease-emphasized);
}
.thought-block.expanded .thought-toggle .chevron {
  transform: rotate(180deg);
}
.thought-content {
  display: none;
  margin-top: 6px;
  padding-left: 12px;
  border-left: 2px solid var(--outline-variant);
  font-size: 14px;
  line-height: 1.65;
  color: var(--on-surface-variant);
  white-space: pre-wrap;
  word-break: break-word;
}
.thought-block.expanded .thought-content {
  display: block;
}

/* 正文 Markdown 排版 */
.prose {
  word-break: break-word;
}
.prose p { margin-bottom: 12px; }
.prose p:last-child { margin-bottom: 0; }
.prose h1, .prose h2, .prose h3, .prose h4 {
  font-weight: 600;
  line-height: 1.35;
  margin: 1.25em 0 0.5em;
}
.prose h1 { font-size: 1.35em; }
.prose h2 { font-size: 1.2em; }
.prose h3 { font-size: 1.08em; }
.prose ul, .prose ol {
  padding-left: 22px;
  margin-bottom: 12px;
}
.prose li { margin-bottom: 4px; }
.prose blockquote {
  border-left: 3px solid var(--outline-variant);
  padding-left: 12px;
  color: var(--on-surface-variant);
  margin: 10px 0;
}
.prose code {
  font-family: var(--font-mono);
  font-size: 0.88em;
  background: var(--surface-container-high);
  padding: 2px 6px;
  border-radius: 6px;
}
.prose a {
  color: var(--primary);
  text-decoration: underline;
  text-underline-offset: 3px;
}
.table-scroll {
  overflow-x: auto;
  margin: 12px 0;
  border-radius: 12px;
}
.prose table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.prose th {
  background: var(--surface-container);
  text-align: left;
  font-weight: 500;
  padding: 8px 12px;
}
.prose td {
  padding: 8px 12px;
  border-top: 1px solid color-mix(in srgb, var(--outline-variant) 45%, transparent);
}

/* 代码块 */
.code-card {
  background-color: var(--surface-container-high);
  border-radius: 14px;
  margin: 12px 0;
  overflow: hidden;
}
.code-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 12px 6px 14px;
  background-color: var(--surface-container);
  font-size: 12px;
  color: var(--on-surface-variant);
  font-family: var(--font-mono);
}
.code-copy-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 8px;
  font-family: var(--font-sans);
  font-size: 11.5px;
  color: var(--on-surface-variant);
  opacity: 0;
  transition: opacity 0.15s ease, background-color 0.15s ease;
}
.code-card:hover .code-copy-btn,
.code-copy-btn.copied {
  opacity: 1;
}
.code-copy-btn:hover {
  background: var(--state-hover);
  color: var(--on-surface);
}
.code-card pre {
  padding: 12px 16px;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 13.5px;
  line-height: 1.6;
}
.code-card pre code {
  background: none;
  padding: 0;
  font-size: inherit;
}

/* 错误与中断提示块 */
.msg-error-banner {
  margin-top: 10px;
  padding: 10px 14px;
  border-radius: var(--radius-lg);
  background: var(--error-container);
  color: var(--on-error-container);
  font-size: 13.5px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}
.msg-error-actions {
  display: flex;
  gap: 8px;
}
.inline-pill-btn {
  padding: 4px 12px;
  border-radius: var(--radius-pill);
  background: var(--surface-container-lowest);
  color: var(--on-surface);
  font-size: 12.5px;
  font-weight: 500;
}

/* 引用来源胶囊 */
.msg-citations {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
}
.citation-link-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  background: var(--surface-container-low);
  color: var(--primary);
  font-size: 12px;
  transition: background-color 0.15s ease;
}
.citation-link-pill:hover {
  background: var(--secondary-container);
}

/* 回复操作行 (最后一条常显，其余悬停) */
.msg-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 8px;
  opacity: 0;
  transition: opacity 0.2s ease;
}
.msg-ai:hover .msg-actions,
.msg-ai:last-child .msg-actions,
.msg-ai.actions-visible .msg-actions {
  opacity: 1;
}
.msg-action-btn {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: inline-grid;
  place-items: center;
  color: var(--on-surface-variant);
  transition: background-color 0.15s ease, color 0.15s ease;
}
.msg-action-btn:hover {
  background-color: var(--state-hover);
  color: var(--on-surface);
}
.msg-action-btn .icon {
  width: 17px;
  height: 17px;
}
.msg-meta-stat {
  margin-left: 8px;
  font-size: 11.5px;
  color: var(--on-surface-muted);
}

/* ==========================================================================
   Ctrl + K 全局命令面板 & 28px 圆角 M3 弹窗
   ========================================================================== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: var(--backdrop-scrim);
  backdrop-filter: blur(4px);
  display: grid;
  place-items: center;
  padding: 16px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease;
  z-index: 80;
}
.modal-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}
.cmdk-backdrop {
  place-items: start center;
  padding-top: 12vh;
}
.cmdk-dialog {
  width: min(560px, 94vw);
  background: var(--surface-popover);
  backdrop-filter: blur(24px);
  border-radius: var(--radius-2xl);
  padding: 12px;
  box-shadow: var(--elevation-popover);
  transform: scale(0.96) translateY(-8px);
  transition: transform 0.22s var(--ease-emphasized);
  max-height: 76vh;
  display: flex;
  flex-direction: column;
}
.modal-backdrop.open .cmdk-dialog {
  transform: scale(1) translateY(0);
}
.cmdk-input-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px 10px;
}
.cmdk-input-row input {
  flex: 1;
  font-size: 15.5px;
  min-width: 0;
}
.cmdk-body {
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.cmdk-tool-panel {
  margin-top: 8px;
  background: var(--surface-container-low);
  border-radius: 18px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.cmdk-tool-input {
  width: 100%;
  background: var(--surface-container-lowest);
  border-radius: 12px;
  padding: 9px 12px;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--on-surface);
}
.cmdk-tool-out {
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.6;
  color: var(--on-surface-variant);
  white-space: pre-wrap;
  word-break: break-all;
}

/* M3 对话框 (圆角 28px) */
.m3-dialog {
  width: min(460px, 94vw);
  background: var(--surface-popover);
  backdrop-filter: blur(24px);
  border-radius: var(--radius-2xl);
  padding: 22px 24px;
  box-shadow: var(--elevation-popover);
  transform: scale(0.95);
  transition: transform 0.22s var(--ease-emphasized);
  max-height: 82vh;
  display: flex;
  flex-direction: column;
}
.modal-backdrop.open .m3-dialog {
  transform: scale(1);
}
.m3-dialog.wide {
  width: min(560px, 94vw);
}
.dialog-title {
  font-size: 18px;
  font-weight: 500;
  margin-bottom: 8px;
}
.dialog-desc {
  font-size: 14px;
  color: var(--on-surface-variant);
  line-height: 1.6;
  margin-bottom: 18px;
}
.dialog-input {
  width: 100%;
  background: var(--surface-container-low);
  border-radius: 14px;
  padding: 11px 14px;
  font-size: 15px;
  margin-bottom: 18px;
}
.dialog-input:focus {
  background: var(--surface-container);
}
.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: auto;
}
.btn-text {
  height: 38px;
  padding: 0 16px;
  border-radius: var(--radius-pill);
  font-size: 14px;
  font-weight: 500;
  color: var(--primary);
}
.btn-text:hover {
  background: var(--state-hover);
}
.btn-filled {
  height: 38px;
  padding: 0 18px;
  border-radius: var(--radius-pill);
  font-size: 14px;
  font-weight: 500;
  background: var(--primary);
  color: var(--on-primary);
}
.btn-filled.danger {
  background: var(--error);
  color: var(--on-error);
}

/* 已归档列表 */
.archive-list {
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 6px 0 16px;
  max-height: 48vh;
}
.archive-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 14px;
  background: var(--surface-container-low);
}
.archive-item-info {
  min-width: 0;
  flex: 1;
}
.archive-item-title {
  font-size: 14px;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.archive-item-meta {
  font-size: 12px;
  color: var(--on-surface-muted);
}
.archive-item-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}
.mini-pill-btn {
  padding: 5px 11px;
  border-radius: var(--radius-pill);
  font-size: 12px;
  font-weight: 500;
  background: var(--surface-container);
  color: var(--on-surface);
}
.mini-pill-btn:hover {
  background: var(--surface-container-high);
}
.mini-pill-btn.danger {
  color: var(--error);
}

/* Snackbar 提示 */
.snackbar {
  position: fixed;
  left: 50%;
  bottom: calc(24px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%) translateY(16px);
  background: var(--on-surface);
  color: var(--surface);
  padding: 10px 18px;
  border-radius: var(--radius-pill);
  font-size: 13.5px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.22s var(--ease-emphasized);
  z-index: 120;
  max-width: 90vw;
  text-align: center;
}
.snackbar.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ==========================================================================
   手机端适配 (< 600px Compact — DELTA §8.1 & §8.3)
   ========================================================================== */
@media (max-width: 599px) {
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: min(296px, 84vw);
    transform: translateX(-105%);
    box-shadow: var(--elevation-popover);
  }
  .sidebar.collapsed {
    width: min(296px, 84vw);
  }
  .sidebar.mobile-open {
    transform: translateX(0);
  }
  .drawer-scrim.open {
    display: block;
    opacity: 1;
  }
  #toggleSidebarBtn {
    display: none;
  }
  .mobile-menu-btn,
  .mobile-search-btn {
    display: inline-grid;
  }
  .topbar {
    padding: 0 10px;
  }
  .topbar-center-title {
    max-width: 44vw;
  }
  .icon-btn {
    min-width: 42px;
    min-height: 42px;
  }

  .message-stream {
    padding: 14px 14px 190px;
  }
  .msg-user {
    max-width: 85%;
  }

  .composer-stage {
    padding: 0 12px;
  }
  .chat-viewport.in-conversation .composer-stage {
    padding: 18px 12px calc(12px + env(safe-area-inset-bottom, 0px));
  }
  .composer-box {
    padding: 12px 12px 6px 14px;
  }
  .composer-toolbar {
    margin-left: -4px;
    height: 44px;
  }
  .kb-toggle-pill .kb-label {
    display: none;
  }
  .model-trigger {
    max-width: 165px;
    padding: 0 8px 0 10px;
    font-size: 13px;
    gap: 6px;
  }
  .minimal-starters {
    gap: 2px;
  }
  .starter-sep {
    display: none;
  }
  .scroll-bottom-btn {
    right: 14px;
    bottom: 136px;
  }

  /* 手机端浮层全部变为底部抽屉 */
  .sheet-handle {
    display: block;
    width: 36px;
    height: 4px;
    border-radius: var(--radius-pill);
    background: var(--outline-variant);
    margin: 4px auto 10px;
    flex-shrink: 0;
  }
  .model-popover,
  .command-suggest-popover {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    border-radius: 24px 24px 0 0;
    padding: 8px 12px calc(16px + env(safe-area-inset-bottom, 0px));
    transform: translateY(100%);
    transform-origin: bottom center;
    max-height: 75dvh;
  }
  .model-popover.open,
  .command-suggest-popover.open {
    transform: translateY(0);
  }
  .model-list {
    max-height: none;
  }

  .cmdk-backdrop {
    align-items: end;
    justify-items: stretch;
    padding: 0;
  }
  .cmdk-dialog {
    width: 100%;
    border-radius: 24px 24px 0 0;
    padding: 8px 12px calc(18px + env(safe-area-inset-bottom, 0px));
    transform: translateY(100%);
    max-height: 82dvh;
  }
  .modal-backdrop.open .cmdk-dialog {
    transform: translateY(0);
  }

  /* 手机端：最后一条外其余长按弹出操作，最后一条常显 */
  .msg-ai:not(:last-child) .msg-actions {
    display: none;
  }
  .msg-ai.actions-visible .msg-actions {
    display: flex;
    opacity: 1;
  }
  .code-copy-btn {
    opacity: 1;
  }
}

/* 客服留言通道：空态提示与等待回复态 */
.muse-inbox-empty {
  max-width: 560px;
  margin: 48px auto;
  padding: 0 20px;
  text-align: center;
  font-size: 14px;
  line-height: 1.8;
  color: var(--on-surface-variant);
}
.muse-waiting {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--on-surface-variant);
  font-size: 15px;
}
.muse-waiting-dot {
  width: 9px;
  height: 9px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--brand-gradient);
  animation: muse-waiting-pulse 1.4s ease-in-out infinite;
}
@keyframes muse-waiting-pulse {
  0%, 100% { opacity: .35; transform: scale(.85); }
  50% { opacity: 1; transform: scale(1); }
}
