/* ========================================
   WPS AI Assistant - 浅色主题样式表
   ======================================== */

:root {
  /* 背景色 - 浅色系 */
  --bg-primary: #f9fafb;
  --bg-secondary: #ffffff;
  --bg-tertiary: #f3f4f6;
  --bg-hover: #f0f1f3;
  --bg-glass: rgba(255, 255, 255, 0.65);

  /* 边框色 */
  --border-color: #e5e7eb;
  --border-light: #d1d5db;

  /* 文字色 - 深色系 */
  --text-primary: #1e293b;
  --text-secondary: #475569;
  --text-muted: #94a3b8;

  /* 强调色 */
  --accent-blue: #1E40AF;
  --accent-blue-hover: #1D4ED8;
  --accent-indigo: #6366f1;
  --accent-green: #10b981;
  --accent-orange: #f97316;
  --accent-purple: #8b5cf6;

  /* 渐变色 */
  --gradient-blue: linear-gradient(135deg, #1E40AF 0%, #1E3A8A 100%);
  --gradient-green: linear-gradient(135deg, #22c55e 0%, #10b981 100%);
  --gradient-orange: linear-gradient(135deg, #f97316 0%, #f59e0b 100%);
  --gradient-purple: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);

  /* 方案默认强调色（用于发送按钮、用户气泡等） */
  --primary-gradient: linear-gradient(135deg, #6366f1 0%, #a855f7 100%);
  --primary-glow-rgb: 99, 102, 241;

  /* 极光色系背景（可随模型主题微调） */
  --aurora-1: rgba(99, 102, 241, 0.15);
  --aurora-2: rgba(168, 85, 247, 0.15);
  --aurora-3: rgba(56, 189, 248, 0.15);

  /* 阴影 */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.12);
  --shadow-inner: inset 0 2px 4px rgba(0, 0, 0, 0.05);
  --shadow-float: 0 20px 50px -10px rgba(0, 0, 0, 0.12);
  --glow-code: 0 0 0 1px rgba(99, 102, 241, 0.1), 0 0 20px rgba(99, 102, 241, 0.05);

  /* 悬浮输入区占位（会被 JS 动态更新）- 增加底部呼吸空间 */
  --composer-safe-area: 180px;

  /* 动画 */
  --ease-elastic: cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease-out: cubic-bezier(0.2, 0.8, 0.2, 1);

  /* 布局 */
  --header-height: 64px;

  /* 圆角 */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-full: 9999px;

  /* Auth Panel 变量 */
  --auth-panel-max-width: 380px;
  --auth-panel-radius: 18px;
  --auth-panel-padding-bottom: 24px;
  --auth-panel-top-offset: 48px;
  --auth-panel-header-margin-top: 24px;
  --auth-panel-header-margin-bottom: 24px;

  /* 过渡 */
  --transition: all 0.2s ease;

  /* 默认深色主题文字 (WPS AI default) */
  --text-deep-theme: #3B0764;
  --markdown-heading-letter-spacing: 0.07em;
  --markdown-list-item-gap: 0.5em;
  --markdown-card-title-letter-spacing: 0.07em;
  --markdown-card-title-weight: 600;
  --markdown-list-strong-letter-spacing: 0.07em;
}

:root[data-model="aii"] {
  --primary-gradient: linear-gradient(135deg, #6366f1 0%, #a855f7 100%);
  --primary-glow-rgb: 99, 102, 241;
  --text-deep-theme: #3B0764; /* Deep Aubergine */
  --orb-stop-1: #FFF5D1; --orb-stop-2: #FFD700;
  --orb-stop-3: #D97706; --orb-stop-4: #92400E;
}

:root[data-model="gpt"] {
  --primary-gradient: var(--gradient-green);
  --primary-glow-rgb: 16, 185, 129;
  --aurora-1: rgba(16, 185, 129, 0.14);
  --aurora-2: rgba(34, 197, 94, 0.12);
  --aurora-3: rgba(45, 212, 191, 0.12);
  --text-deep-theme: #064E3B; /* Deep Emerald */
  --orb-stop-1: #D1FAE5; --orb-stop-2: #34D399;
  --orb-stop-3: #10B981; --orb-stop-4: #065F46;
}

:root[data-model="claude"] {
  --primary-gradient: var(--gradient-orange);
  --primary-glow-rgb: 249, 115, 22;
  --aurora-1: rgba(249, 115, 22, 0.14);
  --aurora-2: rgba(245, 158, 11, 0.12);
  --aurora-3: rgba(250, 204, 21, 0.10);
  --text-deep-theme: #7C2D12; /* Deep Amber */
  --orb-stop-1: #FFEDD5; --orb-stop-2: #FB923C;
  --orb-stop-3: #F97316; --orb-stop-4: #9A3412;
}

:root[data-model="deepseek"] {
  --primary-gradient: var(--gradient-purple);
  --primary-glow-rgb: 139, 92, 246;
  --aurora-1: rgba(139, 92, 246, 0.14);
  --aurora-2: rgba(124, 58, 237, 0.12);
  --aurora-3: rgba(56, 189, 248, 0.10);
  --text-deep-theme: #581C87; /* Deep Purple */
  --orb-stop-1: #EDE9FE; --orb-stop-2: #A78BFA;
  --orb-stop-3: #8B5CF6; --orb-stop-4: #5B21B6;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: 15px;
  line-height: 1.6;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.hidden {
  display: none !important;
}

/* ========================================
   方案 A: 流体极光背景（Fluid Aurora Mesh）
   ======================================== */

.ambient-mesh-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: -1;
  overflow: hidden;
  background: var(--bg-primary);
  pointer-events: none;
}

.mesh-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.85;
  animation: float-mesh 20s infinite ease-in-out alternate;
}

.orb-1 {
  top: -10%;
  left: -10%;
  width: 50vw;
  height: 50vw;
  background: var(--aurora-1);
  animation-delay: 0s;
}

.orb-2 {
  bottom: -10%;
  right: -10%;
  width: 60vw;
  height: 60vw;
  background: var(--aurora-2);
  animation-delay: -5s;
}

.orb-3 {
  top: 30%;
  left: 30%;
  width: 40vw;
  height: 40vw;
  background: var(--aurora-3);
  animation-delay: -10s;
  opacity: 0.65;
}

@keyframes float-mesh {
  0% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(30px, -50px) scale(1.1); }
  66% { transform: translate(-20px, 20px) scale(0.9); }
  100% { transform: translate(0, 0) scale(1); }
}

/* AI 生成中：加速背景流动（通过 JS 添加 .thinking） */
body.thinking .mesh-orb {
  animation-duration: 4s;
  filter: blur(60px) saturate(1.45);
}

/* 隐藏额外的背景层（保留元素兼容性） */
.bg-noise,
.matrix-grid,
.glass-overlay {
  display: none;
}

/* ========================================
   悬浮工具栏
   ======================================== */

.floating-toolbar {
  position: fixed;
  z-index: 9999;
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 6px 8px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  animation: toolbar-appear 0.15s ease-out;
}

@keyframes toolbar-appear {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.floating-toolbar button {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 10px;
  background: transparent;
  color: var(--text-secondary);
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 12px;
  white-space: nowrap;
  transition: var(--transition);
}

.floating-toolbar button:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.floating-toolbar button:active {
  transform: scale(0.96);
}

.floating-toolbar button svg {
  flex-shrink: 0;
}

.toolbar-arrow {
  position: absolute;
  bottom: -6px;
  left: 50%;
  transform: translateX(-50%);
  width: 12px;
  height: 6px;
  overflow: hidden;
}

.toolbar-arrow::after {
  content: '';
  position: absolute;
  top: -6px;
  left: 50%;
  transform: translateX(-50%) rotate(45deg);
  width: 10px;
  height: 10px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-top: none;
  border-left: none;
}

/* ========================================
   主应用容器
   ======================================== */

#app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  max-height: 100vh;
  overflow: hidden;
  background: transparent;
  min-width: 300px;
  width: 100%;
  position: relative;
  /* 默认（窄屏）：全宽覆盖 */
  --cortex-width: 100%;
}

@media (min-width: 960px) {
  #app {
    /* 宽屏：侧边栏模式 */
    --cortex-width: clamp(320px, 40vw, 520px);
  }
}

/* ========================================
   头部
   ======================================== */

.header {
  height: var(--header-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
  background: transparent;
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  width: 100%;
  box-sizing: border-box;
}

.glass-header {
  background: transparent;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  border-bottom: none;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Header 左侧：菜单 + 模型 + 升级 */
.header-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.header-logo-btn {
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(12px) saturate(180%);
  -webkit-backdrop-filter: blur(12px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 999px;
  cursor: pointer;
  padding: 0 14px;
  color: #111827;
  font-size: 15px;
  font-weight: 600;
  line-height: 1;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06), inset 0 0 0 1px rgba(255, 255, 255, 0.3);
  transition: transform 0.15s ease, box-shadow 0.2s ease;
}

.header-menu-btn {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(12px) saturate(180%);
  -webkit-backdrop-filter: blur(12px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 999px;
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
  color: #111827;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06), inset 0 0 0 1px rgba(255, 255, 255, 0.3);
  transition: transform 0.15s ease, box-shadow 0.2s ease;
}

.header-menu-btn:hover {
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1), inset 0 0 0 1px rgba(255, 255, 255, 0.4);
}

.header-menu-btn:active {
  transform: scale(0.96);
}

.header-menu-icon {
  display: block;
}

.header-model-chip-text {
  display: inline-block;
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 模型容器交互态 */
.header-logo-btn:hover {
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1), inset 0 0 0 1px rgba(255, 255, 255, 0.4);
}


/* 模型容器按压态 */
.header-logo-btn:active {
  transform: scale(0.97);
}

/* 升级按钮 */
.upgrade-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 36px;
  padding: 0 12px;
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(12px) saturate(180%);
  -webkit-backdrop-filter: blur(12px) saturate(180%);
  color: #111827;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06), inset 0 0 0 1px rgba(255, 255, 255, 0.3);
  transition: transform 0.15s ease, box-shadow 0.2s ease;
  white-space: nowrap;
}

.upgrade-pill:hover {
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1), inset 0 0 0 1px rgba(255, 255, 255, 0.4);
}

.upgrade-pill:active {
  transform: scale(0.97);
}

.upgrade-pill.hidden {
  display: none;
}

.upgrade-sparkle {
  flex-shrink: 0;
}

/* 登录 pill */
.login-pill-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 36px;
  padding: 0 16px;
  border: none;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(12px) saturate(180%);
  -webkit-backdrop-filter: blur(12px) saturate(180%);
  color: #ffffff;
  font-size: 14px;
  font-weight: 400;
  letter-spacing: 0.5px;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  transition: transform 0.15s ease, background 0.2s ease;
}

.login-pill-btn:hover {
  background: #111111;
}

.login-pill-btn:active {
  transform: scale(0.97);
}

.login-pill-btn.hidden {
  display: none;
}

/* 已登录操作组 */
.header-actions-group {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 2px 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(12px) saturate(180%);
  -webkit-backdrop-filter: blur(12px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.5);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06), inset 0 0 0 1px rgba(255, 255, 255, 0.3);
}

.header-actions-group.hidden {
  display: none;
}

/* 账户/余额信息 */
.account-info {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  background: rgba(59, 130, 246, 0.15);
  border-radius: 12px;
  font-size: 12px;
  color: var(--accent-color, #3b82f6);
}

.account-info.hidden {
  display: none;
}

.account-balance {
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.account-balance::before {
  content: "⚡";
  margin-right: 2px;
}

/* 已登录状态的账户按钮 */
.icon-btn.logged-in {
  color: var(--accent-color, #3b82f6);
}

.icon-btn {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  border-radius: var(--radius-full);
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition);
}

#btn-memory {
  position: relative;
}

#btn-memory.pulsing {
  color: var(--accent-purple);
}

#btn-memory.pulsing::after {
  content: "";
  position: absolute;
  inset: 6px;
  border-radius: 999px;
  box-shadow: 0 0 0 0 rgba(139, 92, 246, 0.45);
  animation: memory-pulse 1.8s ease-in-out infinite;
  pointer-events: none;
}

#btn-memory.flash {
  animation:
    memory-bounce 0.55s cubic-bezier(0.18, 0.89, 0.32, 1.28) 1,
    memory-flash 0.65s ease-out 1;
}

@keyframes memory-pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(139, 92, 246, 0.35);
    opacity: 0.9;
  }
  70% {
    box-shadow: 0 0 0 10px rgba(139, 92, 246, 0);
    opacity: 0.45;
  }
  100% {
    box-shadow: 0 0 0 0 rgba(139, 92, 246, 0);
    opacity: 0;
  }
}

@keyframes memory-flash {
  0% {
    filter: drop-shadow(0 0 0 rgba(139, 92, 246, 0));
  }
  45% {
    filter: drop-shadow(0 0 10px rgba(139, 92, 246, 0.55));
  }
  100% {
    filter: drop-shadow(0 0 0 rgba(139, 92, 246, 0));
  }
}

@keyframes memory-bounce {
  0% { transform: scale(1); }
  45% { transform: scale(1.18); }
  70% { transform: scale(0.96); }
  100% { transform: scale(1); }
}

.icon-btn:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

/* 模型选择器触发器 */
.model-selector-trigger {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  margin: 0;
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.2s ease;
  border: 1px solid rgba(255, 255, 255, 0.6);
  background: rgba(255, 255, 255, 0.5);
}

.model-selector-trigger:hover {
  background: rgba(255, 255, 255, 0.9);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.model-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  box-shadow: var(--shadow-sm);
  flex-shrink: 0;
}

.model-icon.aii { background: var(--gradient-blue); }
.model-icon.gpt { background: var(--gradient-green); }
.model-icon.claude { background: var(--gradient-orange); }
.model-icon.deepseek { background: var(--gradient-purple); }

.model-info {
  display: flex;
  align-items: center;
}

.model-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.2;
}

.model-provider {
  font-size: 10px;
  color: var(--text-muted);
  font-weight: 500;
}

.dropdown-arrow {
  color: var(--text-muted);
  transition: transform 0.2s ease;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
}

.model-selector-trigger.active .dropdown-arrow {
  transform: rotate(180deg);
}

/* ========================================
   模型下拉菜单
   ======================================== */

.model-dropdown {
  position: fixed;
  top: calc(var(--header-height) + 6px);
  left: 20px;
  width: min(320px, calc(100% - 40px));
  background: var(--bg-secondary);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border-color);
  overflow: hidden;
  z-index: 1000;
  animation: dropdown-appear 0.2s ease-out;
}

@keyframes dropdown-appear {
  from {
    opacity: 0;
    transform: translateY(-10px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* 离场动画 - 缩小淡出（增强版，更明显的视觉反馈） */
@keyframes dropdown-exit {
  0% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
  100% {
    opacity: 0;
    transform: translateY(-12px) scale(0.92);
  }
}

.model-dropdown.closing {
  animation: dropdown-exit 0.7s cubic-bezier(0.4, 0, 1, 1) forwards;
  pointer-events: none; /* 防止动画期间误点击 */
}

.model-dropdown-header {
  padding: 10px 12px;
  background: var(--bg-tertiary);
  border-bottom: 1px solid var(--border-color);
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.model-dropdown-list {
  padding: 4px;
}

.model-option {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: var(--transition);
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
}

.model-option:hover {
  background: var(--bg-tertiary);
}

.model-option.active {
  background: rgba(59, 130, 246, 0.08);
}

.model-option-dot {
  width: 8px;
  height: 8px;
  border-radius: var(--radius-full);
  margin-top: 6px;
  flex-shrink: 0;
}

.model-option-dot.aii { background: var(--gradient-blue); }
.model-option-dot.gpt { background: var(--gradient-green); }
.model-option-dot.claude { background: var(--gradient-orange); }
.model-option-dot.deepseek { background: var(--gradient-purple); }

.model-option-info {
  flex: 1;
  min-width: 0;
}

.model-option-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  display: block;
}

.model-option.active .model-option-name {
  color: var(--accent-blue);
}

.model-option-desc {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
  display: block;
  line-height: 1.3;
}

.model-option-check {
  color: var(--accent-blue);
  margin-left: auto;
  margin-top: 4px;
  flex-shrink: 0;
}

.model-option.disabled {
  opacity: 0.55;
  cursor: not-allowed;
  pointer-events: none;
}

.model-option.disabled:hover {
  background: transparent;
}

.reasoning-depth-section {
  border-top: 1px solid var(--border-color);
  padding: 10px 12px 12px;
}

.reasoning-depth-header {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

.reasoning-depth-toggle {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  padding: 4px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  background: var(--bg-tertiary);
}

.depth-btn {
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-secondary);
  border-radius: calc(var(--radius-lg) - 4px);
  font-size: 11px;
  line-height: 1.2;
  font-weight: 600;
  padding: 7px 4px;
  cursor: pointer;
  transition: var(--transition);
}

.depth-btn:hover {
  background: rgba(255, 255, 255, 0.06);
}

.depth-btn.active {
  color: rgb(var(--primary-glow-rgb));
  border-color: rgba(var(--primary-glow-rgb), 0.3);
  background: rgba(var(--primary-glow-rgb), 0.12);
}

/* ========================================
   聊天区域
   ======================================== */

.chat {
  flex: 1;
  overflow-y: auto;
  padding: calc(var(--header-height) + 20px) 28px 0;
  display: flex;
  flex-direction: column;
  gap: 28px;
  background: transparent;
  scrollbar-width: thin;
  scrollbar-color: rgba(0, 0, 0, 0.12) transparent;
}

.chat-spacer {
  height: var(--composer-safe-area);
  width: 100%;
  flex-shrink: 0;
  pointer-events: none;
}

.chat::-webkit-scrollbar {
  width: 6px;
}

.chat::-webkit-scrollbar-track {
  background: transparent;
}

.chat::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 3px;
}

.chat::-webkit-scrollbar-thumb:hover {
  background: var(--border-light);
}

/* Cortex Panel 打开时：响应式策略 */

/* 1. 默认（窄屏）：Overlay + Push-Left */
#app.cortex-open .chat {
  /* 聊天内容向左被“挤”出屏幕，并虚化 */
  transform: translateX(-120px);
  opacity: 0.4;
  filter: blur(1px);
  transition: transform 0.35s cubic-bezier(0.23, 1, 0.32, 1), opacity 0.35s ease, filter 0.35s ease;
  pointer-events: none; /* 遮挡时不可交互 */
}

#app.cortex-open .composer-container,
#app.composer-docked .composer-container {
  /* 输入框左移停靠，作为“把手” */
  left: 0;
  right: auto;
  transform: translateX(calc(-100% + 20.5px)); /* 再次向左收缩 2px */
  width: min(300px, calc(100% - 40px)); /* 限制宽度，使其看起来更像把手 */
  opacity: 0.5; /* 半透明 */
  pointer-events: auto; /* 允许点击 */
  cursor: pointer; /* 手型光标 */
  transition: 
    left 0.35s cubic-bezier(0.23, 1, 0.32, 1),
    transform 0.35s cubic-bezier(0.23, 1, 0.32, 1),
    width 0.35s ease,
    opacity 0.35s ease;
}

#app.cortex-open .composer-container *,
#app.composer-docked .composer-container * {
  /* 禁用内部元素交互，确保点击触发容器事件 */
  pointer-events: none;
}

#app.cortex-open .composer-container:hover,
#app.composer-docked .composer-container:hover {
  opacity: 0.9;
}

/* 当输入框停靠在左侧时，增加明显的灰度背景，强化“停靠”的视觉隐喻 */
#app.cortex-open .composer-container .composer-glass-panel,
#app.composer-docked .composer-container .composer-glass-panel {
  background: rgba(var(--primary-glow-rgb), 0.15); /* 主题色玻璃质感，略微提升清晰度 */
  border-color: rgba(var(--primary-glow-rgb), 0.1); /* 匹配主题色的边框 */
  box-shadow:
    4px 0 16px rgba(0, 0, 0, 0.08), /* 面板自身的3D投影 */
    inset -1px 0 2px rgba(255, 255, 255, 0.8); /* 内高光增强立体感 */
  backdrop-filter: blur(16px) saturate(100%); /* 降低模糊，恢复饱和 */
  -webkit-backdrop-filter: blur(16px) saturate(100%);
}


/* 2. 宽屏 (>= 960px)：Side-by-Side 并排 */
@media (min-width: 960px) {
  #app.cortex-open .chat {
    padding-right: calc(28px + var(--cortex-width));
    transform: none;
    opacity: 1;
    filter: none;
    pointer-events: auto;
    transition: padding-right 0.28s ease;
  }

  #app.cortex-open .composer-container {
    /* 输入框居中于剩余空间 */
    width: max(260px, calc(100% - 40px - var(--cortex-width)));
    left: calc(50% - (var(--cortex-width) / 2));
    transform: translateX(-50%);
    opacity: 1;
    pointer-events: auto;
    transition: left 0.28s ease, width 0.28s ease;
  }
}

/* Cortex Panel（记忆面板） */
.cortex-panel {
  position: absolute;
  top: var(--header-height);
  right: 0;
  bottom: 0;
  width: var(--cortex-width);
  z-index: 95;
  pointer-events: auto;
  transform: translateX(0);
  opacity: 1;
  transition: transform 0.35s cubic-bezier(0.23, 1, 0.32, 1), opacity 0.25s ease;
}

.cortex-panel.hidden {
  pointer-events: none;
  opacity: 0;
  /* 完全滑出屏幕 */
  transform: translateX(100%);
}

.cortex-panel-inner {
  height: 100%;
  border-left: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(24px) saturate(300%);
  -webkit-backdrop-filter: blur(24px) saturate(300%);
  box-shadow: -20px 0 40px -5px rgba(0, 0, 0, 0.1), -10px 0 15px -6px rgba(0, 0, 0, 0.05);
  display: flex;
  flex-direction: column;
}

.cortex-header {
  padding: 16px 16px 12px 20px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.28);
}

.cortex-title {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: rgba(15, 23, 42, 0.65);
}

.cortex-subtitle {
  margin-top: 3px;
  font-size: 11px;
  color: rgba(30, 41, 59, 0.5);
  font-weight: 500;
}

.cortex-close {
  color: rgba(30, 41, 59, 0.45);
  transition: color 0.2s ease;
}

.cortex-close:hover {
  color: var(--text-primary);
  background: rgba(0,0,0,0.04);
}

.cortex-scroll {
  padding: 20px 20px 24px 20px;
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  gap: 24px;
  flex: 1;
  min-height: 0;
}

.cortex-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.cortex-working {
  position: relative;
  padding: 16px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.35);
  border: 1px solid rgba(148, 163, 184, 0.12);
  box-shadow: inset 0 1px 2px rgba(255,255,255,0.6);
}

.cortex-working::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 20px;
  background:
    radial-gradient(circle at 20% 30%, rgba(139, 92, 246, 0.08), transparent 60%),
    radial-gradient(circle at 80% 70%, rgba(59, 130, 246, 0.08), transparent 60%);
  opacity: 0.6;
  animation: wm-breathe 6s ease-in-out infinite;
  pointer-events: none;
}

.cortex-working > * {
  position: relative;
}

@keyframes wm-breathe {
  0%, 100% { opacity: 0.5; transform: scale(1); }
  50% { opacity: 0.8; transform: scale(1.02); }
}

.cortex-section-title {
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(15, 23, 42, 0.55);
  margin-bottom: 2px;
}

.cortex-section-desc {
  font-size: 10px;
  color: rgba(30, 41, 59, 0.45);
  margin-top: -6px;
  margin-bottom: 4px;
}

/* ========================================
   Storage Config (Repository) Styles
   ======================================== */

.cortex-storage {
  position: relative;
  padding: 14px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.3);
  border: 1px solid rgba(148, 163, 184, 0.1);
}

.storage-config {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.storage-path-row {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.5);
  border-radius: 8px;
  padding: 8px 10px;
  border: 1px solid rgba(148, 163, 184, 0.12);
}

.storage-path-value {
  flex: 1;
  font-size: 11px;
  font-family: "SF Mono", "Menlo", "Monaco", "Consolas", monospace;
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.storage-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 6px 10px;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.6);
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.storage-btn:hover {
  background: rgba(255, 255, 255, 0.85);
  border-color: rgba(148, 163, 184, 0.28);
  color: var(--text-primary);
}

.storage-btn-copy {
  padding: 4px 6px;
  background: transparent;
  border: none;
}

.storage-btn-copy:hover {
  background: rgba(139, 92, 246, 0.1);
  color: var(--accent-purple);
}

.storage-btn-secondary {
  background: transparent;
  border-color: rgba(148, 163, 184, 0.12);
  color: var(--text-muted);
}

.storage-btn-secondary:hover {
  background: rgba(139, 92, 246, 0.08);
  border-color: rgba(139, 92, 246, 0.2);
  color: var(--accent-purple);
}

.storage-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.storage-pill {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  font-size: 10px;
  font-weight: 600;
  border-radius: 10px;
  letter-spacing: 0.02em;
}

.storage-pill-default {
  background: rgba(148, 163, 184, 0.12);
  color: var(--text-muted);
}

.storage-pill-custom {
  background: rgba(139, 92, 246, 0.12);
  color: var(--accent-purple);
}

.storage-pill-ok {
  background: rgba(16, 185, 129, 0.12);
  color: var(--accent-green);
}

.storage-pill-warn {
  background: rgba(249, 115, 22, 0.12);
  color: var(--accent-orange);
}

.storage-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}

/* Storage Edit Form */
.storage-edit-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.storage-edit-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.storage-edit-input {
  width: 100%;
  padding: 10px 12px;
  font-size: 12px;
  font-family: "SF Mono", "Menlo", "Monaco", "Consolas", monospace;
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 8px;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.storage-edit-input:focus {
  border-color: rgba(139, 92, 246, 0.5);
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.1);
}

.storage-edit-input::placeholder {
  color: var(--text-muted);
}

.storage-migrate-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.storage-radio {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--text-secondary);
  cursor: pointer;
}

.storage-radio input[type="radio"] {
  width: 14px;
  height: 14px;
  accent-color: var(--accent-purple);
  cursor: pointer;
}

.storage-edit-actions {
  display: flex;
  gap: 8px;
  margin-top: 4px;
}

/* ========================================
   Compact Settings
   ======================================== */

.compact-settings {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* ========================================
   Task Sound Settings
   ======================================== */

.task-sound-settings {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.task-sound-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.task-sound-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: var(--text-primary);
  cursor: pointer;
}

.task-sound-toggle input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--accent-purple);
  cursor: pointer;
}

.task-sound-status {
  font-size: 10px;
  padding: 3px 8px;
  border-radius: 10px;
  background: rgba(148, 163, 184, 0.12);
  color: var(--text-muted);
}

.task-sound-status.on {
  background: rgba(16, 185, 129, 0.12);
  color: var(--accent-green);
}

.task-sound-status.off {
  background: rgba(148, 163, 184, 0.12);
  color: var(--text-muted);
}

.task-sound-status.saving {
  background: rgba(139, 92, 246, 0.12);
  color: var(--accent-purple);
}

.task-sound-status.error {
  background: rgba(249, 115, 22, 0.12);
  color: var(--accent-orange);
}

.task-sound-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.task-sound-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.task-sound-input {
  width: 100%;
  padding: 8px 10px;
  font-size: 11px;
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 6px;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.task-sound-input:focus {
  border-color: rgba(139, 92, 246, 0.5);
  box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.1);
}

.task-sound-note {
  font-size: 10px;
  color: var(--text-muted);
}

.task-sound-actions {
  display: flex;
  gap: 8px;
}

.task-sound-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 6px 10px;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.6);
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.task-sound-btn:hover {
  background: rgba(255, 255, 255, 0.85);
  border-color: rgba(148, 163, 184, 0.28);
  color: var(--text-primary);
}

.task-sound-btn.secondary {
  background: transparent;
  border-color: rgba(148, 163, 184, 0.12);
  color: var(--text-muted);
}

.task-sound-btn.secondary:hover {
  background: rgba(139, 92, 246, 0.08);
  border-color: rgba(139, 92, 246, 0.2);
  color: var(--accent-purple);
}

.task-sound-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.compact-setting-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.compact-setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.compact-setting-label {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  min-width: 0;
}

.compact-setting-label-text {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-primary);
}

.compact-setting-label-desc {
  font-size: 10px;
  color: var(--text-muted);
}

.compact-setting-select {
  min-width: 100px;
  padding: 6px 10px;
  font-size: 11px;
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 6px;
  outline: none;
  cursor: pointer;
  transition: border-color 0.15s ease;
}

.compact-setting-select:hover {
  border-color: rgba(148, 163, 184, 0.35);
}

.compact-setting-select:focus {
  border-color: rgba(139, 92, 246, 0.5);
  box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.1);
}

.compact-setting-input {
  width: 70px;
  padding: 6px 10px;
  font-size: 11px;
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 6px;
  outline: none;
  text-align: center;
  transition: border-color 0.15s ease;
}

.compact-setting-input:hover {
  border-color: rgba(148, 163, 184, 0.35);
}

.compact-setting-input:focus {
  border-color: rgba(139, 92, 246, 0.5);
  box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.1);
}

.compact-settings-divider {
  height: 1px;
  background: rgba(148, 163, 184, 0.12);
  margin: 4px 0;
}

.compact-settings-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px 0;
  transition: color 0.15s ease;
}

.compact-settings-toggle:hover {
  color: var(--text-secondary);
}

.compact-settings-toggle svg {
  width: 12px;
  height: 12px;
  transition: transform 0.2s ease;
}

.compact-settings-toggle.expanded svg {
  transform: rotate(90deg);
}

.compact-settings-advanced {
  display: none;
  flex-direction: column;
  gap: 10px;
  padding-top: 8px;
}

.compact-settings-advanced.show {
  display: flex;
}

.compact-settings-status {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  font-size: 10px;
  color: var(--text-muted);
  background: rgba(16, 185, 129, 0.08);
  border-radius: 6px;
}

.compact-settings-status.saving {
  background: rgba(139, 92, 246, 0.08);
  color: var(--accent-purple);
}

.compact-settings-status.error {
  background: rgba(249, 115, 22, 0.08);
  color: var(--accent-orange);
}

.working-memory-cards {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.wm-empty-state {
  border-radius: 16px;
  padding: 24px 16px;
  background: rgba(255, 255, 255, 0.4);
  border: 1px dashed rgba(148, 163, 184, 0.25);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 10px;
}

.wm-empty-icon {
  color: rgba(148, 163, 184, 0.5);
  margin-bottom: 4px;
}

.wm-empty-title {
  font-size: 12px;
  font-weight: 700;
  color: rgba(15, 23, 42, 0.6);
}

.wm-empty-desc {
  font-size: 11px;
  color: rgba(30, 41, 59, 0.45);
  max-width: 180px;
  line-height: 1.4;
}

.wm-card {
  border-radius: 14px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.65);
  border: 1px solid rgba(148, 163, 184, 0.15);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.wm-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.06);
}

.wm-card[data-section="facts"] { border-left: 3px solid rgba(59, 130, 246, 0.4); }
.wm-card[data-section="decisions"] { border-left: 3px solid rgba(249, 115, 22, 0.4); }
.wm-card[data-section="todos"] { border-left: 3px solid rgba(16, 185, 129, 0.4); }
.wm-card[data-section="style"] { border-left: 3px solid rgba(139, 92, 246, 0.4); }

.wm-card-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.wm-card-title span {
  font-size: 11px;
  font-weight: 700;
  color: rgba(15, 23, 42, 0.7);
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.wm-add-btn {
  margin-left: auto;
  border: none;
  background: transparent;
  color: rgba(59, 130, 246, 0.8);
  font-size: 10px;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: 6px;
  cursor: pointer;
  transition: var(--transition);
}

.wm-add-btn:hover {
  background: rgba(59, 130, 246, 0.1);
}

.wm-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.wm-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.5);
  border: 1px solid rgba(148, 163, 184, 0.1);
  transition: background 0.15s ease;
}

.wm-item:hover {
  background: rgba(255, 255, 255, 0.85);
}

.wm-text {
  flex: 1;
  font-size: 12px;
  color: rgba(15, 23, 42, 0.85);
  line-height: 1.5;
  white-space: pre-wrap;
}

.wm-text[contenteditable="true"] {
  outline: none;
  box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.3);
  border-radius: 6px;
  padding: 4px 6px;
  background: white;
}

.wm-actions {
  display: flex;
  gap: 4px;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.wm-item:hover .wm-actions {
  opacity: 1;
}

.wm-action-btn {
  width: 20px;
  height: 20px;
  border-radius: 6px;
  border: none;
  background: transparent;
  color: rgba(148, 163, 184, 0.8);
  cursor: pointer;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.wm-action-btn:hover {
  background: rgba(0, 0, 0, 0.05);
  color: var(--text-primary);
}

.memory-files {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* ---------------------------------------------------- */
/* Long-term Memory 文件列表样式优化 (统一风格) */
/* ---------------------------------------------------- */

.mem-file {
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.5); /* 半透明磨砂 */
  border: 1px solid rgba(148, 163, 184, 0.15);
  overflow: hidden;
  transition: all 0.2s ease;
}

.mem-file:hover {
  background: rgba(255, 255, 255, 0.7);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.04);
  transform: translateY(-1px);
}

.mem-file-header {
  padding: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  cursor: pointer;
  background: transparent;
}

.mem-file-title {
  font-size: 12px;
  font-weight: 700;
  color: rgba(15, 23, 42, 0.8);
  margin-bottom: 2px;
}

.mem-file-desc {
  font-size: 10px;
  color: rgba(30, 41, 59, 0.5);
}

.mem-file.open {
  background: rgba(255, 255, 255, 0.85);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08);
  border-color: rgba(139, 92, 246, 0.2); /* 展开时带一点紫色边框 */
}

.mem-file.open .mem-file-body {
  display: block;
}

.mem-file-body {
  padding: 0 12px 12px 12px;
  border-top: none;
  display: none;
  animation: slide-down 0.2s ease-out;
}

@keyframes slide-down {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

.mem-editor {
  width: 100%;
  min-height: 120px;
  padding: 10px;
  font-size: 12px;
  line-height: 1.5;
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.6);
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 8px;
  outline: none;
  transition: border-color 0.2s;
  font-family: 'JetBrains Mono', monospace; /* 代码风格字体 */
}

.mem-editor:focus {
  background: #fff;
  border-color: var(--accent-purple);
  box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.15);
}

.mem-actions {
  margin-top: 8px;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.mem-save-btn {
  border: 1px solid rgba(139, 92, 246, 0.25);
  background: rgba(139, 92, 246, 0.12);
  color: rgba(91, 33, 182, 0.9);
  font-size: 11px;
  padding: 7px 10px;
  border-radius: 10px;
  cursor: pointer;
  transition: var(--transition);
}

.mem-save-btn:hover {
  background: rgba(139, 92, 246, 0.18);
}

/* 欢迎卡片 */
.chat-welcome {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 28px 24px;
  margin: 40px auto 0;
  max-width: 560px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(14px) saturate(180%);
  -webkit-backdrop-filter: blur(14px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.55);
  box-shadow: var(--shadow-md);
}

.welcome-card {
  width: 100%;
  max-width: 520px;
  margin: 0 auto;
}

.welcome-logo,
.welcome-icon {
  color: rgb(var(--primary-glow-rgb));
  margin-bottom: 14px;
  opacity: 0.9;
}

.chat-welcome h2,
.welcome-title {
  font-size: 20px;
  font-weight: 800;
  margin: 0 0 8px 0;
  line-height: 1.25;
  background: var(--primary-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.chat-welcome p,
.welcome-hint {
  font-size: 13px;
  color: var(--text-secondary);
  margin: 0;
}

/* ========================================
   消息样式
   ======================================== */

.message {
  display: flex;
  gap: 16px;
  width: 100%;
  max-width: 800px;
  margin: 0 auto;
  opacity: 0;
  transform: translateY(20px);
  animation: slide-in-up 0.4s var(--ease-out) forwards;
}

.message.compacted {
  opacity: 0.22 !important;
  filter: blur(0.3px) saturate(0.9);
  transform: translateY(0) scale(0.985);
  transition: opacity 0.4s ease, filter 0.4s ease, transform 0.4s ease;
}

@keyframes slide-in-up {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.message-user {
  justify-content: flex-end;
}

.message-system {
  justify-content: center;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
}

.message-model-switch {
  justify-content: center;
  padding: 8px 0;
}

.message-context-switch {
  justify-content: center;
  padding: 10px 0;
}

.baton-pass-card {
  width: min(520px, 92%);
  border-radius: 16px;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.65);
  border: 1px solid rgba(148, 163, 184, 0.2);
  backdrop-filter: blur(16px) saturate(180%);
  -webkit-backdrop-filter: blur(16px) saturate(180%);
  box-shadow: 
    0 20px 25px -5px rgba(0, 0, 0, 0.08), 
    0 8px 10px -6px rgba(0, 0, 0, 0.05),
    inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

.baton-pass-top {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 44px;
}

.baton-model {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.5);
}

.baton-model svg {
  width: 18px;
  height: 18px;
}

.baton-from {
  opacity: 0.6;
  filter: grayscale(0.4) saturate(0.8);
}

.baton-flow {
  flex: 1;
  height: 6px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.12);
  position: relative;
  overflow: hidden;
}

.baton-flow-bar {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0) 0%,
    rgba(var(--primary-glow-rgb), 0.4) 20%,
    rgba(var(--primary-glow-rgb), 0.9) 50%,
    rgba(var(--primary-glow-rgb), 0.4) 80%,
    rgba(255, 255, 255, 0) 100%
  );
  transform: translateX(-100%);
  animation: baton-flow 1.2s cubic-bezier(0.4, 0, 0.2, 1) infinite;
  width: 60%;
}

@keyframes baton-flow {
  0% { left: 0; transform: translateX(-150%); }
  100% { left: 100%; transform: translateX(50%); }
}

.baton-pass-text {
  margin-top: 8px;
  font-size: 11px;
  color: rgba(30, 41, 59, 0.65);
  text-align: center;
  font-weight: 500;
}

.baton-pass-tags {
  margin-top: 8px;
  display: flex;
  justify-content: center;
  gap: 6px;
  flex-wrap: wrap;
}

.baton-tag {
  display: inline-flex;
  align-items: center;
  height: 20px;
  padding: 0 8px;
  border-radius: 6px;
  font-size: 10px;
  font-weight: 600;
  color: rgba(30, 41, 59, 0.75);
  background: rgba(255, 255, 255, 0.6);
  border: 1px solid rgba(148, 163, 184, 0.2);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
}

/* Baton Pass 淡出动画 */
.baton-pass-fade-out {
  animation: batonPassFadeOut 0.4s ease-out forwards;
}

@keyframes batonPassFadeOut {
  0% {
    opacity: 1;
    transform: translateY(0);
  }
  100% {
    opacity: 0;
    transform: translateY(-8px);
  }
}

/* 头像 */
.message-avatar {
  flex-shrink: 0;
}

.avatar-icon {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-color);
  overflow: visible;
  background: var(--bg-secondary);
  color: var(--text-deep-theme, #1a1a2e);
}

.avatar-icon.user { background: #e2e8f0; color: #64748b; }

/* 金球跳动：用于 AI 思考状态 */
@keyframes orb-bounce {
  0%, 100% {
    transform: translateY(0) scale(1);
    filter: drop-shadow(0 0 0 transparent);
  }
  40% {
    transform: translateY(-3px) scale(1.1);
    filter: drop-shadow(0 0 6px rgba(255, 215, 0, 0.6));
  }
  60% {
    transform: translateY(-1px) scale(1.05);
  }
}

.message-ai.ai-thinking .logo-orb {
  animation: orb-bounce 1.2s ease-in-out infinite;
  transform-box: fill-box;
  transform-origin: center;
  will-change: transform, filter;
}

/* 消息内容 */
.message-content {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-width: min(85%, 520px);
  flex: 1;
  min-width: 0;
}

.message-ai .message-content {
  max-width: min(92%, 760px);
}

.message-user .message-content {
  align-items: flex-end;
}

.message-sender {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  opacity: 0.6;
}

.message-actions {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 2px;
  opacity: 0;
  transform: translateY(-2px);
  pointer-events: none;
  transition: opacity 0.16s ease, transform 0.16s ease;
}

.message:hover .message-actions,
.message:focus-within .message-actions,
.message .message-actions.actions-last,
.message .message-actions.actions-memorized {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.message-action-btn.pin-btn {
  background: transparent;
  border-color: transparent;
  color: rgba(124, 58, 237, 0.92);
}

.message-action-btn.pin-btn:hover {
  background: rgba(255, 255, 255, 0.98);
  border-color: rgba(226, 232, 240, 0.9);
}

.message-action-btn.memory-btn {
  color: rgba(100, 116, 139, 0.82);
  position: relative;
  overflow: visible;
}

.message-action-btn.memory-btn:hover {
  color: rgba(124, 58, 237, 0.92);
}

.message-action-btn.memory-btn .memory-icon .brain-shell {
  fill: transparent;
  transition: fill 0.35s ease, stroke-width 0.35s ease, color 0.35s ease;
}

.message-action-btn.memory-btn .memory-icon .brain-detail {
  opacity: 0.76;
  transition: opacity 0.35s ease, stroke-width 0.35s ease;
}

.message-action-btn.memory-btn.memory-writing {
  animation: memory-absorb-press 0.72s cubic-bezier(0.22, 1, 0.36, 1) 1;
}

.message-action-btn.memory-btn.memory-writing .memory-icon {
  animation: memory-absorb-pulse 0.72s ease-out 1;
}

.message-action-btn.memory-btn.is-memorized {
  color: rgba(124, 58, 237, 0.96);
}

.message-action-btn.memory-btn.is-memorized .memory-icon .brain-shell {
  fill: rgba(139, 92, 246, 0.16);
  stroke-width: 2.2;
}

.message-action-btn.memory-btn.is-memorized .memory-icon .brain-detail {
  stroke-width: 2;
  opacity: 0.92;
}

.message-action-btn.memory-btn.memory-just-saved::after {
  content: "✓";
  position: absolute;
  top: -3px;
  right: -3px;
  width: 12px;
  height: 12px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  font-weight: 700;
  line-height: 1;
  color: rgba(255, 255, 255, 0.98);
  background: rgba(124, 58, 237, 0.96);
  border: 1px solid rgba(255, 255, 255, 0.95);
  box-shadow: 0 4px 12px rgba(124, 58, 237, 0.3);
  animation: memory-check-pop 0.9s ease-out 1 forwards;
}

@keyframes memory-absorb-press {
  0% {
    transform: scale(1);
  }
  20% {
    transform: scale(0.9);
  }
  56% {
    transform: scale(1.07);
  }
  100% {
    transform: scale(1);
  }
}

@keyframes memory-absorb-pulse {
  0% {
    opacity: 0.82;
    filter: none;
  }
  42% {
    opacity: 1;
    filter: drop-shadow(0 0 7px rgba(124, 58, 237, 0.52));
  }
  100% {
    opacity: 1;
    filter: none;
  }
}

@keyframes memory-check-pop {
  0% {
    opacity: 0;
    transform: scale(0.4) translateY(3px);
  }
  35% {
    opacity: 1;
    transform: scale(1.08) translateY(0);
  }
  100% {
    opacity: 0;
    transform: scale(0.82) translateY(-3px);
  }
}

.pin-popover {
  position: fixed;
  z-index: 10000;
  width: min(360px, calc(100vw - 24px));
  border-radius: 14px;
  background: rgba(15, 23, 42, 0.58);
  border: 1px solid rgba(148, 163, 184, 0.18);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  box-shadow: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
  padding: 10px 10px;
  color: rgba(226, 232, 240, 0.92);
}

.pin-fly {
  position: fixed;
  z-index: 10001;
  transform: translate(-50%, -50%) scale(1);
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 650;
  color: rgba(226, 232, 240, 0.92);
  background: rgba(139, 92, 246, 0.26);
  border: 1px solid rgba(139, 92, 246, 0.34);
  backdrop-filter: blur(12px) saturate(160%);
  -webkit-backdrop-filter: blur(12px) saturate(160%);
  box-shadow: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
  pointer-events: none;
  white-space: nowrap;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  opacity: 0.95;
  transition:
    left 0.55s cubic-bezier(0.22, 1, 0.36, 1),
    top 0.55s cubic-bezier(0.22, 1, 0.36, 1),
    transform 0.55s cubic-bezier(0.22, 1, 0.36, 1),
    opacity 0.55s ease;
}

.pin-fly.flying {
  transform: translate(-50%, -50%) scale(0.12);
  opacity: 0.18;
}

.pin-popover-title {
  font-size: 12px;
  font-weight: 800;
  color: rgba(226, 232, 240, 0.92);
}

.pin-popover-sub {
  margin-top: 2px;
  font-size: 10px;
  color: rgba(226, 232, 240, 0.72);
}

.pin-popover-row {
  margin-top: 10px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.pin-pill {
  border: 1px solid rgba(148, 163, 184, 0.18);
  background: rgba(255, 255, 255, 0.08);
  color: rgba(226, 232, 240, 0.86);
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 11px;
  cursor: pointer;
  transition: var(--transition);
}

.pin-pill.active {
  border-color: rgba(139, 92, 246, 0.3);
  background: rgba(139, 92, 246, 0.16);
}

.pin-editor {
  margin-top: 10px;
  width: 100%;
  min-height: 84px;
  border-radius: 12px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  background: rgba(255, 255, 255, 0.08);
  color: rgba(226, 232, 240, 0.9);
  padding: 10px 10px;
  font-size: 12px;
  outline: none;
  resize: vertical;
}

.pin-actions {
  margin-top: 10px;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.pin-btn-secondary,
.pin-btn-primary {
  border-radius: 10px;
  padding: 7px 10px;
  font-size: 11px;
  cursor: pointer;
  transition: var(--transition);
  border: 1px solid rgba(148, 163, 184, 0.18);
}

.pin-btn-secondary {
  background: rgba(255, 255, 255, 0.08);
  color: rgba(226, 232, 240, 0.86);
}

.pin-btn-primary {
  background: rgba(139, 92, 246, 0.18);
  border-color: rgba(139, 92, 246, 0.28);
  color: rgba(226, 232, 240, 0.92);
}

.pin-btn-primary:hover {
  background: rgba(139, 92, 246, 0.24);
}

.message-user .message-actions {
  justify-content: flex-end;
}

.message-action-btn {
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-secondary);
  padding: 0;
  border-radius: 999px;
  cursor: pointer;
  transition: var(--transition);
}

.message-action-btn svg {
  width: 15px;
  height: 15px;
  pointer-events: none;
}

.message-action-btn:hover {
  background: rgba(255, 255, 255, 0.98);
  border-color: rgba(226, 232, 240, 0.9);
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}

.message-action-btn:focus-visible {
  background: rgba(255, 255, 255, 0.98);
  border-color: rgba(226, 232, 240, 0.9);
  outline: 2px solid rgba(59, 130, 246, 0.35);
  outline-offset: 1px;
}

.message-action-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.message-action-btn.primary {
  background: transparent;
  border-color: transparent;
  color: var(--accent-blue);
}

.message-action-btn.primary:hover {
  background: rgba(255, 255, 255, 0.98);
  border-color: rgba(226, 232, 240, 0.9);
}

/* 消息气泡 */
.message-bubble {
  padding: 12px 18px;
  border-radius: 18px;
  font-size: 15px;
  line-height: 1.6;
  box-shadow: var(--shadow-sm);
  white-space: pre-wrap;
  word-break: break-word;
  width: fit-content;
  max-width: 100%;
  position: relative;
}

.message-ai .message-bubble {
  /* 沉浸式文档助手：AI 回复去气泡化，内容融入背景 */
  background: transparent;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  color: var(--text-secondary);
  border: none;
  border-radius: 0;
  box-shadow: none;
  padding: 2px 2px;
  width: 100%;
}

.message-ai .message-bubble:hover {
  background: transparent;
  box-shadow: none;
}

/* ==========================================================================
   User Message Bubble Themes
   Theme A: Aurora Crystal (Default) - Ultra transparent, high blur (25px)
   Theme B: Classic White - High opacity (80%), medium blur (12px)
   ========================================================================== */

/* Shared Base */
.message-user .message-bubble {
  color: var(--text-deep-theme);
  
  /* Refined Border: Subtle theme-colored reflection */
  border: 1px solid rgba(var(--primary-glow-rgb), 0.2); 
  border-bottom-right-radius: 4px;
  
  /* Critical: Stronger Colored shadow (0.1 -> 0.15) for the "floating" effect */
  box-shadow: 0 4px 14px 0 rgba(var(--primary-glow-rgb), 0.15);
  
  font-weight: 500;
  transition: all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1); /* Smooth Morphing */
}

/* Theme: Aurora (Default) - The "Frozen White Mist" */
body:not([data-bubble-theme="white"]) .message-user .message-bubble {
  /* Restore: Ultra transparent base */
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.03) 0%, rgba(var(--primary-glow-rgb), 0.05) 100%);
  backdrop-filter: blur(25px);
  -webkit-backdrop-filter: blur(25px);
  /* Remove the muddy filter I added */
  filter: none;
}

body:not([data-bubble-theme="white"]) .message-user .message-bubble:hover {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.08) 0%, rgba(var(--primary-glow-rgb), 0.1) 100%);
  filter: none;
}

/* Theme: Classic White - The "Opaque Porcelain" */
body[data-bubble-theme="white"] .message-user .message-bubble {
  /* Restore: Clean white base */
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  filter: none;
}

body[data-bubble-theme="white"] .message-user .message-bubble:hover {
  background: rgba(255, 255, 255, 0.9);
  filter: none;
}

/* Submerged State: Subtle effect that preserves the aurora/glass aesthetic */
/* Aurora Theme: Enhance glow while keeping transparency */
body:not([data-bubble-theme="white"]) .message-user .message-bubble.submerged {
  /* No background change - rely on optical interference */
  color: var(--text-deep-theme); 
  border-color: rgba(var(--primary-glow-rgb), 0.6); /* Even Stronger border */
  box-shadow:
    0 4px 20px rgba(var(--primary-glow-rgb), 0.35), /* Deeper shadow glow */
    inset 0 1px 2px rgba(255, 255, 255, 0.25);
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
  filter: none;
}

/* White Theme: Slightly increase opacity when submerged for readability */
body[data-bubble-theme="white"] .message-user .message-bubble.submerged {
  /* No background change */
  color: var(--text-deep-theme);
  border-color: rgba(var(--primary-glow-rgb), 0.5); /* Stronger border */
  box-shadow:
    0 4px 18px rgba(var(--primary-glow-rgb), 0.25), /* Deeper shadow glow */
    inset 0 1px 2px rgba(255, 255, 255, 0.3);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  filter: none;
}

/* ========================================
   方案 C: Cinematic Streaming (电影级流式排版)
   ======================================== */

/* 流动式文字出现效果 - 从模糊到清晰，配合物理弹簧曲线 */
.blur-in-char {
  display: inline-block;
  opacity: 0;
  filter: blur(8px);
  transform: translateY(6px) scale(0.96); 
  /* 物理曲线优化：弹入感 (Spring-in) */
  animation: blur-reveal 0.6s cubic-bezier(0.18, 0.89, 0.32, 1.28) forwards;
  animation-delay: var(--wave-delay, 0ms);
  transform-origin: bottom center;
  will-change: transform, opacity, filter;
}

@keyframes blur-reveal {
  0% {
    opacity: 0;
    filter: blur(8px);
    transform: translateY(6px) scale(0.96);
  }
  60% {
    opacity: 0.8;
    filter: blur(2px);
  }
  100% {
    opacity: 1;
    filter: blur(0);
    transform: translateY(0) scale(1);
  }
}

/* 移除旧的属性选择器写法，直接在上面处理了 */

/* 光标效果 (Active Breathing Caret) */
.typing-cursor::after {
  content: '';
  display: inline-block;
  width: 3px;
  height: 1.3em;
  background: var(--accent-blue);
  margin-left: 3px;
  border-radius: 4px;
  box-shadow: 0 0 8px rgba(var(--primary-glow-rgb), 0.6);
  animation: blink-breathe 1s infinite ease-in-out;
  vertical-align: text-bottom;
  position: relative;
  top: 2px;
}

@keyframes blink-breathe {
  0%, 100% { opacity: 1; transform: scaleY(1); }
  50% { opacity: 0.4; transform: scaleY(0.85); }
}

/* 方案 B: 发送 -> 飞入（Morphing） */
.morphing-bubble {
  position: fixed;
  z-index: 2000;
  pointer-events: none;
  background: var(--primary-gradient);
  color: #fff;
  border-radius: 18px;
  padding: 12px 18px;
  box-shadow: var(--shadow-float), 0 4px 15px rgba(var(--primary-glow-rgb), 0.28);
  font-weight: 500;
  white-space: pre-wrap;
  overflow: hidden;
}

/* 系统消息 */
.system-divider {
  height: 1px;
  width: 32px;
  background: var(--border-color);
}

.system-text {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
}

/* 模型切换消息 */
.model-switch-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 6px 12px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  color: var(--text-secondary);
}

/* 模型切换消息颜色 */
.model-switch-badge.text-blue {
  color: #3b82f6;
  background: rgba(59, 130, 246, 0.1);
  border-color: rgba(59, 130, 246, 0.2);
}

.model-switch-badge.text-green {
  color: #10b981;
  background: rgba(16, 185, 129, 0.1);
  border-color: rgba(16, 185, 129, 0.2);
}

.model-switch-badge.text-orange {
  color: #f97316;
  background: rgba(249, 115, 22, 0.1);
  border-color: rgba(249, 115, 22, 0.2);
}

.model-switch-badge.text-purple {
  color: #8b5cf6;
  background: rgba(139, 92, 246, 0.1);
  border-color: rgba(139, 92, 246, 0.2);
}

/* 旧版消息兼容 */
.msg {
  padding: 14px 18px;
  border-radius: var(--radius-xl);
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.7;
  font-size: 15px;
  max-width: min(85%, 520px);
  animation: fade-in 0.3s ease-out;
  box-shadow: var(--shadow-sm);
}

.msg.user {
  align-self: flex-end;
  background: var(--accent-blue);
  color: white;
  border-top-right-radius: 4px;
}

.msg.assistant {
  align-self: flex-start;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  border-top-left-radius: 4px;
}

.msg.meta {
  align-self: center;
  background: transparent;
  color: var(--text-muted);
  font-size: 12px;
  padding: 6px 12px;
  border: 1px dashed var(--border-color);
  border-radius: var(--radius-sm);
  box-shadow: none;
}

.msg.loading {
  display: flex;
  align-items: center;
  gap: 8px;
}

.msg.loading::before {
  content: '';
  width: 8px;
  height: 8px;
  background: var(--accent-blue);
  border-radius: 50%;
  animation: pulse 1s infinite;
}

/* ========================================
   Diff 卡片
   ======================================== */

.diff-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  margin-top: 8px;
  ring: 4px solid var(--bg-tertiary);
}

.diff-header {
  padding: 10px 16px;
  background: var(--bg-tertiary);
  border-bottom: 1px solid var(--border-color);
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.diff-body {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.diff-section {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.diff-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
}

.diff-label-new {
  color: #16a34a;
}

.diff-original {
  font-size: 14px;
  color: var(--text-muted);
  text-decoration: line-through;
  text-decoration-color: #f87171;
  text-decoration-thickness: 2px;
}

.diff-suggestion {
  font-size: 14px;
  color: var(--text-primary);
  font-weight: 500;
  background: rgba(34, 197, 94, 0.08);
  padding: 10px 12px;
  margin: -4px -4px 0;
  border-radius: var(--radius-md);
  border: 1px solid rgba(34, 197, 94, 0.2);
}

.diff-actions {
  display: flex;
  border-top: 1px solid var(--border-color);
}

.diff-btn {
  flex: 1;
  padding: 12px;
  font-size: 12px;
  font-weight: 700;
  background: transparent;
  border: none;
  cursor: pointer;
  transition: var(--transition);
}

.diff-btn-cancel {
  color: var(--text-muted);
  border-right: 1px solid var(--border-color);
}

.diff-btn-cancel:hover {
  background: var(--bg-tertiary);
}

.diff-btn-accept {
  color: var(--accent-blue);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.diff-btn-accept:hover {
  background: rgba(59, 130, 246, 0.08);
}

/* ========================================
   插入卡片
   ======================================== */

.insert-card {
  background: var(--bg-secondary);
  border: 1px solid rgba(59, 130, 246, 0.3);
  border-radius: var(--radius-xl);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  margin-top: 8px;
}

.insert-content {
  padding: 16px;
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.6;
}

.insert-btn {
  width: 100%;
  padding: 12px;
  background: rgba(59, 130, 246, 0.08);
  color: var(--accent-blue);
  font-size: 12px;
  font-weight: 700;
  border: none;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.insert-btn:hover {
  background: rgba(59, 130, 246, 0.15);
}

/* ========================================
   打字动画
   ======================================== */

.typing-indicator {
  display: flex;
  gap: 6px;
  padding: 8px 0;
  width: 100%;
  max-width: 800px;
  margin: 0 auto;
  padding-left: 48px;
}

.typing-dot {
  width: 8px;
  height: 8px;
  background: var(--text-muted);
  border-radius: var(--radius-full);
  animation: typing-bounce 1.4s infinite ease-in-out;
}

.typing-dot:nth-child(1) { animation-delay: 0s; }
.typing-dot:nth-child(2) { animation-delay: 0.15s; }
.typing-dot:nth-child(3) { animation-delay: 0.3s; }

@keyframes typing-bounce {
  0%, 60%, 100% { transform: translateY(0); }
  30% { transform: translateY(-6px); }
}

@keyframes fade-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes pulse {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 1; }
}

/* ========================================
   Loading Indicators (Enhanced)
   ======================================== */

/* Thinking 指示器（对标 ChatGPT 思考动画） */
.loading-thinking {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
}

.thinking-orb {
  position: relative;
  width: 24px;
  height: 24px;
}

.thinking-ring {
  position: absolute;
  inset: 0;
  border: 2px solid transparent;
  border-top-color: var(--accent-purple, #c084fc);
  border-radius: 50%;
  animation: thinking-spin 1s linear infinite;
}

.thinking-core {
  position: absolute;
  inset: 6px;
  background: var(--accent-purple, #c084fc);
  border-radius: 50%;
  animation: thinking-pulse 1.5s ease-in-out infinite;
}

.thinking-text {
  font-size: 13px;
  color: var(--text-secondary);
  animation: thinking-fade 2s ease-in-out infinite;
}

@keyframes thinking-spin {
  to { transform: rotate(360deg); }
}

@keyframes thinking-pulse {
  0%, 100% { opacity: 0.4; transform: scale(0.8); }
  50% { opacity: 1; transform: scale(1); }
}

@keyframes thinking-fade {
  0%, 100% { opacity: 0.6; }
  50% { opacity: 1; }
}

/* 进度条加载指示器 */
.loading-progress {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px 16px;
  width: 100%;
}

.progress-bar {
  height: 4px;
  background: var(--bg-tertiary, #f3f4f6);
  border-radius: 2px;
  overflow: hidden;
  position: relative;
}

.progress-bar::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: var(--progress, 0%);
  background: var(--accent-purple, #c084fc);
  border-radius: 2px;
  transition: width 0.3s ease;
}

.progress-text {
  font-size: 12px;
  color: var(--text-muted);
}

/* 骨架屏 */
.loading-skeleton {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
}

.skeleton-line {
  height: 12px;
  border-radius: 4px;
  background: linear-gradient(
    90deg,
    var(--bg-tertiary, #f3f4f6) 25%,
    var(--bg-secondary, #f9fafb) 50%,
    var(--bg-tertiary, #f3f4f6) 75%
  );
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.5s infinite;
}

.skeleton-line-long { width: 100%; }
.skeleton-line-medium { width: 75%; }
.skeleton-line-short { width: 50%; }

@keyframes skeleton-shimmer {
  from { background-position: 200% 0; }
  to { background-position: -200% 0; }
}

/* 脉冲点加载指示器 */
.loading-pulse-dots {
  display: flex;
  gap: 4px;
  align-items: center;
  padding: 8px 0;
}

.pulse-dot {
  width: 6px;
  height: 6px;
  background: var(--accent-purple, #c084fc);
  border-radius: 50%;
  animation: pulse-dot-bounce 1.4s infinite ease-in-out;
}

.pulse-dot:nth-child(1) { animation-delay: -0.32s; }
.pulse-dot:nth-child(2) { animation-delay: -0.16s; }
.pulse-dot:nth-child(3) { animation-delay: 0s; }

@keyframes pulse-dot-bounce {
  0%, 80%, 100% {
    transform: scale(0.6);
    opacity: 0.5;
  }
  40% {
    transform: scale(1);
    opacity: 1;
  }
}

/* ========================================
   输入区域 (Morphing & Island)
   ======================================== */

.composer {
  padding: 0;
  background: transparent;
  border-top: none;
  flex-shrink: 0;
}

.composer-container {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  width: calc(100% - 40px);
  max-width: 700px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
  /* 初始入场动画 */
  animation: composer-float-in 0.8s var(--ease-elastic) backwards;
  animation-delay: 0.2s;
  transition:
    transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1),
    opacity 0.3s ease,
    left 0.28s ease,
    width 0.28s ease;
}

/* ========================================
   Composer Handle (把手) - Top-tier Aesthetics (Jade / Breathing Light)
   ======================================== */

.composer-handle {
  position: absolute;
  top: 50%;
  right: -12px;
  transform: translateY(-50%) translateY(-21px); /* 再次上移 3px */
  width: 24px; /* 增大热区，便于抓取 */
  height: 64px;
  z-index: 10;
  cursor: grab;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s ease, right 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  display: flex;
  align-items: center;
  justify-content: center;
}

#app.cortex-open .composer-handle,
#app.composer-docked .composer-handle {
  opacity: 1;
  pointer-events: auto;
  right: 11px; /* 向左缩 5px */
  box-shadow: none; /* 移除容器阴影，拒绝“穿帮”矩形框，只保留内部晶体 */
  z-index: 20; /* 确保浮在输入框上方 */
}

@media (min-width: 960px) {
  #app.cortex-open .composer-handle {
    opacity: 0;
    pointer-events: none;
  }
}

.handle-luminescence {
  /* 基础形状 */
  width: 1.8px;
  height: 38.4px;
  border-radius: 99px;

  /* 1. 平时状态：陶瓷质感，低调融合 */
  background: rgba(255, 255, 255, 0.4); /* 晶体质感：高透白 */
  box-shadow: 
    inset 0 0 0 0.5px rgba(255, 255, 255, 0.8), /* 锐利边缘 */
    0 1px 3px rgba(0, 0, 0, 0.05); /* 极其微弱的投影，增加实体感 */
  backdrop-filter: blur(2px); /* 微弱的折射感 */
  -webkit-backdrop-filter: blur(2px);

  /* 2. 动画曲线：物理阻尼 (Spring) */
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
  transform: translateX(5px) translateY(-10px); /* 向上再次移动 5px */
}

/* 移除旧版内部发光芯 (Core)，新版靠整体材质 */
.handle-luminescence::after {
  content: none;
}

/* Hover 状态：注入灵魂 (Glow & Expand) */
.composer-handle:hover .handle-luminescence {
  /* 变大尺寸 */
  width: 3.2px; /* 变窄 */
  height: 44.8px; /* 变短 */

  /* 3. 激活颜色：带光感的玉石 */
    background: #ffffff; /* 白热内核：真正的激光中心是白色的 */
    box-shadow: 
      0 0 4px 1px rgb(var(--primary-glow-rgb)), /* 第一层：紧贴的高能光圈 */
      0 0 12px 2px rgba(var(--primary-glow-rgb), 0.8), /* 第二层：主辉光 */
      0 0 25px rgba(var(--primary-glow-rgb), 0.5), /* 第三层：环境散射 */
      inset 0 0 2px rgba(var(--primary-glow-rgb), 0.5); /* 内部：色彩渗透 */}

/* Active 状态：按压反馈 (Pinch) */
.composer-handle:active .handle-luminescence {
  transform: scale(0.95);
  box-shadow: 
    0 0 5px rgba(var(--primary-glow-rgb), 0.6),
    inset 0 0 2px rgba(255, 255, 255, 0.2);
  /* 颜色加深一点点模拟受力 */
  filter: brightness(0.95);
}

/* 磁吸微动 (模拟) */
.composer-handle:hover {
  transform: translateY(-50%) translateX(2px);
}



/* 真·形态变换状态 */
.composer-container.morphing {
  /* 飞出效果：向上位移、缩小、模糊消失 */
  transform: translateX(-50%) translateY(-100px) scale(0.4);
  opacity: 0;
  filter: blur(4px);
  pointer-events: none;
}

.composer-container.resetting {
  /* 归位前置状态：从下方淡入 */
  transform: translateX(-50%) translateY(40px) scale(0.95);
  opacity: 0;
}

/* 正常状态 (Implicit in base class) */
/* transform: translateX(-50%) translateY(0) scale(1); opacity: 1 */

@keyframes composer-float-in {
  from { transform: translateX(-50%) translateY(40px); opacity: 0; }
  to { transform: translateX(-50%) translateY(0); opacity: 1; }
}

/* 消息弹射动画 (配合输入框飞出) */
@keyframes projectile-up {
  0% { opacity: 0; transform: translateY(40px) scale(0.8); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

.animate-projectile-up {
  animation: projectile-up 0.5s cubic-bezier(0.23, 1, 0.32, 1) forwards;
}

.composer-glass-panel {
  /* Input Box Problem - Refinement: More opaque to block background noise */
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(20px) saturate(300%);
  -webkit-backdrop-filter: blur(20px) saturate(300%);
  border: 1px solid rgba(255, 255, 255, 0.6); /* Slightly more transparent border */
  border-radius: 24px;
  box-shadow: var(--shadow-float), inset 0 0 0 1px rgba(255, 255, 255, 0.4);
  padding: 6px 6px 0 6px; /* 底部留给能量槽贴合 */
  transition: all 0.3s var(--ease-out);
  overflow: hidden; /* 能量槽贴底自然裁剪出完美弧度 */
}

.composer-glass-panel:focus-within {
  background: rgba(255, 255, 255, 0.9);
  box-shadow:
    0 20px 60px -10px rgba(var(--primary-glow-rgb), 0.3),
    inset 0 0 0 1px rgba(var(--primary-glow-rgb), 0.3);
  transform: translateY(-2px);
}

.composer-glass-panel.full-doc-mode {
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.3), 0 20px 60px -10px rgba(99, 102, 241, 0.2);
  border-color: rgba(99, 102, 241, 0.4);
}

/* 输入区域：左侧控件列 + 输入框横向排列 */
.composer-input-area {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 6px 6px 6px;
}

/* 左侧控件列：scroll 按钮 + "+"按钮纵向排列 */
.composer-left-controls {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

/* 「+」按钮 */
.composer-plus-btn {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: var(--radius-full);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.composer-plus-btn:hover {
  background: rgba(var(--primary-glow-rgb), 0.1);
  color: rgb(var(--primary-glow-rgb));
  border-color: rgba(var(--primary-glow-rgb), 0.3);
}

.composer-input-wrapper {
  display: flex;
  align-items: flex-end;
  flex: 1;
  min-width: 0;
  gap: 4px;
  padding: 6px 8px;
  background: transparent;
  border: none;
  border-radius: 18px;
  box-shadow: none;
}

/* Scroll-to-bottom 按钮：默认隐藏，滚动离开底部时滑入 */
.scroll-status-btn {
  width: 28px;
  height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  color: var(--accent-blue);
  border: 1px solid rgba(59, 130, 246, 0.2);
  border-radius: var(--radius-full);
  cursor: pointer;
  flex-shrink: 0;
  overflow: hidden;
  opacity: 0;
  transform: scale(0.5) translateY(8px);
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  padding: 0;
}

/* 滚动离开底部：按钮出现 */
.scroll-status-btn.scrolled-up {
  height: 28px;
  opacity: 1;
  transform: scale(1) translateY(0);
  background: rgba(59, 130, 246, 0.08);
}

.scroll-status-btn.scrolled-up:hover {
  background: rgba(59, 130, 246, 0.18);
  transform: scale(1.08) translateY(0);
  border-color: rgba(59, 130, 246, 0.35);
}

.composer textarea {
  flex: 1;
  background: transparent;
  color: var(--text-primary);
  border: none;
  outline: none;
  resize: none;
  font-size: 15px;
  line-height: 1.6;
  min-height: 26px;
  max-height: 150px;
  font-family: inherit;
  width: 100%;
}

.composer textarea::placeholder {
  color: var(--text-muted);
}

/* 清空输入按钮 */
.clear-input-btn {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  color: var(--text-muted);
  border: none;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
  opacity: 0.6;
}

.clear-input-btn:hover {
  background: rgba(0, 0, 0, 0.06);
  color: var(--text-secondary);
  opacity: 1;
}

.clear-input-btn:active {
  transform: scale(0.9);
}

.clear-input-btn.hidden {
  display: none;
}

.send-btn {
  position: relative; /* 为内部 absolute 图标提供定位上下文 */
  width: 0;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--text-muted);
  color: white;
  border: none;
  border-radius: var(--radius-full);
  cursor: not-allowed;
  transition: all 0.3s var(--ease-elastic);
  flex-shrink: 0;
  opacity: 0;
  transform: scale(0.9);
  overflow: hidden;
  padding: 0;
  margin: 0;
}

.send-btn.active {
  background: var(--primary-gradient);
  color: white;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(var(--primary-glow-rgb), 0.4);
  opacity: 1;
  transform: scale(1);
  width: 36px;
  padding: 0;
}

.send-btn:disabled {
  opacity: 0.6;
}

.send-btn.active:hover {
  transform: scale(1.1);
}

.send-btn.active:active {
  transform: scale(0.95);
}

/* 发送/停止图标切换 */
.send-btn .icon-send,
.send-btn .icon-stop {
  position: absolute;
  transition: all 2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.send-btn .icon-stop {
  opacity: 0;
  transform: scale(0) rotate(-360deg) translateY(10px);
}

.send-btn .icon-send {
  opacity: 1;
  transform: translate(0, 0) scale(1);
}

/* 流式输出时：显示停止图标 */
.send-btn.streaming .icon-send {
  opacity: 0;
  /* 纸飞机向右上方飞出 */
  transform: translate(12px, -12px) scale(0.5);
}

.send-btn.streaming .icon-stop {
  opacity: 1;
  animation: icon-stop-spin 2s cubic-bezier(0.34, 1.56, 0.64, 1) 2 forwards;
}

/* 方块循环旋转动画 */
@keyframes icon-stop-spin {
  0% {
    transform: scale(0) rotate(-360deg) translateY(10px);
    opacity: 0;
  }
  50% {
    transform: scale(1) rotate(0deg) translateY(0);
    opacity: 1;
  }
  100% {
    transform: scale(1) rotate(0deg) translateY(0);
    opacity: 1;
  }
}

/* 停止按钮特殊样式 - 黑色/深灰色 */
.send-btn.streaming {
  background: var(--text-primary); /* 深色背景 #1e293b */
  color: white;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  /* 移除强烈的红色呼吸动画，改为轻微的深色呼吸或无动画 */
  animation: none;
  width: 36px;
  opacity: 1;
}

.send-btn.streaming:hover {
  background: #0f172a; /* 更深的黑色 */
  transform: scale(1.05);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

/* 输入框禁用状态 */
.composer-input-wrapper.disabled {
  opacity: 0.7;
  cursor: not-allowed;
  background: rgba(0, 0, 0, 0.02);
}

.composer-input-wrapper.disabled textarea {
  pointer-events: none;
}

/* 语音按钮（输入框内） */
.voice-btn {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  border-radius: var(--radius-full);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
  position: relative;
  user-select: none;
  -webkit-user-select: none;
  padding: 0;
}

.voice-btn:hover {
  background: rgba(var(--primary-glow-rgb), 0.08);
  color: rgb(var(--primary-glow-rgb));
}

.voice-btn.disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.voice-btn.recording {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
  animation: voice-pulse 1s ease-in-out infinite;
}

.voice-btn.recording .icon-mic-active {
  fill: #ef4444;
}

.voice-btn.processing {
  background: rgba(var(--primary-glow-rgb), 0.1);
  color: rgb(var(--primary-glow-rgb));
}

@keyframes voice-pulse {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4);
  }
  50% {
    box-shadow: 0 0 0 8px rgba(239, 68, 68, 0);
  }
}

@keyframes voice-processing-dots {
  0%, 20% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
  80%, 100% {
    opacity: 1;
  }
}

.token-counter,
.composer-counter {
  margin-left: auto;
  font-size: 11px;
  color: var(--text-muted);
  font-feature-settings: "tnum";
  font-variant-numeric: tabular-nums;
}

.composer-footer {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 12px 10px 12px;
}

.composer-hint,
.composer-status {
  font-size: 10px;
  color: var(--text-muted);
}

.composer-meta {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
}

.composer-counter {
  font-size: 10px;
  color: var(--text-muted);
}

.composer-status {
  display: flex;
  align-items: center;
  gap: 4px;
}

.composer-footer-text {
  text-align: center;
  font-size: 11.5px;
  color: var(--text-muted);
  opacity: 0.7;
}

/* Synapse Status Bar（上下文预算 + 活跃源） */
.synapse-bar {
  padding: 8px 12px 6px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.synapse-bar.hidden {
  display: none;
}

.synapse-gauge {
  height: 3px;
  width: 100%;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(148, 163, 184, 0.12);
  box-shadow: inset 0 0 0 1px rgba(148, 163, 184, 0.08);
}

.synapse-gauge-fill {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: var(--accent-blue);
  box-shadow: 0 0 10px rgba(59, 130, 246, 0.25);
  transition: width 0.25s ease, background-color 0.25s ease, box-shadow 0.25s ease;
}

.synapse-gauge-fill.warm {
  background: var(--accent-orange);
  box-shadow: 0 0 10px rgba(249, 115, 22, 0.25);
}

.synapse-gauge-fill.critical {
  background: var(--accent-purple);
  box-shadow: 0 0 12px rgba(139, 92, 246, 0.35);
}

.synapse-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.synapse-sources {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 18px;
}

.synapse-chip {
  display: inline-flex;
  align-items: center;
  height: 18px;
  padding: 0 6px;
  border-radius: 6px;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.2px;
  color: var(--text-muted);
  background: rgba(148, 163, 184, 0.06);
  border: 1px solid rgba(148, 163, 184, 0.12);
}

.synapse-metrics {
  margin-left: auto;
  font-size: 10px;
  color: var(--text-muted);
  opacity: 0.85;
  font-feature-settings: "tnum";
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* Command Palette（输入 “/” 唤起） */
.command-palette {
  position: fixed;
  z-index: 9999;
  max-width: min(640px, calc(100vw - 20px));
  bottom: 100px; /* 位于输入框上方，JS 会覆盖 */
  display: flex;
  flex-direction: column;
  gap: 0;
  border-radius: 16px;
  background: rgba(30, 41, 59, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  box-shadow:
    0 20px 40px -5px rgba(0, 0, 0, 0.4),
    0 10px 15px -5px rgba(0, 0, 0, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
  overflow: hidden;
  animation: palette-enter 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  transform-origin: bottom center;
}

@keyframes palette-enter {
  from { opacity: 0; transform: translateY(10px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.command-palette.hidden {
  display: none;
}

.command-palette-inner {
  display: flex;
  flex-direction: column;
  max-height: 320px;
}

/* 顶部 Context Budget 仪表盘 */
.command-gauge {
  background: rgba(15, 23, 42, 0.6);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex-shrink: 0;
}

.command-gauge-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.command-gauge-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(148, 163, 184, 0.8);
}

.command-gauge-value {
  font-size: 11px;
  color: rgba(226, 232, 240, 0.9);
  font-feature-settings: "tnum";
  font-family: 'JetBrains Mono', monospace;
}

.command-gauge-bar {
  height: 4px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.1);
  overflow: hidden;
}

.command-gauge-fill {
  height: 100%;
  border-radius: 2px;
  background: linear-gradient(90deg, #3b82f6, #8b5cf6);
  box-shadow: 0 0 8px rgba(139, 92, 246, 0.4);
}

/* 列表区域 */
.command-palette-list {
  overflow-y: auto;
  padding: 6px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.1) transparent;
}

.command-palette-list::-webkit-scrollbar {
  width: 4px;
}
.command-palette-list::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 4px;
}

.command-group {
  padding: 8px 10px 4px 10px;
  font-size: 10px;
  font-weight: 700;
  color: rgba(148, 163, 184, 0.5);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.command-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  margin-bottom: 2px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.1s ease;
  border: 1px solid transparent;
  color: rgba(226, 232, 240, 0.7);
}

.command-item:hover {
  background: rgba(255, 255, 255, 0.05);
  color: rgba(226, 232, 240, 0.9);
}

.command-item.active {
  background: rgba(59, 130, 246, 0.15);
  border-color: rgba(59, 130, 246, 0.3);
  color: white;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.command-title {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 13px;
  font-weight: 500;
}

.command-title-main {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.command-badge {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.command-item.active .command-badge {
  background: rgba(59, 130, 246, 0.2);
  color: #bfdbfe;
  border-color: rgba(59, 130, 246, 0.3);
}

.command-desc {
  display: none; /* 在 Raycast 风格中，描述通常在右侧或作为副标题，这里简化为 Tooltip 感觉 */
}

/* 预览/详情面板 (如果是两栏布局) */
.command-palette-preview {
  display: none; /* 简化为单栏布局，更符合 Input 附近的上下文菜单习惯 */
}

/* 上下文 Bar */
.composer-context-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  margin-bottom: 4px;
  min-height: 0;
  transition: all 0.3s ease;
  overflow: hidden;
}

.composer-context-bar:not(.hidden) {
  padding-top: 6px;
  animation: slide-down-fade 0.2s ease-out;
}

@keyframes slide-down-fade {
  from { opacity: 0; transform: translateY(-4px); max-height: 0; }
  to { opacity: 1; transform: translateY(0); max-height: 40px; }
}

.context-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 22px;
  padding: 0 8px;
  border-radius: 5px;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.2px;
  white-space: nowrap;
  animation: chip-fade-in 0.3s ease-out forwards;
  /* 默认：安静的灰色调，不抢眼 */
  background: rgba(148, 163, 184, 0.08);
  border: 1px solid rgba(148, 163, 184, 0.15);
  color: var(--text-muted);
  transition: all 0.2s ease;
  cursor: default;
}

.context-chip:hover {
  /* Hover 时高亮为品牌色 */
  background: rgba(var(--primary-glow-rgb), 0.1);
  border-color: rgba(var(--primary-glow-rgb), 0.25);
  color: rgb(var(--primary-glow-rgb));
}

.context-chip:hover svg {
  color: rgb(var(--primary-glow-rgb));
}

@keyframes chip-fade-in {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.context-chip svg {
  width: 12px;
  height: 12px;
  flex-shrink: 0;
}

/* 选区预览文字 */
.context-chip .chip-text {
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-style: italic;
  opacity: 0.9;
}

/* 关闭按钮 */
.context-chip .chip-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  margin-left: 2px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  opacity: 0.6;
  transition: all 0.15s ease;
}

.context-chip .chip-close:hover {
  background: rgba(var(--primary-glow-rgb), 0.15);
  color: rgb(var(--primary-glow-rgb));
  opacity: 1;
}

.context-chip .chip-close:active {
  transform: scale(0.9);
}

/* 选区和全文标签：默认继承基础的灰色调，Hover 时才显示品牌色 */
.context-chip.full-doc,
.context-chip.selection {
  /* 继承基础样式，不再单独设置颜色 */
}

/* 选区标签可点击：导航回文档选中位置 */
.context-chip.selection.selection-interactive {
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
}

.context-chip.selection.selection-interactive * {
  user-select: none;
  -webkit-user-select: none;
}

.context-chip.selection.selection-interactive:focus-visible {
  outline: 2px solid rgba(var(--primary-glow-rgb), 0.45);
  outline-offset: 1px;
}

.context-chip.selection.selection-readonly {
  cursor: default;
}

/* 全文模式 Hover 时用绿色 */
.context-chip.full-doc:hover {
  background: rgba(16, 185, 129, 0.1);
  border-color: rgba(16, 185, 129, 0.25);
  color: #059669;
}

.context-chip.full-doc:hover svg {
  color: #059669;
}

/* ========================================
   选区标签三模式样式
   ======================================== */

/* Mode B: no persistent highlight, inherit default chip style. */

/* Mode C: chip keeps default style; only magnet icon is highlighted. */
.context-chip.selection.mode-c .magnet-glow-icon {
  color: rgb(var(--primary-glow-rgb));
  filter: drop-shadow(0 0 3px rgba(var(--primary-glow-rgb), 0.5));
  animation: magnet-glow 2s ease-in-out infinite;
}

@keyframes magnet-glow {
  0%, 100% {
    filter: drop-shadow(0 0 2px rgba(var(--primary-glow-rgb), 0.3));
  }
  50% {
    filter: drop-shadow(0 0 6px rgba(var(--primary-glow-rgb), 0.7));
  }
}

/* 收集计数徽章 */
.chip-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 16px;
  height: 14px;
  padding: 0 3px;
  border-radius: 7px;
  background: rgb(var(--primary-glow-rgb));
  color: #fff;
  font-size: 9px;
  font-weight: 600;
  line-height: 1;
  margin-left: 2px;
}

/* Mode C 多标签布局 */
.composer-context-bar.mode-c {
  flex-wrap: wrap;
  gap: 4px 6px;
}

/* Mode C "全部清除"按钮 */
.context-chip.selection.clear-all-chip {
  opacity: 0.6;
  border-style: dashed;
}
.context-chip.selection.clear-all-chip:hover {
  opacity: 1;
}

/* ========================================
   响应式
   ======================================== */

@media (max-width: 360px) {
  .floating-toolbar button span {
    display: none;
  }

  .message-content {
    max-width: 90%;
  }

  /* 窄屏下收起上传按钮，语音按钮缩小，减少输入区拥挤 */
  #btn-tool-upload {
    display: none;
  }
  .voice-btn {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
  }
  .composer-input-area {
    gap: 4px;
  }
  .composer-left-controls {
    gap: 2px;
  }
}

/* ========================================
   加载状态
   ======================================== */

.loading-dots {
  display: inline-flex;
  gap: 4px;
}

.loading-dots span {
  width: 6px;
  height: 6px;
  background: var(--text-secondary);
  border-radius: 50%;
  animation: bounce 1.4s infinite ease-in-out both;
}

.loading-dots span:nth-child(1) { animation-delay: -0.32s; }
.loading-dots span:nth-child(2) { animation-delay: -0.16s; }

@keyframes bounce {
  0%, 80%, 100% { transform: scale(0); }
  40% { transform: scale(1); }
}

/* ========================================
   Markdown 渲染样式
   ======================================== */

.message-bubble.markdown-body {
  white-space: normal;
}

.markdown-body p {
  margin: 0 0 12px 0;
}

.markdown-body p:last-child {
  margin-bottom: 0;
}

.markdown-body strong {
  font-weight: 600;
  color: var(--text-primary);
}

.markdown-body li strong {
  letter-spacing: var(--markdown-list-strong-letter-spacing);
}

.markdown-body em {
  font-style: italic;
}

.markdown-body mark {
  background: rgba(var(--primary-glow-rgb), 0.14);
  color: var(--text-primary);
  padding: 0 4px;
  border-radius: 6px;
}

.markdown-body h1,
.markdown-body h2,
.markdown-body h3,
.markdown-body h4 {
  margin: 16px 0 8px 0;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.4;
}

.markdown-body h1:first-child,
.markdown-body h2:first-child,
.markdown-body h3:first-child,
.markdown-body h4:first-child {
  margin-top: 0;
}

.markdown-body h1 {
  font-size: 1.45em;
  font-weight: 800;
  letter-spacing: -0.02em;
  background: var(--primary-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.markdown-body h2 {
  font-size: 1.25em;
  font-weight: 700;
  letter-spacing: -0.035em;
  background: var(--primary-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.markdown-body h3,
.markdown-body h4 {
  letter-spacing: var(--markdown-heading-letter-spacing);
}

.markdown-body h3 {
  font-size: 1.1em;
}

.markdown-body h4 {
  font-size: 1em;
}

/* 列表样式 */
.markdown-body ul,
.markdown-body ol {
  margin: 8px 0;
  padding-left: 24px;
}

.markdown-body li {
  margin: 0 0 var(--markdown-list-item-gap) 0;
  line-height: 1.6;
}

.markdown-body li:last-child {
  margin-bottom: 0;
}

.markdown-body li::marker {
  color: var(--text-muted);
}

.markdown-body ul ul,
.markdown-body ol ol,
.markdown-body ul ol,
.markdown-body ol ul {
  margin: 4px 0;
}

/* 行内代码 */
.markdown-body code:not(pre code) {
  background: var(--bg-tertiary);
  color: #c7254e;
  padding: 2px 6px;
  border-radius: 4px;
  font-family: 'JetBrains Mono', 'SF Mono', 'Monaco', 'Inconsolata', 'Fira Code', monospace;
  font-size: 0.88em;
  border: 1px solid var(--border-color);
}

/* 代码块容器 */
.markdown-body .code-block-wrapper {
  position: relative;
  margin: 20px 0;
  border-radius: 12px;
  overflow: hidden;
  background: #111827;
  border: 1px solid rgba(255, 255, 255, 0.05);
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
}

.markdown-body .code-block-wrapper:hover {
  box-shadow: var(--glow-code), 0 10px 30px rgba(0, 0, 0, 0.2);
  border-color: rgba(var(--primary-glow-rgb), 0.22);
  transform: translateY(-1px);
}

.markdown-body .code-block-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 16px;
  background: rgba(255, 255, 255, 0.03);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.markdown-body .code-lang {
  font-size: 11px;
  font-weight: 700;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-family: 'JetBrains Mono', monospace;
  display: flex;
  align-items: center;
}

/* Mac 窗口控制点 */
.markdown-body .code-lang::before {
  content: '';
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #ef4444;
  box-shadow: 16px 0 0 #eab308, 32px 0 0 #22c55e;
  margin-right: 48px;
  opacity: 0.85;
  transition: opacity 0.2s;
}

.markdown-body .code-block-wrapper:hover .code-lang::before {
  opacity: 1;
}

.markdown-body .code-copy-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 6px;
  color: rgba(255, 255, 255, 0.6);
  font-size: 11px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: 'Inter', sans-serif;
}

.markdown-body .code-copy-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.4);
}

.markdown-body .code-copy-btn.copied {
  background: #22c55e;
  border-color: #22c55e;
  color: #fff;
}

.markdown-body .code-copy-btn svg {
  width: 14px;
  height: 14px;
}

.markdown-body pre {
  margin: 0;
  padding: 20px;
  overflow-x: auto;
  background: transparent;
}

.markdown-body pre code {
  font-family: 'JetBrains Mono', 'SF Mono', 'Monaco', 'Inconsolata', 'Fira Code', monospace;
  font-size: 13px;
  line-height: 1.6;
  color: #e5e7eb;
  background: transparent;
  padding: 0;
  border: none;
}

/* 代码高亮主题 (VS Code Dark+) */
.markdown-body pre .hljs-keyword { color: #569cd6; }
.markdown-body pre .hljs-string { color: #ce9178; }
.markdown-body pre .hljs-number { color: #b5cea8; }
.markdown-body pre .hljs-comment { color: #6a9955; font-style: italic; }
.markdown-body pre .hljs-function { color: #dcdcaa; }
.markdown-body pre .hljs-class { color: #4ec9b0; }
.markdown-body pre .hljs-variable { color: #9cdcfe; }
.markdown-body pre .hljs-operator { color: #d4d4d4; }
.markdown-body pre .hljs-punctuation { color: #d4d4d4; }
.markdown-body pre .hljs-property { color: #9cdcfe; }
.markdown-body pre .hljs-attr { color: #9cdcfe; }
.markdown-body pre .hljs-built_in { color: #4ec9b0; }
.markdown-body pre .hljs-title { color: #dcdcaa; }
.markdown-body pre .hljs-params { color: #9cdcfe; }
.markdown-body pre .hljs-literal { color: #569cd6; }
.markdown-body pre .hljs-type { color: #4ec9b0; }
.markdown-body pre .hljs-meta { color: #c586c0; }
.markdown-body pre .hljs-selector-tag { color: #d7ba7d; }
.markdown-body pre .hljs-selector-class { color: #d7ba7d; }
.markdown-body pre .hljs-selector-id { color: #d7ba7d; }
.markdown-body pre .hljs-attribute { color: #9cdcfe; }
.markdown-body pre .hljs-tag { color: #569cd6; }
.markdown-body pre .hljs-name { color: #569cd6; }

/* 引用块 */
.markdown-body blockquote {
  margin: 12px 0;
  padding: 10px 16px;
  /* Aurora Ink Style: Subtle theme tint instead of static blue */
  border-left: 4px solid rgba(var(--primary-glow-rgb), 0.3);
  background: rgba(var(--primary-glow-rgb), 0.05);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--text-secondary);
}

.markdown-body blockquote p {
  margin: 0;
}

/* Callout (Notion/Obsidian 风格结构化提示块) */
.markdown-body .callout {
  margin: 12px 0;
  padding: 10px 16px;
  border-left: 4px solid rgba(var(--primary-glow-rgb), 0.3);
  background: rgba(var(--primary-glow-rgb), 0.05);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--text-secondary);
}

.markdown-body .callout .callout-title {
  font-weight: 700;
  color: var(--text-primary);
  margin: 0 0 8px 0;
}

.markdown-body .callout-body > :last-child {
  margin-bottom: 0;
}

/* 卡片式信息架构（更像文档排版，不像聊天列表） */
.markdown-body .ia-cards {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 10px 0;
}

.markdown-body .ia-card {
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 12px 14px;
  background: transparent;
}

.markdown-body .ia-card-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.markdown-body .ia-card-icon {
  width: 28px;
  height: 28px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-color);
  background: var(--bg-secondary);
  color: var(--text-secondary);
  flex-shrink: 0;
}

.markdown-body .ia-card-title {
  font-weight: var(--markdown-card-title-weight);
  color: var(--text-primary);
  letter-spacing: var(--markdown-card-title-letter-spacing);
}

.markdown-body .ia-card-body {
  color: var(--text-secondary);
}

.markdown-body .ia-card-body > :last-child {
  margin-bottom: 0;
}

/* 水平分割线 */
.markdown-body hr {
  border: none;
  height: 1px;
  background: var(--border-color);
  margin: 16px 0;
}

/* 表格 */
.markdown-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 12px 0;
  font-size: 14px;
  /* 防止宽表格撑破气泡：允许横向滚动 */
  display: block;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.markdown-body th,
.markdown-body td {
  padding: 10px 12px;
  border: 1px solid var(--border-color);
  text-align: left;
}

.markdown-body th {
  background: var(--bg-tertiary);
  font-weight: 600;
  color: var(--text-primary);
}

.markdown-body tr:nth-child(even) {
  background: var(--bg-tertiary);
}

/* 链接 */
.markdown-body a {
  color: var(--accent-blue);
  text-decoration: none;
}

.markdown-body a:hover {
  text-decoration: underline;
}

/* 图片 */
.markdown-body img {
  max-width: 100%;
  border-radius: var(--radius-sm);
  margin: 8px 0;
}

/* ========================================
   动效可访问性
   ======================================== */

@media (prefers-reduced-motion: reduce) {
  .mesh-orb {
    animation: none;
  }

  body.thinking .mesh-orb {
    animation: none;
  }

  .message {
    animation: none;
    opacity: 1;
    transform: none;
  }

  /* 
  .blur-in-char {
    animation: none;
    opacity: 1;
    filter: none;
    transform: none;
  } 
  */

  .composer-container {
    animation: none;
  }
}

/* ========================================
   右键菜单 (Context Menu)
   ======================================== */
.context-menu {
  position: fixed;
  z-index: 10000;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: 4px;
  min-width: 120px;
  animation: context-menu-appear 0.1s ease-out;
}

@keyframes context-menu-appear {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

.context-menu-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  font-size: 13px;
  color: var(--text-primary);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.1s;
}

.context-menu-item:hover {
  background: var(--bg-tertiary);
}

.context-menu-item svg {
  width: 14px;
  height: 14px;
  color: var(--text-muted);
}

/* ========================================
   Toast Notification (Motion & Soul)
   ======================================== */

.toast-notification {
  position: fixed;
  top: 75px; /* Moved down by 5px */
  left: 50%;
  transform: translateX(-50%);
  z-index: 2000;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px 8px 12px;
  background: rgba(18, 18, 23, 0.92); /* Slightly higher opacity for contrast */
  backdrop-filter: blur(16px) saturate(180%);
  -webkit-backdrop-filter: blur(16px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 
    inset 0 1px 0 rgba(255, 255, 255, 0.15), 
    0 8px 24px rgba(0, 0, 0, 0.3), 
    0 2px 4px rgba(0, 0, 0, 0.1);
  border-radius: 999px;
  color: #fff;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.3px;
  pointer-events: none;
  /* User-defined snappy bounce */
  animation: toast-enter-bounce 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
  opacity: 0;
  will-change: transform, opacity;
}

.toast-notification.hiding {
  animation: toast-fade-out 0.2s cubic-bezier(0.4, 0, 1, 1) forwards;
}

.toast-dot {
  width: 8px; /* Restored size for visibility */
  height: 8px;
  border-radius: 50%;
  position: relative;
  will-change: transform, box-shadow, opacity;
  /* High-Energy Pulse: Faster, more intense */
  animation: toast-pulse-visible 2s infinite cubic-bezier(0.4, 0, 0.2, 1);
}

/* The "Soul" Aura */
.toast-dot::after {
  content: '';
  position: absolute;
  top: -4px;
  left: -4px;
  right: -4px;
  bottom: -4px;
  border-radius: 50%;
  background: inherit;
  z-index: -1;
  opacity: 0.4;
  will-change: transform, opacity;
  animation: toast-glow-diffusion 2s infinite cubic-bezier(0.4, 0, 0.2, 1);
}

/* 
  High Visibility Glows 
  Increased spread radius (3rd value) and opacity
*/
.toast-dot.text-blue { background: #60a5fa; box-shadow: 0 0 12px 2px rgba(96, 165, 250, 0.7); }
.toast-dot.text-green { background: #34d399; box-shadow: 0 0 12px 2px rgba(52, 211, 153, 0.7); }
.toast-dot.text-orange { background: #fb923c; box-shadow: 0 0 12px 2px rgba(251, 146, 60, 0.7); }
.toast-dot.text-purple { background: #c084fc; box-shadow: 0 0 12px 2px rgba(192, 132, 252, 0.7); }

@keyframes toast-enter-bounce {
  0% { 
    opacity: 0; 
    transform: translate(-50%, -20px) scale(0.9); 
  }
  100% { 
    opacity: 1; 
    transform: translate(-50%, 0) scale(1); 
  }
}

@keyframes toast-fade-out {
  from { opacity: 1; transform: translate(-50%, 0) scale(1); }
  to { opacity: 0; transform: translate(-50%, -6px) scale(0.95); }
}

@keyframes toast-pulse-visible {
  0%, 100% { 
    transform: scale(1.1); 
    opacity: 1; 
  }
  50% { 
    /* Deep contraction & dimming = Blinking effect */
    transform: scale(0.7); 
    opacity: 0.5; 
  }
}

@keyframes toast-glow-diffusion {
  0% {
    transform: scale(0.8);
    opacity: 0.8; /* Start strong */
    filter: blur(2px);
  }
  50% {
    /* Max expansion matches the blink rhythm */
    transform: scale(2.5);
    opacity: 0;
    filter: blur(8px);
  }
  100% {
    transform: scale(2.5);
    opacity: 0;
    filter: blur(8px);
  }
}

/* Toast 消息文本 */
.toast-message {
  flex: 1;
  min-width: 0;
}

/* Toast 操作按钮 */
.toast-action {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.4);
  color: rgba(255, 255, 255, 0.9);
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
  pointer-events: auto;
  white-space: nowrap;
}

.toast-action:hover {
  background: rgba(255, 255, 255, 0.15);
}

.toast-action:active {
  transform: scale(0.96);
}

/* Toast 关闭按钮 */
.toast-close {
  background: transparent;
  border: none;
  color: rgba(255, 255, 255, 0.5);
  padding: 4px;
  cursor: pointer;
  border-radius: 4px;
  transition: color 0.15s, background 0.15s;
  pointer-events: auto;
  display: flex;
  align-items: center;
  justify-content: center;
}

.toast-close:hover {
  color: rgba(255, 255, 255, 0.9);
  background: rgba(255, 255, 255, 0.1);
}

.toast-close svg {
  width: 12px;
  height: 12px;
}

/* Toast 进度条 */
.toast-progress {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: rgba(255, 255, 255, 0.3);
  transform-origin: left;
  animation: toast-countdown linear forwards;
  border-radius: 0 0 999px 999px;
}

@keyframes toast-countdown {
  from { transform: scaleX(1); }
  to { transform: scaleX(0); }
}

/* Toast 红色错误样式 */
.toast-dot.text-red { background: #ef4444; box-shadow: 0 0 12px 2px rgba(239, 68, 68, 0.7); }

/* ========================================
   Compact Preview Dialog
   ======================================== */

.compact-preview-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: overlay-fade-in 0.2s ease-out;
}

@keyframes overlay-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.region-lock-overlay {
  position: fixed;
  inset: 0;
  z-index: 10050;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: overlay-fade-in 0.2s ease-out;
}

.region-lock-card {
  width: min(420px, 100%);
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  padding: 18px 18px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.region-lock-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
}

.region-lock-message {
  font-size: 13px;
  line-height: 1.6;
  color: var(--text-secondary);
}

.region-lock-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 6px;
}

.region-lock-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 12px;
  border-radius: 10px;
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-color);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.region-lock-link:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.25);
}

body.region-locked {
  overflow: hidden;
}

/* ========================================
   Auth Panel
   ======================================== */

.auth-panel-overlay {
  position: fixed;
  inset: 0;
  z-index: 10030;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  /* 企业稳重风格：轻遮罩 + 极轻品牌渐变，不用重模糊 */
  background:
    linear-gradient(180deg, rgba(30, 64, 175, 0.06) 0%, rgba(30, 64, 175, 0.02) 100%),
    rgba(0, 0, 0, 0.12);
  /* 移除重模糊，保持清晰聚焦 */
  animation: overlay-fade-in 0.2s ease-out;
}

.auth-panel {
  width: min(var(--auth-panel-max-width), 100%);
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--auth-panel-radius);
  box-shadow: var(--shadow-float);
  display: flex;
  flex-direction: column;
  overflow: visible;
  animation: auth-panel-rise 0.25s var(--ease-out);
  --auth-accent: var(--accent-blue);
  --auth-accent-soft: rgba(59, 130, 246, 0.12);
}

@keyframes auth-panel-rise {
  from {
    opacity: 0;
    transform: translateY(14px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.auth-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  padding: 16px 18px 12px;
  background: var(--bg-tertiary);
  border-bottom: 1px solid var(--border-color);
}

.auth-panel-kicker {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.auth-panel-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  margin-top: 4px;
}

.auth-panel-subtitle {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 4px;
}

.auth-panel-close {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  border: none;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
  opacity: 0.08;
}

.auth-panel-close.left {
  position: absolute;
  left: 18px;
  top: 16px;
}

.auth-panel-close:hover,
.auth-panel-close:focus-visible {
  background: rgba(0, 0, 0, 0.08);
  color: var(--text-primary);
  opacity: 1;
}

.auth-panel-body {
  padding: 16px 18px 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.auth-panel-alert {
  padding: 10px 12px;
  border-radius: var(--radius-md);
  font-size: 12px;
  line-height: 1.4;
  background: rgba(59, 130, 246, 0.12);
  color: var(--text-primary);
  border: 1px solid rgba(59, 130, 246, 0.2);
}

.auth-panel-alert.error {
  background: rgba(239, 68, 68, 0.12);
  border-color: rgba(239, 68, 68, 0.25);
  color: #b91c1c;
}

.auth-panel-alert.success {
  background: rgba(16, 185, 129, 0.12);
  border-color: rgba(16, 185, 129, 0.25);
  color: #047857;
}

.auth-panel-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.auth-panel-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.auth-panel-tab {
  padding: 6px 12px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-color);
  background: transparent;
  font-size: 12px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
}

.auth-panel-tab.active,
.auth-panel-tab:hover {
  background: var(--auth-accent-soft);
  border-color: rgba(59, 130, 246, 0.4);
  color: var(--text-primary);
}

.auth-panel-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.auth-panel-row {
  display: grid;
  grid-template-columns: 1fr 110px;
  gap: 10px;
}

.auth-panel-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.auth-panel-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
}

.auth-panel-input {
  padding: 10px 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-size: 13px;
  transition: var(--transition);
}

.auth-panel-input:focus {
  outline: none;
  border-color: rgba(59, 130, 246, 0.6);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12);
}

.auth-panel-input:disabled {
  background: var(--bg-tertiary);
  color: var(--text-muted);
}

.auth-panel-otp-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  color: var(--text-muted);
}

.auth-panel-otp-notes {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.auth-panel-muted {
  color: var(--text-muted);
  font-size: 11px;
}

.auth-panel-link {
  background: none;
  border: none;
  padding: 0;
  color: var(--auth-accent);
  font-size: 11px;
  cursor: pointer;
}

.auth-panel-link[disabled] {
  color: var(--text-muted);
  cursor: not-allowed;
}

/* OTP 输入框包裹容器 - 重新发送按钮在右下角 */
.auth-otp-field-wrapper {
  width: 100%;
}

/* OTP 组件内的垂直栈与分组 */
.auth-otp-stack {
  display: flex;
  flex-direction: column;
  gap: var(--auth-otp-stack-gap);
}

.auth-otp-group {
  display: flex;
  flex-direction: column;
  gap: var(--auth-otp-group-gap);
}

/* 重新发送模块 - 新设计 */
.auth-otp-resend-module {
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: var(--auth-otp-resend-min-height);
  line-height: var(--auth-otp-resend-line-height);
  font-size: 13px;
  opacity: 0;
  transition: opacity 150ms ease-out;
}

/* 鼠标靠近这一行时才显示 */
.auth-otp-resend-module:hover {
  opacity: 1;
}

/* 左侧状态文案 */
.auth-resend-status {
  color: var(--text-muted);
  user-select: none;
}

/* 右侧提示文案（不可点击） */
.auth-resend-hint {
  color: var(--text-muted);
  pointer-events: none;
  user-select: none;
}

/* 右侧链接文案（可点击） */
.auth-resend-link {
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
  text-decoration: none;
  transition: text-decoration 150ms ease-out;
}

.auth-resend-link:hover {
  text-decoration: underline;
}

.auth-resend-link[disabled] {
  color: var(--text-muted);
  cursor: not-allowed;
  text-decoration: none;
}

/* 旧版重新发送行（保留兼容） */
.auth-otp-resend-row {
  display: flex;
  justify-content: flex-end;
  margin-top: 8px;
}

.auth-resend-inline {
  font-size: 13px;
  color: var(--accent-blue);
}

.auth-resend-inline[disabled] {
  color: var(--text-muted);
}

.auth-panel-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.auth-panel-btn {
  padding: 8px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: transparent;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.auth-panel-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.auth-panel-btn.primary {
  background: var(--auth-accent);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 6px 16px rgba(59, 130, 246, 0.3);
}

.auth-panel-btn.primary:hover {
  filter: brightness(1.05);
}

.auth-panel-btn.ghost {
  background: transparent;
}

.auth-panel-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.auth-panel-footer {
  display: flex;
  justify-content: flex-end;
}

.auth-panel-grid {
  display: grid;
  gap: 10px;
}

.auth-panel-row-item {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.auth-panel-meta {
  font-size: 11px;
  color: var(--text-muted);
}

.auth-panel-value {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
  text-align: right;
}

.auth-panel-balance {
  padding: 10px 12px;
  border-radius: var(--radius-md);
  background: rgba(59, 130, 246, 0.08);
  border: 1px solid rgba(59, 130, 246, 0.15);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.auth-panel-divider {
  height: 1px;
  background: var(--border-color);
}

.auth-identity-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.auth-identity-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: var(--bg-tertiary);
}

.auth-identity-main {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.auth-identity-provider {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-secondary);
}

.auth-identity-subject,
.auth-identity-email {
  font-size: 11px;
  color: var(--text-primary);
}

.auth-panel-wechat {
  display: flex;
  gap: 14px;
  align-items: center;
}

.auth-panel-qr {
  width: 120px;
  height: 120px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.auth-panel-qr-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.auth-panel-wechat-text {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.auth-panel-wechat-status {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
}

.auth-panel-wechat-actions {
  display: flex;
  gap: 8px;
}

body.auth-panel-open {
  overflow: hidden;
}

@media (max-width: 520px) {
  .auth-panel-row {
    grid-template-columns: 1fr;
  }

  .auth-panel-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .auth-panel-wechat {
    flex-direction: column;
    align-items: flex-start;
  }

  .auth-panel-qr {
    width: 160px;
    height: 160px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .auth-panel,
  .auth-panel-overlay {
    animation: none;
  }
}

.compact-preview-dialog {
  width: 100%;
  max-width: 480px;
  max-height: 85vh;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  display: flex;
  flex-direction: column;
  animation: dialog-slide-up 0.25s ease-out;
  overflow: hidden;
}

@keyframes dialog-slide-up {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.compact-preview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-tertiary);
}

.compact-preview-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.compact-preview-title svg {
  color: var(--text-purple);
}

.compact-preview-close {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition);
}

.compact-preview-close:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.compact-preview-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.compact-preview-stats {
  display: flex;
  gap: 12px;
  padding: 10px 12px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-md);
}

.compact-stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.compact-stat-label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.compact-stat-value {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.compact-stat-value.text-green { color: var(--text-green); }
.compact-stat-value.text-orange { color: var(--text-orange); }
.compact-stat-value.text-purple { color: var(--text-purple); }

.compact-preview-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.compact-preview-section-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 6px;
}

.compact-preview-section-title svg {
  width: 14px;
  height: 14px;
  color: var(--text-muted);
}

.compact-summary-textarea {
  width: 100%;
  min-height: 80px;
  max-height: 150px;
  padding: 10px 12px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 13px;
  line-height: 1.5;
  resize: vertical;
  transition: var(--transition);
}

.compact-summary-textarea:focus {
  outline: none;
  border-color: var(--text-purple);
  box-shadow: 0 0 0 2px rgba(192, 132, 252, 0.15);
}

.compact-memory-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 200px;
  overflow-y: auto;
}

.compact-memory-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 8px 10px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-sm);
  font-size: 12px;
  line-height: 1.4;
}

.compact-memory-section-badge {
  flex-shrink: 0;
  padding: 2px 6px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xs);
  font-size: 10px;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
}

.compact-memory-text {
  color: var(--text-secondary);
  flex: 1;
}

.compact-preview-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid var(--border-color);
  background: var(--bg-tertiary);
}

.compact-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 500;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition);
}

.compact-btn-cancel {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
}

.compact-btn-cancel:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.compact-btn-confirm {
  background: var(--text-purple);
  border: none;
  color: #fff;
}

.compact-btn-confirm:hover {
  background: #a855f7;
}

.compact-btn-confirm:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ========================================
   Auto Compact Notification Banner
   ======================================== */

.compact-notification-banner {
  position: fixed;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9998;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  animation: banner-slide-down 0.3s ease-out;
  max-width: calc(100% - 24px);
}

@keyframes banner-slide-down {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(-16px);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

.compact-notification-banner.hiding {
  animation: banner-slide-up 0.2s ease-in forwards;
}

@keyframes banner-slide-up {
  from {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
  to {
    opacity: 0;
    transform: translateX(-50%) translateY(-16px);
  }
}

.banner-icon {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(251, 146, 60, 0.1);
  border-radius: var(--radius-md);
  color: var(--text-orange);
}

.banner-content {
  flex: 1;
  min-width: 0;
}

.banner-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.banner-desc {
  font-size: 11px;
  color: var(--text-muted);
}

.banner-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.banner-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 500;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}

.banner-btn-primary {
  background: var(--text-purple);
  border: none;
  color: #fff;
}

.banner-btn-primary:hover {
  background: #a855f7;
}

.banner-btn-secondary {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
}

.banner-btn-secondary:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.banner-close {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  border-radius: var(--radius-xs);
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition);
}

.banner-close:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

/* ========================================
   Inline Banner - 通用内联横幅组件
   用于上下文相关的持久提示 (Layer 2)
   ======================================== */

.inline-banner {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 14px;
  margin: 8px 12px;
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid var(--border-color);
  backdrop-filter: blur(8px);
  opacity: 0;
  transform: translateY(-8px);
  transition: opacity 0.25s cubic-bezier(0.34, 1.56, 0.64, 1),
              transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.inline-banner.visible {
  opacity: 1;
  transform: translateY(0);
}

.inline-banner.hiding {
  animation: inline-banner-out 0.2s ease-in forwards;
}

@keyframes inline-banner-out {
  from {
    opacity: 1;
    transform: translateY(0);
  }
  to {
    opacity: 0;
    transform: translateY(-8px);
  }
}

/* Banner 类型样式 */
.inline-banner.banner-info {
  border-left: 3px solid var(--accent-blue);
  background: rgba(59, 130, 246, 0.05);
}

.inline-banner.banner-warning {
  border-left: 3px solid var(--text-orange);
  background: rgba(251, 146, 60, 0.05);
}

.inline-banner.banner-error {
  border-left: 3px solid var(--accent-red);
  background: rgba(239, 68, 68, 0.05);
}

.inline-banner.banner-success {
  border-left: 3px solid var(--text-green);
  background: rgba(34, 197, 94, 0.05);
}

/* Banner 图标 */
.inline-banner .banner-icon-wrapper {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.inline-banner.banner-info .banner-icon-wrapper {
  color: var(--accent-blue);
}

.inline-banner.banner-warning .banner-icon-wrapper {
  color: var(--text-orange);
}

.inline-banner.banner-error .banner-icon-wrapper {
  color: var(--accent-red);
}

.inline-banner.banner-success .banner-icon-wrapper {
  color: var(--text-green);
}

/* Banner 内容 */
.inline-banner .banner-content {
  flex: 1;
  min-width: 0;
}

.inline-banner .banner-message {
  margin: 0;
  font-size: 13px;
  color: var(--text-primary);
  line-height: 1.5;
}

.inline-banner .banner-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.inline-banner .banner-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}

.inline-banner .banner-btn-primary {
  background: var(--text-purple);
  border: none;
  color: #fff;
}

.inline-banner .banner-btn-primary:hover {
  background: #a855f7;
  transform: translateY(-1px);
}

.inline-banner .banner-btn-secondary {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
}

.inline-banner .banner-btn-secondary:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

/* Banner 关闭按钮 */
.inline-banner .banner-close {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  border-radius: var(--radius-xs);
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition);
  margin-left: auto;
}

.inline-banner .banner-close:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

/* 暗色模式适配 */
@media (prefers-color-scheme: dark) {
  .inline-banner {
    background: rgba(30, 30, 30, 0.8);
  }

  .inline-banner.banner-info {
    background: rgba(59, 130, 246, 0.08);
  }

  .inline-banner.banner-warning {
    background: rgba(251, 146, 60, 0.08);
  }

  .inline-banner.banner-error {
    background: rgba(239, 68, 68, 0.08);
  }

  .inline-banner.banner-success {
    background: rgba(34, 197, 94, 0.08);
  }
}

/* ========================================
   Energy Edge - 底部能量槽 (HUD 进度条)
   主题色跟随模型切换
   ======================================== */

/* 主题色 CSS 变量（跟随 data-model 属性） */
:root {
  --energy-theme-color: var(--accent-blue);
  --energy-theme-rgb: 59, 130, 246;
}

[data-model="aii"] {
  --energy-theme-color: var(--accent-blue);
  --energy-theme-rgb: 59, 130, 246;
}

[data-model="gpt"] {
  --energy-theme-color: #10a37f;
  --energy-theme-rgb: 16, 163, 127;
}

[data-model="claude"] {
  --energy-theme-color: #d97757;
  --energy-theme-rgb: 217, 119, 87;
}

[data-model="deepseek"] {
  --energy-theme-color: var(--accent-purple);
  --energy-theme-rgb: 139, 92, 246;
}

.energy-edge {
  position: relative;
  width: calc(100% + 12px); /* 延伸到 glass-panel 全宽 */
  margin: 0 -6px; /* 抵消父容器 6px 左右 padding */
  padding: 3px 0 0 0;
  min-height: 5px; /* 固定占位，避免显隐造成输入区抖动 */
  cursor: default;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}

/* 仅在 critical 状态下显示可点击的指针样式 */
.energy-edge.critical {
  cursor: pointer;
}

.energy-edge.is-visible {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.energy-edge.hidden {
  display: block !important; /* 覆盖全局 .hidden，保留高度占位 */
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

.energy-edge-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ========================================
   Synapse Bar 3.0 - 三层进度条
   L1: 历史 (History) - 深色模型主色
   L2: 输入 (Input) - 浅色模型主色 + 高亮
   L3: 开销 (Overhead) - 灰色
   ======================================== */

.energy-edge-track {
  position: relative;
  display: flex;
  flex: 1;
  height: 2px;
  border-radius: 0; /* 弧度由 glass-panel overflow:hidden 裁剪 */
  overflow: hidden;
  background: rgba(148, 163, 184, 0.08);
  transition: height 0.3s ease;
}

/* 80%+ 时进度条变粗 */
.energy-edge.critical .energy-edge-track {
  height: 3px;
}

/* 三层填充基础样式 */
.energy-fill {
  height: 100%;
  flex-shrink: 0;
  transition: width 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

/* L1: 历史层 - 哑光深沉基底 (沉淀感) */
.energy-fill-history {
  background: var(--energy-theme-color);
  opacity: 1;
  /* 降低亮度与饱和度，使其像是一块坚实的基岩，衬托 L2 */
  filter: brightness(0.65) saturate(0.8);
}

/* L2: 输入层 - 极致高能光谱彩带 (宽波段柔光版) */
.energy-fill-input {
  /* 
     去尖峰设计：
     移除 49%-51% 的极窄光针，改为平滑宽阔的青色漫射区 (35%-65%)
     彻底移除白色停靠点
  */
  background: linear-gradient(
    90deg,
    rgba(var(--energy-theme-rgb), 0.7) 0%,
    rgba(168, 85, 247, 1.0) 25%,        /* 紫色 */
    
    rgba(var(--energy-theme-rgb), 1.0) 40%, /* 过渡蓝 */
    rgba(34, 211, 238, 0.95) 50%,       /* 青色波峰 (宽阔且略微透明，不再刺眼) */
    rgba(var(--energy-theme-rgb), 1.0) 60%, /* 过渡蓝 */
    
    rgba(168, 85, 247, 1.0) 75%,        /* 紫色 */
    rgba(var(--energy-theme-rgb), 0.7) 100%
  );
  
  background-size: 200% 100%;
  opacity: 1;
  
  /* 4秒循环 */
  animation: energy-liquid-flow 4s linear infinite;
  
  /* 保持高色彩饱和度，但光感更均匀 */
  filter: saturate(1.8) brightness(1.2) drop-shadow(0 0 10px rgba(34, 211, 238, 0.5));
  
  transition: all 0.4s cubic-bezier(0.23, 1, 0.32, 1);
}

/* L2 输入时状态 - 辉光爆发 */
.energy-fill-input.typing {
  filter: saturate(1.6) brightness(1.2) drop-shadow(0 0 10px rgba(34, 211, 238, 0.6));
  /* 增加微弱的上下溢出感 */
  transform: scaleY(1.1);
}

@keyframes energy-liquid-flow {
  from { background-position: 200% 0; }
  to { background-position: 0% 0; }
}

/* L2 输入时状态 - 辉光增强 */
.energy-fill-input.typing {
  filter: saturate(1.3) brightness(1.2);
  box-shadow: 0 0 12px rgba(var(--energy-theme-rgb), 0.4);
}

@keyframes input-highlight {
  0% { filter: brightness(1.4) saturate(1.4); }
  50% { filter: brightness(1.8) saturate(1.8); }
  100% { filter: brightness(1.4) saturate(1.4); }
}

/* L3: 开销层 - 灰色 */
.energy-fill-overhead {
  background: #64748b;
  opacity: 0.6;
}

/* L3 呼吸动画 - 总体超50%时触发 */
.energy-edge.breathing .energy-fill-overhead {
  animation: overhead-breathe 2s ease-in-out infinite;
}

@keyframes overhead-breathe {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 0.75; }
}

/* ========================================
   Critical 状态 (80%+) - 所有层变为警示色
   ======================================== */

.energy-edge.critical .energy-fill-history {
  background: linear-gradient(90deg,
    var(--energy-theme-color) 0%,
    var(--accent-orange) 100%
  );
  opacity: 1;
}

.energy-edge.critical .energy-fill-input {
  background: linear-gradient(90deg,
    var(--accent-orange) 0%,
    #ef4444 100%
  );
  opacity: 0.8;
}

.energy-edge.critical .energy-fill-overhead {
  background: linear-gradient(90deg,
    #ef4444 0%,
    #dc2626 100%
  );
  opacity: 0.9;
  animation: critical-breathe 1.5s ease-in-out infinite;
}

@keyframes critical-breathe {
  0%, 100% { opacity: 0.8; }
  50% { opacity: 1; }
}

/* ========================================
   旧版兼容样式（保留以防遗留代码引用）
   ======================================== */

.energy-edge-fill {
  position: relative;
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: var(--energy-theme-color);
  box-shadow:
    0 0 6px rgba(var(--energy-theme-rgb), 0.4),
    0 0 12px rgba(var(--energy-theme-rgb), 0.2);
  transition: width 0.4s cubic-bezier(0.16, 1, 0.3, 1), background 0.3s ease, box-shadow 0.3s ease;
}

/* 流动渐变动画（50%+ 时使用） */
@keyframes energy-flow-warm {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* 50%-80%：动态脉冲，主题色→橙色流动 */
.energy-edge-fill.warm {
  background: linear-gradient(90deg,
    var(--energy-theme-color) 0%,
    rgba(251, 191, 36, 0.9) 40%,
    var(--accent-orange) 70%,
    rgba(251, 191, 36, 0.9) 100%
  );
  background-size: 200% 100%;
  box-shadow:
    0 0 8px rgba(251, 191, 36, 0.5),
    0 0 16px rgba(251, 191, 36, 0.25);
  animation: energy-flow-warm 2s linear infinite, energy-pulse 1.5s ease-in-out infinite;
}

/* 脉冲动效（warm 状态） */
@keyframes energy-pulse {
  0%, 100% {
    opacity: 0.9;
  }
  50% {
    opacity: 1;
  }
}

/* 80%+：临界状态 - 橙色→红色流动 */
.energy-edge-fill.critical {
  background: linear-gradient(90deg,
    var(--accent-orange) 0%,
    rgba(249, 115, 22, 0.95) 25%,
    #ef4444 50%,
    rgba(239, 68, 68, 0.9) 75%,
    var(--accent-orange) 100%
  );
  background-size: 300% 100%;
  box-shadow:
    0 0 10px rgba(239, 68, 68, 0.6),
    0 0 20px rgba(249, 115, 22, 0.3);
  animation: energy-flow-critical 1.5s linear infinite, energy-breathe 1.5s ease-in-out infinite;
}

@keyframes energy-flow-critical {
  0% { background-position: 300% 0; }
  100% { background-position: -300% 0; }
}

/* 呼吸动效（critical 状态） */
@keyframes energy-breathe {
  0%, 100% {
    opacity: 0.85;
    box-shadow:
      0 0 8px rgba(239, 68, 68, 0.5),
      0 0 16px rgba(249, 115, 22, 0.25);
  }
  50% {
    opacity: 1;
    box-shadow:
      0 0 14px rgba(239, 68, 68, 0.7),
      0 0 28px rgba(249, 115, 22, 0.4);
  }
}

/* Hover 效果：发光增强 */
.energy-edge:hover .energy-edge-fill {
  box-shadow:
    0 0 10px rgba(var(--energy-theme-rgb), 0.6),
    0 0 20px rgba(var(--energy-theme-rgb), 0.3);
}

.energy-edge:hover .energy-edge-fill.warm {
  box-shadow:
    0 0 12px rgba(251, 191, 36, 0.7),
    0 0 24px rgba(251, 191, 36, 0.35);
}

.energy-edge:hover .energy-edge-fill.critical {
  box-shadow:
    0 0 16px rgba(239, 68, 68, 0.8),
    0 0 32px rgba(249, 115, 22, 0.5);
}

/* ========================================
   Energy Compact Icon - 压缩触发图标
   80%+ 时显示在进度条右侧
   ======================================== */

.energy-compact-icon {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: 4px;
  color: #ef4444;
  cursor: pointer;
  transition: all 0.2s ease;
  animation: compact-icon-pulse 1.5s ease-in-out infinite;
}

.energy-compact-icon.hidden {
  display: none;
}

.energy-compact-icon:hover {
  background: rgba(239, 68, 68, 0.25);
  border-color: rgba(239, 68, 68, 0.5);
  transform: scale(1.1);
}

.energy-compact-icon:active {
  transform: scale(0.95);
}

@keyframes compact-icon-pulse {
  0%, 100% {
    opacity: 0.9;
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.3);
  }
  50% {
    opacity: 1;
    box-shadow: 0 0 8px 2px rgba(239, 68, 68, 0.2);
  }
}

/* ========================================
   Energy Tooltip - Hover 详细信息
   ======================================== */

.energy-tooltip {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  min-width: 160px;
  padding: 10px 12px;
  background: rgba(15, 23, 42, 0.95);
  border: 1px solid rgba(148, 163, 184, 0.15);
  border-radius: var(--radius-md);
  backdrop-filter: blur(12px);
  box-shadow:
    0 8px 24px rgba(0, 0, 0, 0.4),
    0 2px 8px rgba(0, 0, 0, 0.2);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  transform: translateX(-50%) translateY(4px);
}

.energy-edge:hover .energy-tooltip:not(.hidden) {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
  pointer-events: auto;
}

.energy-tooltip.hidden {
  display: none;
}

.energy-tooltip-header {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(148, 163, 184, 0.8);
  margin-bottom: 6px;
}

.energy-tooltip-divider {
  height: 1px;
  background: rgba(148, 163, 184, 0.15);
  margin-bottom: 8px;
}

.energy-tooltip-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}

.energy-tooltip-row:last-child {
  margin-bottom: 0;
}

.energy-tooltip-label {
  font-size: 11px;
  color: var(--text-muted);
}

.energy-tooltip-value {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-primary);
  font-feature-settings: "tnum";
  font-variant-numeric: tabular-nums;
}

.energy-tooltip-value.text-orange { color: var(--accent-orange); }
.energy-tooltip-value.text-red { color: #ef4444; }

/* ========================================
   Compact Trigger Button - 显性触发按钮
   ======================================== */

.compact-trigger-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  margin-right: 6px;
  font-size: 11px;
  font-weight: 500;
  color: var(--accent-orange);
  background: rgba(249, 115, 22, 0.1);
  border: 1px solid rgba(249, 115, 22, 0.3);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
  animation: compact-btn-pulse 2s ease-in-out infinite;
  white-space: nowrap;
}

.compact-trigger-btn.hidden {
  display: none;
}

.compact-trigger-btn:hover {
  background: rgba(249, 115, 22, 0.2);
  border-color: rgba(249, 115, 22, 0.5);
  transform: scale(1.02);
}

.compact-trigger-btn:active {
  transform: scale(0.98);
}

.compact-trigger-btn svg {
  flex-shrink: 0;
  stroke: currentColor;
}

/* 呼吸动效 */
@keyframes compact-btn-pulse {
  0%, 100% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(249, 115, 22, 0.3);
  }
  50% {
    transform: scale(1.03);
    box-shadow: 0 0 8px 2px rgba(249, 115, 22, 0.2);
  }
}

/* Critical 状态：紫色主题 */
.compact-trigger-btn.critical {
  color: var(--accent-purple);
  background: rgba(139, 92, 246, 0.1);
  border-color: rgba(139, 92, 246, 0.3);
  animation: compact-btn-pulse-critical 1.5s ease-in-out infinite;
}

.compact-trigger-btn.critical:hover {
  background: rgba(139, 92, 246, 0.2);
  border-color: rgba(139, 92, 246, 0.5);
}

@keyframes compact-btn-pulse-critical {
  0%, 100% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(139, 92, 246, 0.3);
  }
  50% {
    transform: scale(1.05);
    box-shadow: 0 0 12px 3px rgba(139, 92, 246, 0.25);
  }
}

/* ========================================
   Compact Banner Slot - 嵌入式通知横幅
   ======================================== */

.compact-banner-slot {
  width: 100%;
  overflow: hidden;
}

.compact-banner-slot.hidden {
  display: none;
}

/* 嵌入式 Banner 内容 */
.compact-inline-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  margin: 0 8px 8px 8px;
  background: rgba(249, 115, 22, 0.08);
  border: 1px solid rgba(249, 115, 22, 0.2);
  border-radius: var(--radius-md);
  animation: banner-inline-enter 0.3s ease-out;
}

@keyframes banner-inline-enter {
  from {
    opacity: 0;
    transform: translateY(-8px);
    max-height: 0;
    padding: 0 12px;
    margin-bottom: 0;
  }
  to {
    opacity: 1;
    transform: translateY(0);
    max-height: 80px;
    padding: 8px 12px;
    margin-bottom: 8px;
  }
}

.compact-inline-banner.hiding {
  animation: banner-inline-leave 0.2s ease-in forwards;
}

@keyframes banner-inline-leave {
  from {
    opacity: 1;
    transform: translateY(0);
    max-height: 80px;
  }
  to {
    opacity: 0;
    transform: translateY(-8px);
    max-height: 0;
    padding: 0 12px;
    margin-bottom: 0;
  }
}

.inline-banner-icon {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(249, 115, 22, 0.15);
  border-radius: var(--radius-sm);
  color: var(--accent-orange);
}

.inline-banner-content {
  flex: 1;
  min-width: 0;
}

.inline-banner-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 1px;
}

.inline-banner-desc {
  font-size: 10px;
  color: var(--text-muted);
}

.inline-banner-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.inline-banner-btn {
  padding: 4px 8px;
  font-size: 11px;
  font-weight: 500;
  border-radius: var(--radius-xs);
  cursor: pointer;
  transition: var(--transition);
}

.inline-banner-btn-primary {
  background: var(--accent-purple);
  border: none;
  color: #fff;
}

.inline-banner-btn-primary:hover {
  background: #a855f7;
}

.inline-banner-btn-dismiss {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 4px;
}

.inline-banner-btn-dismiss:hover {
  color: var(--text-primary);
}

/* ========================================
   Empty State Component
   ======================================== */

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 32px 24px;
  min-height: 200px;
}

.empty-illustration {
  margin-bottom: 16px;
  opacity: 0;
  transform: scale(0.9);
  animation: empty-illustration-in 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) 0.1s forwards;
}

.empty-illustration svg {
  width: 80px;
  height: 80px;
}

.empty-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0 0 6px;
  opacity: 0;
  animation: empty-fade-in 0.4s ease 0.2s forwards;
}

.empty-desc {
  font-size: 13px;
  color: var(--text-secondary);
  margin: 0 0 16px;
  max-width: 240px;
  line-height: 1.5;
  opacity: 0;
  animation: empty-fade-in 0.4s ease 0.3s forwards;
}

.empty-cta {
  font-size: 13px;
  font-weight: 600;
  padding: 8px 16px;
  border-radius: 8px;
  border: none;
  background: var(--accent-purple, #c084fc);
  color: white;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
  opacity: 0;
  animation: empty-fade-in 0.4s ease 0.4s forwards;
}

.empty-cta:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(139, 92, 246, 0.3);
}

.empty-cta:active {
  transform: translateY(0);
}

@keyframes empty-illustration-in {
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes empty-fade-in {
  to { opacity: 1; }
}

/* Empty State Variants */
.empty-state-connection-lost .empty-cta {
  background: var(--accent-orange, #fb923c);
}

.empty-state-connection-lost .empty-cta:hover {
  box-shadow: 0 4px 12px rgba(251, 146, 60, 0.3);
}


/* ========================================
   Auth Panel V2 (GPT Style - Refined Apple Aesthetic)
   ======================================== */

/* 
   Overlay & Layout Strategy 
   Target: Centered Card (Modal) with adaptive height.
   Avoids "dead white space" at bottom by centering the card vertically.
*/
.auth-panel-overlay.mode-full .auth-panel {
  max-width: var(--auth-panel-max-width);
  border-radius: var(--auth-panel-radius);
  padding-bottom: var(--auth-panel-padding-bottom);
}

.auth-panel.mode-centered {
  max-width: var(--auth-panel-max-width);
  border-radius: var(--auth-panel-radius);
  padding-bottom: var(--auth-panel-padding-bottom);
  position: relative;
  margin-top: var(--auth-panel-top-offset);
  overflow: visible;
}

/* Typography Overrides for V2 */
.auth-v2-header {
  text-align: center;
  margin-bottom: 32px;
  margin-top: 64px; /* Increased from 24px to push everything down */
}

.auth-v2-logo {
  width: 64px;
  height: 64px;
  margin: 0 auto 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-tertiary);
  color: var(--text-primary);
  box-shadow: var(--shadow-sm);
}

.auth-v2-logo svg {
  width: 36px;
  height: 36px;
}

.auth-v2-title {
  font-size: 26px;
  font-weight: 800;
  color: var(--text-primary);
  margin: 0 0 12px;
  letter-spacing: -0.02em;
}

.auth-v2-subtitle {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* Pill Buttons */
.auth-panel-btn.pill {
  border-radius: 999px;
  padding: 12px 24px;
  font-size: 15px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-weight: 600;
  transition: all 0.2s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.auth-panel-btn.pill:active {
  transform: scale(0.98);
}

.auth-panel-btn.black {
  background: #18181b;
  color: #fff;
  border: 1px solid #18181b;
}

.auth-panel-btn.black:hover {
  background: #27272a;
  border-color: #27272a;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.auth-panel-btn.outline {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-primary);
}

.auth-panel-btn.outline:hover {
  background: var(--bg-tertiary);
  border-color: var(--border-light);
}

.auth-panel-btn.green {
  background: #10b981;
  color: #fff;
  border: 1px solid #10b981;
}

.auth-panel-btn.green:hover {
  background: #059669;
  border-color: #059669;
}

.auth-panel-btn.full-width {
  width: 100%;
}

/* Options Stack */
.auth-options-stack {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  max-width: 320px;
  margin: 0 auto;
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 24px 0;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 500;
  width: 100%;
  max-width: 320px;
  margin-left: auto;
  margin-right: auto;
}

.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border-color);
}

/* Input Styles */
.auth-input-large {
  font-size: 16px;
  padding: 0 16px;
  height: 56px;
  border-radius: 12px;
  background: #fff;
  border: 1px solid #e5e7eb;
  transition: all 0.2s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.auth-input-large:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1);
  transform: translateY(-1px);
}

/* Primary Button in Full Mode */
.auth-panel-btn.primary {
  width: 100%;
  height: 52px;
  border-radius: 12px; /* Slightly squarer than pills */
  font-size: 16px;
  font-weight: 600;
}

.auth-panel-btn.primary.pill {
  border-radius: var(--radius-full);
}
  letter-spacing: -0.01em;
}

/* Hide default header in V2 mode if needed */
.auth-panel.v2 .auth-panel-header {
  border-bottom: none;
  background: transparent;
  padding-bottom: 0;
}

.auth-panel-header.v2-options {
  justify-content: flex-end;
  border-bottom: none;
  background: transparent;
  padding-bottom: 0;
}

/* Tighter form fields in Full Mode */
.auth-panel-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.auth-panel-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 2px;
}

.auth-panel-otp-meta {
  margin-top: 12px;
  justify-content: center;
}


/* ========================================
   Auth Panel - Top Tier Aesthetic Overrides
   ======================================== */

/* 1. Modal Spring Animation */
@keyframes auth-spring-in {
  0% { opacity: 0; transform: scale(0.9) translateY(20px); }
  50% { opacity: 1; transform: scale(1.02) translateY(-5px); }
  100% { opacity: 1; transform: scale(1) translateY(0); }
}

.auth-panel {
  animation: auth-spring-in 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
  /* 企业稳重风格：纯白背景，精致层次感 */
  background: #ffffff;
  /* 两层阴影：小阴影+大阴影 */
  box-shadow:
    0 6px 18px rgba(0, 0, 0, 0.10),
    0 24px 70px rgba(0, 0, 0, 0.12),
    inset 0 0 0 1px rgba(255, 255, 255, 0.70);
  /* 圆角收敛：更像Office插件的成熟组件 */
  border-radius: 18px;
  border: 1px solid rgba(30, 64, 175, 0.08);
  /* 全局字体抗锯齿 - 解决文字模糊问题 */
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* Dark/Deep Theme Support for Glass */
@media (prefers-color-scheme: dark) {
  .auth-panel {
    background: rgba(30, 41, 59, 0.85);
    border-color: rgba(255, 255, 255, 0.1);
    box-shadow: 
      0 25px 50px -12px rgba(0,0,0,0.35),
      inset 0 1px 0 rgba(255,255,255,0.05);
  }
  .auth-v2-title {
    background: linear-gradient(135deg, #fff 0%, #cbd5e1 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
  }
  .auth-panel-input {
    background: rgba(0, 0, 0, 0.2);
    border-color: rgba(255, 255, 255, 0.1);
    color: #e2e8f0;
  }
  .auth-panel-input:focus {
    background: rgba(0, 0, 0, 0.3);
  }
}

/* 2. Typography & Emotions */
.auth-v2-header {
  text-align: center;
  margin-bottom: 24px;
}

.auth-v2-logo {
  margin: 0 auto 16px;
  width: 48px;
  height: 48px;
  color: var(--accent-blue);
  /* Logo Pulse/Morph Placeholder */
  animation: logo-float 6s ease-in-out infinite;
}

@keyframes logo-float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}

.auth-v2-title {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.1;
  margin-bottom: 8px;
  /* Gradient Text */
  background: linear-gradient(135deg, var(--text-primary) 0%, var(--text-secondary) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.auth-v2-subtitle {
  font-size: 14px;
  font-weight: 400;
  line-height: 1.5;
  color: var(--text-secondary);
  max-width: 85%;
  margin: 0 auto;
}

/* 3. Inputs with "Breathing" Focus & Depth */
.auth-panel-input {
  height: 44px;
  background: rgba(255, 255, 255, 0.5);
  border: 1px solid rgba(148, 163, 184, 0.25);
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.02);
  transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  font-size: 14px;
}

.auth-panel-input.auth-input-large {
  height: 52px;
  font-size: 14px;
  padding-left: 16px;
}

.auth-panel-input:hover {
  background: rgba(255, 255, 255, 0.7);
  border-color: rgba(148, 163, 184, 0.4);
}

.auth-panel-input:focus {
  background: rgba(255, 255, 255, 0.95);
  border-color: var(--accent-blue);
  box-shadow: 
    0 0 0 4px rgba(59, 130, 246, 0.15),
    inset 0 1px 2px rgba(0,0,0,0.01),
    0 4px 12px rgba(59, 130, 246, 0.08); /* Glow */
  transform: translateY(-1px);
}

/* 4. Elegant Divider */
.auth-divider {
  margin: 20px 0;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 500;
  opacity: 0.8;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.auth-divider::before,
.auth-divider::after {
  content: "";
  height: 1px;
  flex: 1;
  background: linear-gradient(90deg, transparent, rgba(148, 163, 184, 0.3), transparent);
}

/* 5. Buttons: Magnetic & Morphing */
.auth-panel-btn {
  height: 40px;
  font-weight: 600;
  letter-spacing: 0.01em;
  position: relative;
  overflow: hidden;
}

.auth-panel-btn.pill {
  border-radius: 999px;
}

.auth-panel-btn.primary {
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  background: var(--primary-gradient);
  border: none;
  color: white;
}

.auth-panel-btn.primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px -4px rgba(var(--primary-glow-rgb), 0.5);
  filter: brightness(1.05);
}

.auth-panel-btn.primary:active {
  transform: translateY(0);
  box-shadow: 0 4px 12px -2px rgba(var(--primary-glow-rgb), 0.4);
}

.auth-panel-btn.outline {
  background: transparent;
  border: 1px solid rgba(148, 163, 184, 0.3);
  color: var(--text-primary);
  transition: all 0.2s ease;
}

.auth-panel-btn.outline:hover {
  background: rgba(255, 255, 255, 0.6);
  border-color: rgba(148, 163, 184, 0.5);
  transform: translateY(-1px);
}

/* Loading State - Morph to Spinner */
.auth-panel-btn.loading {
  color: transparent !important;
  pointer-events: none;
  cursor: wait;
}

.auth-panel-btn.loading svg {
  opacity: 0;
}

.auth-panel-btn.loading::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 18px;
  height: 18px;
  margin-top: -9px;
  margin-left: -9px;
  border: 2px solid rgba(255,255,255,0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: auth-spin 0.8s linear infinite;
}

.auth-panel-btn.outline.loading::after {
  border-color: rgba(148, 163, 184, 0.3);
  border-top-color: var(--accent-blue);
}

@keyframes auth-spin {
  to { transform: rotate(360deg); }
}

/* 6. Alert Shake & Polish */
@keyframes auth-shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-4px); }
  40% { transform: translateX(4px); }
  60% { transform: translateX(-2px); }
  80% { transform: translateX(2px); }
}

.auth-panel-alert {
  animation: auth-shake 0.5s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
  border: none;
  background: rgba(59, 130, 246, 0.1);
  color: var(--text-primary);
  border-left: 3px solid var(--accent-blue);
  padding: 12px 16px;
  font-weight: 500;
  display: flex;
  align-items: center;
}

.auth-panel-alert.error {
  background: rgba(239, 68, 68, 0.08);
  border-left-color: #ef4444;
  color: #b91c1c;
}

.auth-panel-alert.info {
  background: rgba(59, 130, 246, 0.08);
  border-left-color: #3b82f6;
  color: #1d4ed8;
}

/* 7. Options Stack Refinement */
.auth-options-stack {
  display: flex;
  flex-direction: column;
  gap: 10px;
}


/* ========================================
   Clean Header & Mascot Styles
   ======================================== */

.auth-panel-header.clean-mode {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  background: transparent;
  border-bottom: none;
  z-index: 10;
  padding: 12px 16px;
  pointer-events: auto;
  justify-content: flex-end; /* Push close button to right */
}

.auth-panel-header.clean-mode .auth-panel-close {
  pointer-events: auto;
  background: transparent;
  border: 1px solid transparent;
  opacity: 0.08;
}

.auth-panel-header.clean-mode .auth-panel-close:hover {
  background: rgba(0, 0, 0, 0.10);
  border-color: rgba(0, 0, 0, 0.04);
  opacity: 1;
}

.auth-mascot {
  width: 64px;
  height: 64px;
  margin: 0 auto;
  display: block;
}

.mascot-head {
  transition: fill 0.3s ease;
}

.mascot-pupil {
  transition: transform 0.15s cubic-bezier(0.2, 0, 0.4, 1);
}

/* ========================================
   Tai Chi Twin Fish Logo Animation
   ======================================== */

.auth-logo-container {
  width: 64px;
  height: 64px;
  margin: 0 auto;
  position: relative;
  /* Use a subtle pulse when idle */
  animation: fish-idle-pulse 4s ease-in-out infinite;
}

.auth-logo-fish {
  width: 100%;
  height: 100%;
  display: block;
  /* Glow filter applied in SVG, but we can enhance it here */
  filter: drop-shadow(0 0 8px rgba(99, 102, 241, 0.3));
}

.fish-group {
  transform-origin: 50px 50px;
  transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Idle State: Slow, meditative rotation */
.auth-logo-container:not(.swimming) .fish-group {
  animation: fish-rotate-idle 6s linear infinite;
}

/* Active State: Fast, energetic rotation when typing */
.auth-logo-container.swimming .fish-group {
  animation: fish-rotate-swim 0.8s linear infinite;
}

@keyframes fish-rotate-idle {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

@keyframes fish-rotate-swim {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

@keyframes fish-idle-pulse {
  0%, 100% { transform: scale(1); opacity: 0.9; }
  50% { transform: scale(1.05); opacity: 1; }
}

/* Enhance Fish Visibility */
.auth-logo-fish {
  filter: drop-shadow(0 0 12px rgba(99, 102, 241, 0.5));
}


/* ========================================
   Badge Logo (The One) - Half-Out Style
   ======================================== */

/* 1. Anchor Point: The Card */
.auth-panel-overlay.mode-full .auth-panel {
  position: relative !important;
  overflow: visible !important; /* Allow logo to protrude */
  margin-top: var(--auth-panel-top-offset); /* Ensure visual space in viewport */
}

/* 2. Z-Index Stack Management
   Keep the header clickable while allowing the logo to float above it.
*/
.auth-panel-overlay.mode-full .auth-panel-body {
  position: relative !important;
  z-index: auto !important;
  overflow: visible !important;
}

/* Reset Intermediates to not clip or offset */
.auth-panel-overlay.mode-full .auth-v2-header {
  position: static !important;
}

.auth-v2-logo {
  display: contents !important; 
}

/* 3. The Badge: Classic Centering (Most Robust) */
.auth-logo-badge {
  position: absolute !important;
  top: -60px !important; /* Half height upwards relative to Body */
  left: 50% !important;
  margin-left: -48px !important; /* Negative half-width */
  width: 96px;
  height: 96px;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  filter: drop-shadow(0 8px 16px rgba(0,0,0,0.25));
  pointer-events: none;
}

.auth-logo-badge-bg {
  position: absolute;
  inset: 12px;
  background: var(--bg-secondary);
  border-radius: 50%;
  z-index: -1;
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.1);
}

/* 4. Content Spacing */
.auth-panel-overlay.mode-full .auth-v2-title {
  display: block;
  position: relative;
  z-index: 20;
}

/* Animation for the Fish Ring */
.fish-ring-group {
  animation: fish-rotate-idle 8s linear infinite;
  transform-origin: 60px 60px;
}

/* Interactive Swim Speed */
.auth-panel-form:focus-within ~ .auth-v2-header .fish-ring-group,
.auth-logo-badge.swimming .fish-ring-group {
  animation-duration: 1.5s;
}

/* Adjust Header Container */
.auth-v2-header {
  text-align: center;
  margin-top: var(--auth-panel-header-margin-top);
  margin-bottom: var(--auth-panel-header-margin-bottom);
}


/* ========================================
   企业稳重风格：内嵌品牌头部
   ======================================== */

/* 品牌头部栏：Logo + 产品名 */
.auth-brand-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 24px 16px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.auth-brand-logo {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.auth-brand-logo svg {
  width: 100%;
  height: 100%;
}

.auth-brand-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

/* 主色更新为深蓝 #1E40AF */
.auth-brand-logo svg {
  color: #1E40AF;
}

/* 企业风格标题区 */
.auth-enterprise-content {
  padding: 28px 24px 24px;
  text-align: center;
}

.auth-enterprise-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 8px;
  letter-spacing: -0.02em;
}

.auth-enterprise-subtitle {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.5;
  max-width: 280px;
  margin: 0 auto;
}

/* 表单区域 */
.auth-enterprise-form {
  padding: 0 24px 24px;
}

/* Primary按钮使用高级黑色系 - One Plan 品牌色 */
.auth-panel-btn.primary {
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Inter', 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: #111111;
  border: none;
  color: white;
  font-weight: 600;
  font-size: 15px;
  --primary-glow-rgb: 17, 17, 17;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.auth-panel-btn.primary:hover {
  background: #333333;
  box-shadow: 0 8px 20px -4px rgba(0, 0, 0, 0.25);
}

.auth-panel-btn.primary:active {
  background: #1a1a1a;
  transform: translateY(0);
}

/* 输入框样式优化 - 现代极简风格 */
.auth-panel-input {
  font-family: "Segoe UI", Roboto, Helvetica, Arial, sans-serif !important;
  font-size: 14px;
  line-height: 20px;
  font-weight: 400;
  letter-spacing: 0.02em;
  border: 1px solid #E5E7EB;
  background-color: #F9FAFB;
  border-radius: 10px;
  padding: 14px 16px;
  color: #374151;
  transition: all 0.2s ease;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.auth-panel-input::placeholder {
  color: #9CA3AF;
  font-weight: 400;
}

.auth-panel-input:hover {
  background-color: #F3F4F6;
  border-color: #D1D5DB;
}

/* 输入框focus使用黑色边框 - 呼应品牌色 */
.auth-panel-input:focus {
  background-color: #FFFFFF;
  border-color: #111111;
  box-shadow:
    0 0 0 3px rgba(0, 0, 0, 0.06),
    inset 0 1px 2px rgba(0,0,0,0.01);
}

/* ========================================
   居中垂直布局样式
   ======================================== */

.auth-centered-layout {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 40px 24px 24px;
  text-align: center;
}

/* Logo 居中 - 优化尺寸和间距 */
.auth-centered-logo {
  width: 80px;
  height: 80px;
  margin-bottom: 16px;
}

.auth-centered-logo svg,
.auth-centered-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* 外部引用 logo 样式 */
.auth-brand-logo {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* App Name 大字加粗黑色 - 无衬线体 + 抗锯齿 */
.auth-centered-appname {
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Inter', 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  font-size: 24px;
  font-weight: 700;
  color: #111111;
  letter-spacing: -0.01em;
  margin-bottom: 6px;
  /* 字体抗锯齿 - 解决模糊问题 */
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* Login Title 小字灰色 - 拉开层次 */
.auth-centered-title {
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Inter', 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  font-size: 14px;
  font-weight: 400;
  color: #9CA3AF;
  margin-bottom: 24px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* 表单居中 */
.auth-centered-form {
  width: 100%;
  max-width: 320px;
}

/* 居中布局下的分隔线和选项 */
.auth-centered-layout .auth-divider {
  width: 100%;
  max-width: 320px;
  margin: 28px 0;
  gap: 16px;
  font-size: 12px;
  color: #9CA3AF;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.auth-centered-layout .auth-divider::before,
.auth-centered-layout .auth-divider::after {
  background: linear-gradient(90deg, transparent, #E5E7EB, transparent);
}

.auth-centered-layout .auth-options-stack {
  width: 100%;
  max-width: 320px;
  gap: 12px;
}
.auth-options-stack .auth-panel-btn {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 13px;
}

/* ========================================
   6位OTP验证码输入框组件
   ======================================== */

/* OTP容器 - 双层架构 */
.auth-otp-container {
  position: relative;
  width: 100%;
  max-width: 320px;
}

/* 隐藏的真实输入框 - 处理所有输入逻辑 */
.auth-otp-hidden-input {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  z-index: 2;
  cursor: text;
  font-size: 16px; /* 防止iOS缩放 */
}

/* 展示层 - 6个等距槽位 */
.auth-otp-display {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  pointer-events: none;
}

/* 单个槽位 */
.auth-otp-slot {
  flex: 1;
  max-width: 48px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #F9FAFB;
  border: 1.5px solid #E5E7EB;
  border-radius: 10px;
  transition: all 0.15s ease;
}

/* 槽位状态 - 空 */
.auth-otp-slot.empty .auth-otp-char::before {
  content: "–";
  color: #E5E7EB;
  font-weight: 300;
  font-size: 20px;
}

/* 槽位状态 - 已填充 */
.auth-otp-slot.filled {
  background: #FFFFFF;
  border-width: 1px;
  border-color: #374151;
}

/* 槽位状态 - 当前激活（光标位置）- 加粗黑色边框 + focus ring */
.auth-otp-slot.active {
  border-color: #111827;
  border-width: 2px;
  background: #FFFFFF;
  outline: 3px solid rgba(17, 24, 39, 0.08);
  outline-offset: 0;
}

/* 字符样式 */
.auth-otp-char {
  font-family: 'SF Mono', 'Menlo', 'Monaco', 'Consolas', monospace;
  font-size: 24px;
  font-weight: 600;
  color: #111111;
  line-height: 1;
}

/* 禁用状态 */
.auth-otp-container.disabled .auth-otp-slot {
  background: #F3F4F6;
  border-color: #E5E7EB;
  cursor: not-allowed;
}

.auth-otp-container.disabled .auth-otp-char {
  color: #9CA3AF;
}

.auth-otp-container.disabled .auth-otp-hidden-input {
  cursor: not-allowed;
}

/* 错误状态 */
.auth-otp-container.error .auth-otp-slot {
  border-color: #EF4444;
  background: #FEF2F2;
}

/* OTP组件下方的重新发送模块间距由 auth-otp-group/auth-otp-stack 控制 */

/* 旧版：OTP组件下方的重新发送按钮行（保留兼容） */
.auth-otp-container + .auth-otp-resend-row {
  margin-top: 12px;
}

/* OTP验证按钮 - 未填满时禁用状态 */
.auth-otp-submit-btn.incomplete {
  background: #9CA3AF !important;
  border-color: transparent !important;
  color: #fff !important;
  box-shadow: none !important;
  cursor: not-allowed;
  opacity: 0.7;
}

/* OTP验证按钮 - 跳动动画 */
@keyframes otp-btn-bounce {
  0%, 100% {
    transform: scale(1);
  }
  25% {
    transform: scale(1.05);
  }
  50% {
    transform: scale(0.98);
  }
  75% {
    transform: scale(1.02);
  }
}

.auth-otp-submit-btn.bounce {
  animation: otp-btn-bounce 0.4s ease-out;
}

/* ========================================
   Left Panel (左侧面板：对话历史 + 项目)
   ======================================== */

.left-panel-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.25);
  z-index: 9996;
  opacity: 0;
  transition: opacity 0.3s ease;
  -webkit-tap-highlight-color: transparent;
}
.left-panel-overlay.visible { opacity: 1; }
.left-panel-overlay.hidden { display: none; }

.left-panel {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: calc(100% - 48px);
  max-width: 320px;
  z-index: 9997;
  transform: translateX(-100%);
  transition: transform 0.3s cubic-bezier(0.23, 1, 0.32, 1);
}
.left-panel.visible { transform: translateX(0); }
.left-panel.hidden { display: none; }

.lp-inner {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(24px) saturate(200%);
  -webkit-backdrop-filter: blur(24px) saturate(200%);
  border-right: 1px solid rgba(0, 0, 0, 0.06);
  box-shadow: 4px 0 24px rgba(0, 0, 0, 0.08);
}

/* 搜索栏 */
.lp-search {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 12px 12px 0;
  padding: 8px 12px;
  background: rgba(0, 0, 0, 0.04);
  border-radius: 10px;
  border: 1px solid rgba(0, 0, 0, 0.06);
  cursor: pointer;
  transition: background 0.15s;
}
.lp-search:hover { background: rgba(0, 0, 0, 0.06); }
.lp-search-icon {
  flex-shrink: 0;
  opacity: 0.4;
}
.lp-search-input {
  flex: 1;
  border: none;
  background: transparent;
  font-size: 13px;
  color: var(--text-primary, #1a1a1a);
  outline: none;
  cursor: pointer;
}
.lp-search-input::placeholder {
  color: rgba(0, 0, 0, 0.35);
}

/* 新对话 + 临时会话 行 */
.lp-actions-row {
  display: flex;
  gap: 8px;
  padding: 10px 12px 6px;
}
.lp-action-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 0;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.8);
  font-size: 13px;
  color: var(--text-primary, #1a1a1a);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.lp-action-btn:hover {
  background: rgba(0, 0, 0, 0.04);
  border-color: rgba(0, 0, 0, 0.12);
}
.lp-action-btn svg {
  opacity: 0.6;
}

/* 可滚动主体 */
.lp-scroll {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 4px 0;
  scrollbar-width: thin;
  scrollbar-color: rgba(0,0,0,0.1) transparent;
}

/* 区块 */
.lp-section {
  padding: 4px 0;
}
.lp-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px 4px;
}
.lp-section-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: rgba(0, 0, 0, 0.4);
}
.lp-section-actions {
  display: flex;
  gap: 2px;
}
.lp-icon-btn {
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  border-radius: 6px;
  color: rgba(0, 0, 0, 0.4);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.lp-icon-btn:hover {
  background: rgba(0, 0, 0, 0.06);
  color: rgba(0, 0, 0, 0.7);
}

/* 折叠组件 */
.lp-collapsible .lp-collapse-content {
  overflow: hidden;
  max-height: 2000px;
  transition: max-height 0.25s ease;
}
.lp-collapsible.collapsed .lp-collapse-content {
  max-height: 0;
}

.lp-collapse-header {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  cursor: pointer;
  border-radius: 6px;
  margin: 0 6px;
  transition: background 0.15s;
  user-select: none;
}
.lp-collapse-header:hover {
  background: rgba(0, 0, 0, 0.04);
}
.lp-collapse-arrow {
  font-size: 11px;
  color: rgba(0, 0, 0, 0.35);
  width: 12px;
  text-align: center;
  flex-shrink: 0;
}

/* 项目/文档/对话 行 */
.lp-project-row {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary, #1a1a1a);
}
.lp-doc-row {
  font-size: 12.5px;
  color: rgba(0, 0, 0, 0.7);
  padding-left: 28px !important;
}
.lp-chat-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 14px 5px 44px;
  font-size: 12px;
  color: rgba(0, 0, 0, 0.55);
  cursor: pointer;
  border-radius: 6px;
  margin: 0 6px;
  transition: background 0.15s;
}
.lp-chat-row:hover {
  background: rgba(0, 0, 0, 0.04);
}
.lp-item-icon {
  flex-shrink: 0;
  opacity: 0.5;
}
.lp-item-text {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 归档区 */
.lp-archive-row {
  font-size: 12.5px;
  color: rgba(0, 0, 0, 0.45);
}

/* 分隔线 */
.lp-divider {
  height: 1px;
  margin: 4px 14px;
  background: rgba(0, 0, 0, 0.06);
}

/* 空状态 */
.lp-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px 16px;
  gap: 8px;
}
.lp-empty-title {
  font-size: 13px;
  font-weight: 500;
  color: rgba(0, 0, 0, 0.5);
}
.lp-empty-desc {
  font-size: 12px;
  color: rgba(0, 0, 0, 0.35);
  text-align: center;
  line-height: 1.4;
}
.lp-empty-hint {
  padding: 8px 14px 8px 32px;
  font-size: 12px;
  color: rgba(0, 0, 0, 0.35);
  font-style: italic;
}

/* 底部设置 */
.lp-footer {
  padding: 8px 12px;
  border-top: 1px solid rgba(0, 0, 0, 0.06);
}
.lp-footer-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 10px;
  border: none;
  background: transparent;
  border-radius: 8px;
  font-size: 13px;
  color: rgba(0, 0, 0, 0.55);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.lp-footer-btn:hover {
  background: rgba(0, 0, 0, 0.04);
  color: rgba(0, 0, 0, 0.75);
}
.lp-footer-btn svg {
  opacity: 0.5;
}

/* ========================================
   Bottom Sheet (三点菜单弹出面板)
   ======================================== */
.bottom-sheet-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.3);
  z-index: 9998;
  opacity: 0;
  transition: opacity 0.25s ease;
}

.bottom-sheet-overlay.visible {
  opacity: 1;
}

.bottom-sheet-overlay.hidden {
  display: none;
}

.bottom-sheet {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  background: var(--bg-glass, rgba(255, 255, 255, 0.85));
  backdrop-filter: blur(24px) saturate(200%);
  -webkit-backdrop-filter: blur(24px) saturate(200%);
  border-bottom-left-radius: 16px;
  border-bottom-right-radius: 16px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.12);
  transform: translateY(-100%);
  transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1);
  padding-top: env(safe-area-inset-top, 8px);
}

.bottom-sheet.visible {
  transform: translateY(0);
}

.bottom-sheet.hidden {
  display: none;
}

.bottom-sheet-handle {
  width: 36px;
  height: 4px;
  background: rgba(0, 0, 0, 0.15);
  border-radius: 2px;
  margin: 4px auto 8px;
  order: 1;
}

.bottom-sheet-items {
  padding: 8px 8px 4px;
  order: 0;
}

.sheet-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px 16px;
  border: none;
  background: transparent;
  border-radius: 10px;
  color: var(--text-primary);
  font-size: 14px;
  cursor: pointer;
  transition: background 0.15s ease;
  text-align: left;
}

.sheet-item:hover {
  background: rgba(0, 0, 0, 0.05);
}

.sheet-item:active {
  background: rgba(0, 0, 0, 0.08);
}

.sheet-item svg {
  flex-shrink: 0;
  color: var(--text-muted);
}

.sheet-item span:first-of-type {
  flex: 1;
}

.sheet-item-value {
  font-size: 12px;
  color: var(--text-muted);
  margin-left: auto;
}

.sheet-divider {
  height: 1px;
  background: rgba(0, 0, 0, 0.08);
  margin: 4px 16px;
}

/* Sheet toggle (临时会话开关) */
.sheet-toggle {
  width: 40px;
  height: 22px;
  border-radius: 11px;
  background: rgba(0, 0, 0, 0.12);
  position: relative;
  margin-left: auto;
  transition: background 0.2s ease;
  flex-shrink: 0;
}

.sheet-toggle.active {
  background: var(--accent-color, #3b82f6);
}

.sheet-toggle-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
  position: absolute;
  top: 2px;
  left: 2px;
  transition: transform 0.2s ease;
}

.sheet-toggle.active .sheet-toggle-thumb {
  transform: translateX(18px);
}
