/* ============================================
   COMPOSE PAGE - 极简编辑器风格
   沉浸式输入 · 优雅过渡 · 浮动工具栏
   ============================================ */

/* ---------- Compose Card ---------- */
#pageCompose {
  padding-bottom: 100px; /* 为浮动工具栏预留空间，避免遮挡内容 */
}

.compose-card {
  background: var(--bg-white);
  border-radius: var(--radius-lg);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04), 0 0 0 1px rgba(0, 0, 0, 0.02);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  animation: composeFadeIn 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

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

/* ---------- Meta Section (发件人/收件人) ---------- */
.compose-meta {
  position: relative;
  z-index: 30;
  border-bottom: 1px solid var(--border-light);
  animation: composeSlideDown 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes composeSlideDown {
  from {
    opacity: 0;
    max-height: 0;
  }
  to {
    opacity: 1;
    max-height: 300px;
  }
}

.compose-meta-row {
  display: flex;
  align-items: flex-start;
  padding: 10px 28px;
  gap: 12px;
  min-height: 40px;
  transition: background var(--transition-fast);
}

.compose-meta-row:hover {
  background: var(--gray-50);
}

.compose-meta-row + .compose-meta-row {
  border-top: 1px solid var(--border-light);
}

.compose-from-row {
  align-items: center;
}

.compose-meta-field {
  flex: 1;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

/* Field Labels - 沉浸式：轻量标签 */
.compose-field-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-tertiary);
  min-width: 48px;
  flex-shrink: 0;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  padding-top: 6px;
  transition: color var(--transition-fast);
}

.compose-meta-row:hover .compose-field-label,
.compose-meta-row:focus-within .compose-field-label {
  color: var(--primary);
}

/* From Select - 沉浸式（自定义下拉） */
.compose-from-row .compose-custom-select {
  flex: 1;
  min-width: 0;
}

.compose-smtp-hint {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--warning);
  width: 100%;
  margin-top: 4px;
  animation: hintSlideIn 0.3s ease-out;
}

@keyframes hintSlideIn {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.compose-smtp-hint svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

/* ---------- Chip Input - 沉浸式 ---------- */
.compose-chip-input-wrapper {
  flex: 1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  position: relative;
  min-height: 32px;
  padding: 2px 0;
}

.compose-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.compose-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px 3px 10px;
  background: var(--primary-light);
  color: var(--primary);
  border-radius: 14px;
  font-size: 12.5px;
  font-weight: 500;
  max-width: 260px;
  animation: chipIn 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  line-height: 1.4;
}

@keyframes chipIn {
  from {
    opacity: 0;
    transform: scale(0.85);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.compose-chip-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 120px;
}

.compose-chip-name-editable {
  cursor: text;
  border-radius: 8px;
  padding: 0 3px;
  transition: background var(--transition-fast);
}

.compose-chip-name-editable:hover {
  background: rgba(67, 97, 238, 0.15);
}

.compose-chip-name-empty {
  font-size: 11px;
  opacity: 0.6;
  font-weight: 400;
  max-width: none;
}

.compose-chip-name-raw {
  max-width: 160px;
}

.compose-chip-name-input {
  border: none;
  outline: none;
  background: var(--bg-white);
  font-size: 12px;
  font-family: var(--font-sans);
  font-weight: 500;
  color: var(--text);
  padding: 1px 4px;
  border-radius: 6px;
  width: 80px;
  min-width: 60px;
}

.compose-chip-email {
  color: var(--primary-hover);
  opacity: 0.7;
  font-size: 11.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 140px;
}

.compose-chip-remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border: none;
  background: none;
  cursor: pointer;
  border-radius: 50%;
  color: var(--primary);
  opacity: 0.4;
  transition: all var(--transition-fast);
  flex-shrink: 0;
  padding: 0;
}

.compose-chip-remove:hover {
  opacity: 1;
  background: rgba(67, 97, 238, 0.15);
}

.compose-chip-remove svg {
  width: 10px;
  height: 10px;
}

.compose-chip-input {
  border: none;
  outline: none;
  font-size: 13.5px;
  font-family: var(--font-sans);
  color: var(--text);
  background: transparent;
  min-width: 160px;
  flex: 1;
  padding: 4px 0;
}

.compose-chip-input::placeholder {
  color: var(--gray-400);
}

/* Contact dropdown */
.compose-contact-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  max-height: 240px;
  overflow-y: auto;
  z-index: 200;
  display: none;
  margin-top: 4px;
}

.compose-contact-dropdown.active {
  display: block;
  animation: dropdownReveal 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes dropdownReveal {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.compose-contact-dropdown .contact-dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  cursor: pointer;
  transition: background var(--transition-fast);
}

.compose-contact-dropdown .contact-dropdown-item:hover {
  background: var(--primary-subtle);
}

/* ---------- Meta Actions (收件人操作按钮) ---------- */
.compose-meta-actions {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
  padding-top: 2px;
}

.compose-icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border: none;
  background: none;
  cursor: pointer;
  border-radius: var(--radius-sm);
  color: var(--text-tertiary);
  transition: all var(--transition-fast);
  flex-shrink: 0;
}

.compose-icon-btn:hover {
  background: var(--gray-100);
  color: var(--primary);
}

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

.compose-toggle-cc.active {
  color: var(--primary);
  background: var(--primary-light);
}

/* CC/BCC rows - 优雅展开 */
.compose-cc-row {
  animation: ccReveal 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
}

@keyframes ccReveal {
  from {
    opacity: 0;
    max-height: 0;
    padding-top: 0;
    padding-bottom: 0;
  }
  to {
    opacity: 1;
    max-height: 80px;
  }
}

/* ---------- Subject Row - 沉浸式 ---------- */
.compose-subject-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 28px;
  border-bottom: 1px solid var(--border-light);
  animation: subjectFadeIn 0.5s cubic-bezier(0.4, 0, 0.2, 1) 0.1s both;
}

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

.compose-subject-input {
  flex: 1;
  border: none;
  outline: none;
  font-size: 20px;
  font-weight: 600;
  color: var(--text);
  font-family: var(--font-sans);
  letter-spacing: -0.02em;
  background: transparent;
  padding: 4px 0;
  transition: color var(--transition-fast);
}

.compose-subject-input::placeholder {
  color: var(--gray-300);
  font-weight: 400;
}

.compose-subject-input:focus {
  color: var(--text);
}

/* AI写信按钮 - 浮动工具栏中的强调样式 */
.compose-ai-trigger {
  border-color: rgba(67, 97, 238, 0.25);
  background: rgba(67, 97, 238, 0.06);
  color: var(--primary);
  font-weight: 600;
}

.compose-ai-trigger:hover {
  border-color: var(--primary);
  background: rgba(67, 97, 238, 0.12);
  color: var(--primary);
  box-shadow: 0 2px 10px rgba(67, 97, 238, 0.15);
}

.compose-ai-trigger svg {
  width: 18px;
  height: 18px;
}

/* ---------- Custom Select（发件人 / 模板 共用） ---------- */
.compose-custom-select {
  position: relative;
  display: inline-flex;
  align-items: center;
  min-width: 0;
}

.compose-cs-trigger {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-width: 0;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: none;
  font-family: var(--font-sans);
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text);
  text-align: left;
  cursor: pointer;
  padding: 5px 10px;
  outline: none;
  transition: all var(--transition-fast);
}

.compose-cs-trigger:hover {
  border-color: var(--border);
  background-color: var(--gray-50);
}

.compose-cs-trigger:focus,
.compose-custom-select.open .compose-cs-trigger {
  border-color: var(--primary);
  background-color: var(--bg-white);
  box-shadow: 0 0 0 3px rgba(67, 97, 238, 0.08);
}

.compose-cs-trigger-content {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
}

.compose-cs-placeholder {
  color: var(--text-tertiary);
  font-weight: 400;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 触发器内选中态展示（头像 + 标题 + 副标题） */
.compose-cs-trigger-avatar,
.compose-cs-trigger-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--primary-subtle);
  color: var(--primary);
}

.compose-cs-trigger-avatar svg,
.compose-cs-trigger-icon svg {
  width: 12px;
  height: 12px;
}

.compose-cs-trigger-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.25;
}

.compose-cs-trigger-title {
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.compose-cs-trigger-subtitle {
  font-size: 11.5px;
  color: var(--text-tertiary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.compose-cs-arrow {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  color: var(--text-tertiary);
  transition: transform var(--transition-fast), color var(--transition-fast);
}

.compose-custom-select.open .compose-cs-arrow {
  transform: rotate(180deg);
  color: var(--primary);
}

/* 下拉面板 */
.compose-cs-panel {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  min-width: 100%;
  width: max-content;
  max-width: 360px;
  max-height: 280px;
  overflow-y: auto;
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  z-index: 300;
  padding: 6px;
  display: none;
}

.compose-custom-select.open .compose-cs-panel {
  display: block;
  animation: composeCsReveal 0.18s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes composeCsReveal {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* 下拉项 */
.compose-cs-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--transition-fast);
}

.compose-cs-item:hover,
.compose-cs-item.active {
  background: var(--primary-subtle);
}

.compose-cs-item.selected {
  background: var(--primary-subtle);
}

.compose-cs-item.selected .compose-cs-item-title {
  color: var(--primary);
}

.compose-cs-item-avatar,
.compose-cs-item-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--primary-subtle);
  color: var(--primary);
}

.compose-cs-item-avatar svg,
.compose-cs-item-icon svg {
  width: 16px;
  height: 16px;
}

.compose-cs-item-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.compose-cs-item-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.compose-cs-item-subtitle {
  font-size: 11.5px;
  color: var(--text-tertiary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.compose-cs-item-badge {
  flex-shrink: 0;
  font-size: 10.5px;
  font-weight: 600;
  color: var(--primary);
  background: var(--primary-subtle);
  padding: 2px 7px;
  border-radius: 10px;
  letter-spacing: 0.02em;
}

.compose-cs-item-check {
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  color: var(--primary);
  opacity: 0;
}

.compose-cs-item.selected .compose-cs-item-check {
  opacity: 1;
}

/* 空状态 */
.compose-cs-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 20px 16px;
  text-align: center;
}

.compose-cs-empty svg {
  width: 28px;
  height: 28px;
  color: var(--text-tertiary);
  opacity: 0.6;
}

.compose-cs-empty-text {
  font-size: 12.5px;
  color: var(--text-tertiary);
  line-height: 1.5;
}

/* 内联变体（模板栏：极简，无边框） */
.compose-custom-select--inline {
  flex: 0 1 auto;
}

.compose-custom-select--inline .compose-cs-trigger {
  border-color: transparent;
  background: none;
  width: auto;
  padding: 4px 6px 4px 0;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
}

.compose-custom-select--inline .compose-cs-trigger-content {
  flex: 0 1 auto;
}

.compose-custom-select--inline .compose-cs-trigger-subtitle {
  display: none;
}

.compose-custom-select--inline .compose-cs-trigger:hover {
  border-color: transparent;
  background: none;
  color: var(--text);
}

.compose-custom-select--inline .compose-cs-trigger:focus,
.compose-custom-select--inline.open .compose-cs-trigger {
  border-color: transparent;
  background: none;
  box-shadow: none;
  color: var(--primary);
}

.compose-custom-select--inline .compose-cs-trigger-title {
  font-size: 13px;
  font-weight: 500;
  color: inherit;
}

.compose-custom-select--inline .compose-cs-trigger-avatar,
.compose-custom-select--inline .compose-cs-trigger-icon {
  width: 16px;
  height: 16px;
  background: transparent;
}

.compose-custom-select--inline .compose-cs-trigger-avatar svg,
.compose-custom-select--inline .compose-cs-trigger-icon svg {
  width: 13px;
  height: 13px;
}

/* ---------- Template Bar - 极简 ---------- */
.compose-template-bar {
  position: relative;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 28px;
  border-bottom: 1px solid var(--border-light);
  background: var(--gray-50);
  animation: barFadeIn 0.5s cubic-bezier(0.4, 0, 0.2, 1) 0.15s both;
}

@keyframes barFadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.compose-template-select {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
}

.compose-template-select-icon {
  width: 15px;
  height: 15px;
  color: var(--text-tertiary);
  flex-shrink: 0;
}

.compose-preview-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: none;
  background: none;
  cursor: pointer;
  border-radius: var(--radius-sm);
  color: var(--text-tertiary);
  transition: all var(--transition-fast);
}

.compose-preview-btn:hover:not(:disabled) {
  background: var(--gray-200);
  color: var(--primary);
}

.compose-preview-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.compose-preview-btn svg {
  width: 15px;
  height: 15px;
}

/* ---------- Template Variables ---------- */
.compose-template-vars {
  padding: 16px 28px;
  background: var(--bg-subtle);
  border-bottom: 1px solid var(--border-light);
  animation: varsReveal 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes varsReveal {
  from {
    opacity: 0;
    max-height: 0;
    padding-top: 0;
    padding-bottom: 0;
    overflow: hidden;
  }
  to {
    opacity: 1;
    max-height: 400px;
  }
}

.compose-template-vars-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-tertiary);
  margin-bottom: 14px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.compose-template-vars-header svg {
  width: 14px;
  height: 14px;
  color: var(--primary);
}

.compose-template-vars .var-field {
  margin-bottom: 12px;
}

.compose-template-vars .var-field:last-child {
  margin-bottom: 0;
}

.compose-template-vars .var-field label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--primary);
  margin-bottom: 4px;
  font-family: var(--font-mono);
}

.compose-template-vars .var-field .form-control {
  background: var(--bg-white);
}

.compose-template-vars .var-auto-hint {
  font-size: 12.5px;
  color: var(--text-secondary);
  padding: 8px 12px;
  background: var(--bg-white);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-light);
}

/* ---------- Editor Area - 沉浸式 ---------- */
.compose-editor-area {
  flex: 1;
  min-height: 400px;
  display: flex;
  flex-direction: column;
  animation: editorFadeIn 0.6s cubic-bezier(0.4, 0, 0.2, 1) 0.2s both;
}

@keyframes editorFadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* ---------- HTML 代码编辑器工具栏 ---------- */
.compose-editor-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 20px;
  border-bottom: 1px solid var(--border-light);
  background: var(--bg-white);
  position: sticky;
  top: 0;
  z-index: 10;
}

.compose-editor-toolbar-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.compose-editor-toolbar-icon {
  width: 18px;
  height: 18px;
  color: var(--primary);
}

.compose-editor-toolbar-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  letter-spacing: 0.02em;
}

.compose-editor-preview-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 500;
  color: var(--primary);
  background: var(--primary-subtle);
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.18s ease;
}

.compose-editor-preview-btn:hover {
  background: var(--primary-light);
  border-color: var(--primary);
}

.compose-editor-preview-btn svg {
  width: 16px;
  height: 16px;
}

/* ---------- CodeMirror 容器 ---------- */
.compose-codemirror-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.compose-codemirror-wrap .CodeMirror {
  flex: 1;
  height: 100%;
  min-height: 380px;
  font-family: var(--font-mono);
  font-size: 13.5px;
  line-height: 1.7;
  background: var(--bg-white);
  color: var(--text);
}

.compose-codemirror-wrap .CodeMirror-gutters {
  background: var(--gray-50);
  border-right: 1px solid var(--border-light);
}

.compose-codemirror-wrap .CodeMirror-linenumber {
  color: var(--text-tertiary);
  padding: 0 8px;
}

.compose-codemirror-wrap .CodeMirror-cursor {
  border-left: 2px solid var(--primary);
}

.compose-codemirror-wrap .CodeMirror-selected {
  background: var(--primary-light);
}

.compose-codemirror-wrap .CodeMirror-focused .CodeMirror-selected {
  background: var(--primary-light);
}

.compose-codemirror-wrap .CodeMirror-activeline-background {
  background: var(--gray-50);
}

.compose-codemirror-wrap .CodeMirror-foldmarker {
  color: var(--primary);
  background: var(--primary-subtle);
  border-radius: 3px;
  padding: 0 4px;
  margin: 0 2px;
}

/* CodeMirror 占位符样式 */
.compose-codemirror-wrap .CodeMirror-empty {
  color: var(--gray-300);
}

.compose-codemirror-wrap .CodeMirror-placeholder {
  color: var(--gray-300);
  font-style: normal;
}

/* ---------- 编辑器下方操作区（附件列表 + 发送方式） ---------- */
.compose-editor-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border-light);
  background: var(--bg-white);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.compose-send-mode-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

/* 编辑器下方区域的附件列表样式（覆盖浮动栏内的紧凑样式） */
.compose-editor-footer .compose-attachment-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.compose-editor-footer .compose-attachment-list:empty {
  display: none;
}

.compose-editor-footer .compose-attachment-list .attachment-item {
  margin-bottom: 0;
}

/* ---------- Floating Bottom Bar ---------- */
.compose-floating-bar {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  animation: floatingBarIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) 0.4s both;
}

@keyframes floatingBarIn {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

.compose-floating-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 20px;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-radius: 16px;
  box-shadow:
    0 4px 24px rgba(0, 0, 0, 0.08),
    0 0 0 1px rgba(0, 0, 0, 0.04),
    0 1px 2px rgba(0, 0, 0, 0.04);
  min-width: 560px;
  max-width: 800px;
  transition: box-shadow var(--transition-fast);
}

.compose-floating-inner:hover {
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.1),
    0 0 0 1px rgba(0, 0, 0, 0.05),
    0 1px 2px rgba(0, 0, 0, 0.04);
}

.compose-floating-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 0;
}

.compose-floating-right {
  flex-shrink: 0;
}

.compose-floating-divider {
  width: 1px;
  height: 20px;
  background: var(--border);
  flex-shrink: 0;
}

/* Floating attachment area */
.compose-attachment-area {
  display: flex;
  align-items: center;
  gap: 8px;
}

.compose-floating-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-white);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
  font-family: var(--font-sans);
  white-space: nowrap;
}

.compose-floating-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-light);
}

.compose-floating-btn svg {
  width: 14px;
  height: 14px;
}

.compose-attachment-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.compose-attachment-list .attachment-item {
  margin-bottom: 0;
  padding: 4px 10px;
  border-radius: 14px;
  gap: 6px;
  font-size: 12px;
}

.compose-attachment-list .attachment-item-icon {
  width: 22px;
  height: 22px;
  border-radius: 50%;
}

.compose-attachment-list .attachment-item-icon svg {
  width: 12px;
  height: 12px;
}

.compose-attachment-list .attachment-item-info {
  display: flex;
  align-items: center;
  gap: 6px;
}

.compose-attachment-list .attachment-item-name {
  font-size: 12px;
  max-width: 120px;
}

.compose-attachment-list .attachment-item-size {
  font-size: 11px;
  margin-top: 0;
}

.compose-attachment-list .attachment-item-remove {
  width: 18px;
  height: 18px;
}

.compose-attachment-list .attachment-item-remove svg {
  width: 10px;
  height: 10px;
}

/* Send mode in floating bar */
.compose-send-mode {
  display: flex;
  align-items: center;
  gap: 10px;
}

.compose-radio-label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 500;
  transition: color var(--transition-fast);
}

.compose-radio-label:hover {
  color: var(--text);
}

.compose-radio-label input[type="radio"] {
  accent-color: var(--primary);
  width: 14px;
  height: 14px;
  cursor: pointer;
}

.compose-scheduled-row {
  display: flex;
  align-items: center;
  gap: 6px;
  animation: ccReveal 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.compose-scheduled-row svg {
  width: 14px;
  height: 14px;
  color: var(--primary);
  flex-shrink: 0;
}

.compose-scheduled-input {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 4px 8px;
  font-size: 12px;
  font-family: var(--font-sans);
  color: var(--text);
  outline: none;
  transition: border-color var(--transition-fast);
  background: var(--bg-white);
}

.compose-scheduled-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(67, 97, 238, 0.08);
}

/* Send button - 极简浮动风格 */
.compose-send-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 24px;
  border-radius: 12px;
  background: var(--primary);
  color: var(--text-inverse);
  font-size: 13px;
  font-weight: 600;
  font-family: var(--font-sans);
  border: none;
  cursor: pointer;
  transition: all var(--transition-fast);
  letter-spacing: 0.01em;
  white-space: nowrap;
}

.compose-send-btn:hover {
  background: var(--primary-hover);
  box-shadow: 0 4px 12px rgba(67, 97, 238, 0.3);
  transform: translateY(-1px);
}

.compose-send-btn:active {
  transform: translateY(0);
}

.compose-send-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.compose-send-btn svg {
  width: 15px;
  height: 15px;
}

/* ============================================
   COMPOSE TOAST - 玻璃态胶囊通知
   固定视口顶部居中，毛玻璃 + 大圆角胶囊 + 弹性滑入
   滚动时始终可见，支持纵向堆叠、自动消失、手动关闭
   ============================================ */
.compose-toast-container {
  position: fixed;
  top: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  pointer-events: none;
  max-width: calc(100vw - 40px);
}

.compose-toast {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 8px 8px 8px 10px;
  border-radius: 999px;
  font-size: 13.5px;
  font-weight: 500;
  letter-spacing: -0.005em;
  color: var(--text);
  background: rgba(255, 255, 255, 0.72);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  backdrop-filter: blur(20px) saturate(180%);
  box-shadow:
    0 10px 30px -8px rgba(15, 23, 42, 0.22),
    0 4px 10px -4px rgba(15, 23, 42, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.85);
  animation: composeToastIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
  min-width: 240px;
  max-width: 460px;
  box-sizing: border-box;
}

.compose-toast.compose-toast-closing {
  animation: composeToastOut 0.32s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

/* 语义色通过边框 + 图标徽章表达，玻璃底保持纯净 */
.compose-toast-success {
  border: 1px solid rgba(16, 185, 129, 0.32);
}

.compose-toast-error {
  border: 1px solid rgba(239, 68, 68, 0.32);
}

.compose-toast-info {
  border: 1px solid rgba(59, 130, 246, 0.32);
}

/* 图标徽章：低透明度语义色圆 + 语义色图标 */
.compose-toast-icon-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  flex-shrink: 0;
}

.compose-toast-success .compose-toast-icon-wrap {
  background: rgba(16, 185, 129, 0.14);
  color: #059669;
}

.compose-toast-error .compose-toast-icon-wrap {
  background: rgba(239, 68, 68, 0.14);
  color: #dc2626;
}

.compose-toast-info .compose-toast-icon-wrap {
  background: rgba(59, 130, 246, 0.14);
  color: #2563eb;
}

.compose-toast .compose-toast-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.compose-toast .compose-toast-msg {
  flex: 1;
  line-height: 1.4;
  padding-right: 2px;
}

.compose-toast-close {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-tertiary);
  flex-shrink: 0;
  transition: background 0.2s ease, color 0.2s ease;
}

.compose-toast-close:hover {
  background: rgba(15, 23, 42, 0.06);
  color: var(--text-secondary);
}

.compose-toast-close svg {
  width: 13px;
  height: 13px;
}

@keyframes composeToastIn {
  from {
    opacity: 0;
    transform: translateY(-26px) scale(0.9);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes composeToastOut {
  from {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
  to {
    opacity: 0;
    transform: translateY(-14px) scale(0.96);
  }
}

/* 移动端：缩小内边距与字号，避免胶囊过宽 */
@media (max-width: 480px) {
  .compose-toast {
    min-width: 0;
    max-width: calc(100vw - 32px);
    font-size: 13px;
    padding: 7px 7px 7px 9px;
    gap: 9px;
  }
  .compose-toast-icon-wrap {
    width: 26px;
    height: 26px;
  }
}

/* ============================================
   TEMPLATE PREVIEW - 模板预览容器
   ============================================ */
.template-preview-container {
  width: 100%;
  min-height: 400px;
}

.template-preview-container iframe {
  width: 100%;
  min-height: 400px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: #fff;
}

/* ============================================
   EMAIL INPUT WITH PICKER - 收件人输入
   ============================================ */
.email-input-with-picker {
  display: flex;
  gap: 8px;
  align-items: flex-start;
}

.email-input-wrapper {
  flex: 1;
  position: relative;
}

.email-input-with-picker .btn {
  flex-shrink: 0;
  margin-top: 1px;
}

/* 下拉搜索匹配 */
.contact-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  max-height: 240px;
  overflow-y: auto;
  z-index: 200;
  display: none;
  margin-top: 4px;
}

.contact-dropdown.active {
  display: block;
  animation: dropdownReveal 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.contact-dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  cursor: pointer;
  transition: background var(--transition-fast);
}

.contact-dropdown-item:hover {
  background: var(--primary-subtle);
}

.contact-dropdown-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--primary-light);
  color: var(--primary);
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
}

.contact-dropdown-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.contact-dropdown-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.contact-dropdown-email {
  font-size: 11.5px;
  color: var(--text-tertiary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ============================================
   CONTACT PICKER MODAL - 通讯录选择弹窗
   ============================================ */
.picker-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.picker-search-box {
  position: relative;
  display: flex;
  align-items: center;
  flex: 1;
}

.picker-search-box svg {
  position: absolute;
  left: 12px;
  width: 16px;
  height: 16px;
  color: var(--text-tertiary);
  pointer-events: none;
}

.picker-search-box .form-control {
  padding-left: 36px;
}

.picker-groups-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 14px;
}

.picker-group-tag {
  padding: 4px 12px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: var(--bg-white);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
  font-family: var(--font-sans);
}

.picker-group-tag:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.picker-group-tag.active {
  background: var(--primary-light);
  border-color: var(--primary);
  color: var(--primary);
  font-weight: 600;
}

.picker-contact-list {
  max-height: 360px;
  overflow-y: auto;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
}

.picker-contact-item {
  border-bottom: 1px solid var(--border-light);
}

.picker-contact-item:last-child {
  border-bottom: none;
}

.picker-contact-label {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  cursor: pointer;
  transition: background var(--transition-fast);
}

.picker-contact-label:hover {
  background: var(--gray-50);
}

.picker-contact-checkbox {
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
  cursor: pointer;
  flex-shrink: 0;
}

/* ============================================
   ATTACHMENTS - 附件上传
   ============================================ */
.attachment-upload-area {
  display: flex;
  align-items: center;
  gap: 12px;
}

.attachment-hint {
  font-size: 12px;
  color: var(--text-tertiary);
}

.attachment-list {
  margin-top: 8px;
}

.attachment-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  margin-bottom: 6px;
  background: var(--bg-white);
  transition: all var(--transition-fast);
}

.attachment-item:hover {
  border-color: var(--gray-300);
  box-shadow: var(--shadow-xs);
}

.attachment-item-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-xs);
  background: var(--primary-light);
  color: var(--primary);
  flex-shrink: 0;
}

.attachment-item-icon svg {
  width: 16px;
  height: 16px;
}

.attachment-item-info {
  flex: 1;
  min-width: 0;
}

.attachment-item-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.attachment-item-size {
  font-size: 11.5px;
  color: var(--text-tertiary);
  margin-top: 1px;
}

.attachment-item-remove {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border: none;
  background: none;
  cursor: pointer;
  border-radius: var(--radius-xs);
  color: var(--text-tertiary);
  transition: all var(--transition-fast);
  flex-shrink: 0;
}

.attachment-item-remove:hover {
  background: var(--danger-light);
  color: var(--danger);
}

.attachment-item-remove svg {
  width: 14px;
  height: 14px;
}

/* 小型空状态 */
.empty-state-sm {
  text-align: center;
  padding: 24px 16px;
  color: var(--text-tertiary);
  font-size: 13px;
}

/* ============================================
   AI WRITING ASSISTANT - 底部抽屉式（毛玻璃风格）
   ============================================ */

/* ---------- Modal Shell ---------- */
.ai-modal {
  position: fixed;
  inset: 0;
  z-index: 500;
  pointer-events: none;
  visibility: hidden;
  transition: visibility 0s 0.4s;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0;
}

.ai-modal.active {
  visibility: visible;
  pointer-events: auto;
  transition: visibility 0s 0s;
}

/* Backdrop */
.ai-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0);
  transition: background 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.ai-modal.active .ai-modal-backdrop {
  background: rgba(15, 23, 42, 0.32);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

/* Modal Body - 底部抽屉毛玻璃主体 */
.ai-modal-body {
  position: relative;
  width: 100%;
  max-width: 900px;
  height: 70vh;
  max-height: 90vh;
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.88) 0%,
    rgba(255, 255, 255, 0.78) 100%
  );
  backdrop-filter: blur(40px) saturate(180%) contrast(1.05);
  -webkit-backdrop-filter: blur(40px) saturate(180%) contrast(1.05);
  border-radius: 24px 24px 0 0;
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-bottom: none;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.7),
    0 -24px 80px rgba(15, 23, 42, 0.16),
    0 -8px 24px rgba(15, 23, 42, 0.06);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: translateY(100%);
  opacity: 0;
  transition:
    transform 0.45s cubic-bezier(0.32, 0.72, 0, 1),
    opacity 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  will-change: transform;
}

.ai-modal.active .ai-modal-body {
  transform: translateY(0);
  opacity: 1;
}

.ai-modal-body.dragging {
  transition: none;
}

/* Inner refraction highlight */
.ai-modal-body::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: inherit;
  background:
    radial-gradient(ellipse 80% 50% at 50% 0%, rgba(255, 255, 255, 0.5), transparent 70%),
    linear-gradient(90deg, rgba(255, 255, 255, 0.15), transparent 40%, rgba(255, 255, 255, 0.08));
  pointer-events: none;
}

/* Inner border for depth */
.ai-modal-body::after {
  content: "";
  position: absolute;
  inset: 1px 1px 0 1px;
  border-radius: inherit;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-bottom: none;
  pointer-events: none;
}

/* Reduced transparency fallback */
@media (prefers-reduced-transparency: reduce) {
  .ai-modal-body {
    background: rgba(255, 255, 255, 0.97);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }
}

/* ---------- Drag Handle ---------- */
.ai-drawer-handle {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px 0 6px;
  flex-shrink: 0;
  cursor: ns-resize;
  position: relative;
  z-index: 2;
  touch-action: none;
}

.ai-drawer-handle:active {
  cursor: ns-resize;
}

.ai-drawer-handle-bar {
  width: 36px;
  height: 4px;
  border-radius: 2px;
  background: rgba(15, 23, 42, 0.18);
  transition: background var(--transition-fast), width var(--transition-fast);
}

.ai-drawer-handle:hover .ai-drawer-handle-bar {
  background: rgba(67, 97, 238, 0.35);
  width: 42px;
}

/* ---------- Header ---------- */
.ai-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 22px 14px;
  flex-shrink: 0;
  position: relative;
  z-index: 10;
}

.ai-modal-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.ai-modal-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: transparent;
  flex-shrink: 0;
}

.ai-modal-logo svg {
  width: 28px;
  height: 28px;
}

.ai-modal-title h3 {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  margin: 0;
  letter-spacing: -0.01em;
}

.ai-modal-status {
  display: inline-flex;
  align-items: center;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-tertiary);
  margin-top: 1px;
  letter-spacing: 0.02em;
  gap: 5px;
}

.ai-modal-status::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #10b981;
  flex-shrink: 0;
  animation: statusPulse 2s ease-in-out infinite;
}

@keyframes statusPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.ai-modal-header-actions {
  display: flex;
  align-items: center;
  gap: 2px;
  position: relative;
}

.ai-modal-action-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: none;
  background: none;
  cursor: pointer;
  border-radius: 8px;
  color: var(--text-tertiary);
  transition: all var(--transition-fast);
}

.ai-modal-action-btn:hover {
  background: rgba(67, 97, 238, 0.08);
  color: var(--primary);
}

.ai-modal-action-btn svg {
  width: 16px;
  height: 16px;
}

/* ---------- 个人知识库开关 ---------- */
.ai-kb-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 10px 0 8px;
  border-radius: 8px;
  cursor: pointer;
  user-select: none;
  color: var(--text-tertiary);
  background: rgba(0, 0, 0, 0.03);
  border: 1px solid var(--border-light);
  transition: all var(--transition-fast);
  outline: none;
}

.ai-kb-toggle:hover {
  background: rgba(67, 97, 238, 0.06);
  color: var(--primary);
  border-color: rgba(67, 97, 238, 0.2);
}

.ai-kb-toggle:focus-visible {
  box-shadow: 0 0 0 2px rgba(67, 97, 238, 0.25);
}

.ai-kb-toggle-icon {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.ai-kb-toggle-label {
  font-size: 12px;
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
}

.ai-kb-toggle-switch {
  position: relative;
  width: 26px;
  height: 14px;
  border-radius: 8px;
  background: #d4d6db;
  flex-shrink: 0;
  transition: background var(--transition-fast);
}

.ai-kb-toggle-knob {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
  transition: transform var(--transition-fast);
}

/* 开启状态 */
.ai-kb-toggle.active {
  color: var(--primary);
  background: rgba(67, 97, 238, 0.08);
  border-color: rgba(67, 97, 238, 0.25);
}

.ai-kb-toggle.active .ai-kb-toggle-switch {
  background: var(--primary);
}

.ai-kb-toggle.active .ai-kb-toggle-knob {
  transform: translateX(12px);
}

/* ---------- Messages ---------- */
.ai-modal-messages {
  flex: 1;
  overflow-y: auto;
  padding: 0 22px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 0;
  position: relative;
  z-index: 1;
}

.ai-modal-messages::-webkit-scrollbar {
  width: 4px;
}

.ai-modal-messages::-webkit-scrollbar-track {
  background: transparent;
}

.ai-modal-messages::-webkit-scrollbar-thumb {
  background: rgba(67, 97, 238, 0.15);
  border-radius: 2px;
}

/* ---------- Welcome Page ---------- */
.ai-chat-welcome {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 48px 24px 32px;
  flex: 1;
  animation: welcomeFadeIn 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

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

/* Welcome Icon - 优化毛玻璃圆形 */
.ai-welcome-visual {
  margin-bottom: 24px;
}

.ai-welcome-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border-radius: 18px;
  background: transparent;
  position: relative;
}

.ai-welcome-icon::after {
  content: none;
}

.ai-welcome-icon svg {
  width: 44px;
  height: 44px;
}

.ai-welcome-title {
  font-size: 19px;
  font-weight: 650;
  color: var(--text);
  margin: 0 0 8px;
  letter-spacing: -0.02em;
  line-height: 1.3;
}

.ai-welcome-desc {
  font-size: 13.5px;
  color: var(--text-tertiary);
  margin: 0;
  line-height: 1.6;
  max-width: 320px;
}

/* ---------- Chat Messages ---------- */
.ai-chat-msg {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  animation: msgSlideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

/* 用户消息右对齐，头像在最右侧 */
.ai-chat-msg-user {
  flex-direction: row-reverse;
  justify-content: flex-start;
}

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

/* 头像 - 优化尺寸和样式 */
.ai-chat-msg-avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 2px;
}

.ai-chat-msg-user .ai-chat-msg-avatar {
  background: transparent;
  border: none;
  color: var(--text-tertiary);
}

.ai-chat-msg-assistant .ai-chat-msg-avatar {
  background: transparent;
  border: none;
}

.ai-chat-msg-avatar svg {
  width: 22px;
  height: 22px;
}

/* 消息内容容器 - 最大宽度80%，动态收缩 */
.ai-chat-msg-content {
  min-width: 0;
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--text);
  word-break: break-word;
  overflow-wrap: break-word;
}

/* 用户消息气泡容器 - 右对齐，最大宽度80% */
.ai-chat-msg-user .ai-chat-msg-bubble {
  max-width: 80%;
}

/* 用户消息内层文字 - 自适应宽度 */
.ai-chat-msg-user .ai-chat-msg-content {
  display: inline-block;
  width: auto;
}

/* AI消息卡片 - 无气泡，全宽展示，细边框区分 */
.ai-chat-msg-assistant .ai-chat-msg-content {
  width: 100%;
  background: var(--bg-elevated);
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-xs);
}

/* 问题卡片独立消息块 - 无外层包裹，问题卡片直接渲染 */
.ai-chat-msg-question .ai-question-cards {
  width: 100%;
}

/* 用户消息气泡 - 主色调淡背景，统一圆角 */
.ai-chat-msg-user .ai-chat-msg-content {
  background: rgba(67, 97, 238, 0.08);
  padding: 10px 14px;
  border-radius: 14px;
  border: 1px solid rgba(67, 97, 238, 0.1);
}

.ai-parsed-field {
  margin-bottom: 6px;
  font-size: 13px;
  line-height: 1.5;
}

.ai-parsed-label {
  font-weight: 600;
  color: var(--text-tertiary);
  font-size: 12px;
}

.ai-parsed-body-preview {
  max-height: 200px;
  overflow-y: auto;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.5);
  border: 1px solid rgba(67, 97, 238, 0.08);
  border-radius: 10px;
  font-size: 13px;
  line-height: 1.7;
  color: var(--text);
  word-break: break-word;
  margin-bottom: 4px;
}

.ai-parsed-body-preview::-webkit-scrollbar {
  width: 3px;
}

.ai-parsed-body-preview::-webkit-scrollbar-track {
  background: transparent;
}

.ai-parsed-body-preview::-webkit-scrollbar-thumb {
  background: rgba(67, 97, 238, 0.15);
  border-radius: 2px;
}

.ai-apply-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-top: 10px;
  padding: 7px 16px;
  border: none;
  border-radius: 10px;
  background: var(--primary);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  font-family: var(--font-sans);
  cursor: pointer;
  transition: all var(--transition-fast);
  box-shadow: 0 2px 8px rgba(67, 97, 238, 0.2);
}

.ai-apply-btn:hover {
  background: var(--primary-hover);
  box-shadow: 0 4px 14px rgba(67, 97, 238, 0.3);
  transform: translateY(-1px);
}

.ai-apply-btn:active {
  transform: translateY(0);
}

.ai-apply-btn svg {
  width: 14px;
  height: 14px;
}

/* ---------- Input Area ---------- */

/* ---------- Thinking Block ---------- */
.ai-thinking-block {
  margin-bottom: 10px;
  border-radius: 10px;
  border: 1px solid rgba(67, 97, 238, 0.1);
  background: rgba(67, 97, 238, 0.03);
  overflow: hidden;
}

.ai-thinking-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  padding: 8px 12px;
  border: none;
  background: none;
  cursor: pointer;
  color: var(--text-tertiary);
  font-size: 12px;
  font-weight: 500;
  font-family: var(--font-sans);
  transition: all var(--transition-fast);
}

.ai-thinking-toggle:hover {
  color: var(--primary);
  background: rgba(67, 97, 238, 0.04);
}

.ai-thinking-toggle svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.ai-thinking-toggle .ai-thinking-chevron {
  margin-left: auto;
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.ai-thinking-block.expanded .ai-thinking-chevron {
  transform: rotate(180deg);
}

.ai-thinking-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s cubic-bezier(0.16, 1, 0.3, 1), padding 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  padding: 0 12px;
  font-size: 12.5px;
  line-height: 1.6;
  color: var(--text-tertiary);
}

.ai-thinking-block.expanded .ai-thinking-content {
  max-height: 300px;
  overflow-y: auto;
  padding: 0 12px 10px;
}

.ai-thinking-content::-webkit-scrollbar {
  width: 3px;
}

.ai-thinking-content::-webkit-scrollbar-track {
  background: transparent;
}

.ai-thinking-content::-webkit-scrollbar-thumb {
  background: rgba(67, 97, 238, 0.12);
  border-radius: 2px;
}

/* Thinking streaming state */
.ai-thinking-block.streaming .ai-thinking-toggle span {
  color: var(--primary);
  animation: thinkingPulse 1.5s ease-in-out infinite;
}

@keyframes thinkingPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* AI对话引导语 - 显示在思考过程下方，始终可见 */
.ai-chat-intro-text {
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--text);
  padding: 10px 0 0;
  margin-top: 10px;
}

/* Streaming indicator (dots) */
.ai-streaming-indicator {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 8px 0;
}

.ai-streaming-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--primary);
  opacity: 0.3;
  animation: streamingDot 1.4s ease-in-out infinite;
}

.ai-streaming-dot:nth-child(2) {
  animation-delay: 0.2s;
}

.ai-streaming-dot:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes streamingDot {
  0%, 80%, 100% { opacity: 0.3; transform: scale(1); }
  40% { opacity: 1; transform: scale(1.2); }
}

/* Streaming text */
.ai-streaming-text {
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
}
.ai-modal-input-area {
  padding: 12px 22px 18px;
  border-top: 1px solid rgba(67, 97, 238, 0.06);
  flex-shrink: 0;
  position: relative;
  z-index: 1;
}

/* 输入行：胶囊容器 + 悬浮发送按钮 */
.ai-modal-input-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* 胶囊形容器 */
.ai-modal-input-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
  border: 1px solid rgba(67, 97, 238, 0.12);
  border-radius: 999px;
  padding: 8px 16px 8px 10px;
  background: rgba(255, 255, 255, 0.55);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.ai-modal-input-wrapper:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(67, 97, 238, 0.1);
  background: rgba(255, 255, 255, 0.75);
}

.ai-chat-input {
  flex: 1;
  border: none;
  outline: none;
  font-size: 13.5px;
  font-family: var(--font-sans);
  color: var(--text);
  resize: none;
  line-height: 1.5;
  max-height: 120px;
  background: transparent;
  padding: 4px 0;
}

.ai-chat-input::placeholder {
  color: var(--gray-400);
}

.ai-modal-attach-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border: none;
  background: none;
  cursor: pointer;
  color: var(--text-tertiary);
  border-radius: 50%;
  flex-shrink: 0;
  transition: all var(--transition-fast);
}

.ai-modal-attach-btn:hover {
  color: var(--primary);
  background: rgba(67, 97, 238, 0.08);
}

.ai-modal-attach-btn svg {
  width: 16px;
  height: 16px;
}

/* 圆形悬浮发送按钮 */
.ai-modal-send-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border: none;
  background: var(--primary);
  color: #fff;
  border-radius: 50%;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 14px rgba(67, 97, 238, 0.3);
}

.ai-modal-send-btn:hover {
  background: var(--primary-hover);
  box-shadow: 0 6px 20px rgba(67, 97, 238, 0.4);
  transform: scale(1.06);
}

.ai-modal-send-btn:active {
  transform: scale(0.94);
}

.ai-modal-send-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.ai-modal-send-btn.loading {
  opacity: 0.5;
  pointer-events: none;
}

.ai-modal-send-btn svg {
  width: 15px;
  height: 15px;
  transform: translateX(1px);
}

/* ---------- Pending Files ---------- */
.ai-chat-pending-files {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 0 10px 0;
}

.ai-chat-pending-files.hidden {
  display: none;
}

.ai-pending-file-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  background: rgba(255, 255, 255, 0.6);
  border: 1px solid rgba(67, 97, 238, 0.1);
  border-radius: 8px;
  max-width: 180px;
}

.ai-pending-file-preview {
  width: 28px;
  height: 28px;
  border-radius: 4px;
  overflow: hidden;
  flex-shrink: 0;
}

.ai-pending-file-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.ai-pending-file-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--primary-light);
  color: var(--primary);
}

.ai-pending-file-icon svg {
  width: 16px;
  height: 16px;
}

.ai-pending-file-name {
  font-size: 12px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  min-width: 0;
}

/* ---------- 文件名悬浮提示气泡 ---------- */
.filename-tooltip {
  position: fixed;
  z-index: 9999;
  max-width: 320px;
  padding: 8px 12px;
  background: var(--gray-800);
  color: #fff;
  font-size: 12.5px;
  font-weight: 500;
  line-height: 1.5;
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
  word-break: break-all;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.15s ease-out, visibility 0.15s ease-out;
}

.filename-tooltip.show {
  opacity: 1;
  visibility: visible;
}

/* 气泡小箭头 */
.filename-tooltip::before {
  content: '';
  position: absolute;
  top: -5px;
  left: var(--arrow-left, 16px);
  width: 0;
  height: 0;
  border: 5px solid transparent;
  border-top: 0;
  border-bottom-color: var(--gray-800);
}

.ai-pending-file-remove {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border: none;
  background: none;
  cursor: pointer;
  color: var(--text-tertiary);
  border-radius: 50%;
  flex-shrink: 0;
  transition: all var(--transition-fast);
}

.ai-pending-file-remove:hover {
  background: rgba(239, 68, 68, 0.1);
  color: #ef4444;
}

.ai-pending-file-remove svg {
  width: 12px;
  height: 12px;
}

/* ---------- Message Files ---------- */
.ai-chat-msg-bubble {
  min-width: 0;
}

.ai-chat-msg-files {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.ai-chat-file-item {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  background: rgba(255, 255, 255, 0.5);
  border: 1px solid rgba(67, 97, 238, 0.1);
  border-radius: 8px;
  font-size: 12px;
}

.ai-chat-file-image {
  flex-direction: column;
  padding: 4px;
}

.ai-chat-file-image img {
  width: 80px;
  height: 60px;
  object-fit: cover;
  border-radius: 6px;
}

.ai-chat-file-doc svg {
  width: 14px;
  height: 14px;
  color: var(--primary);
  flex-shrink: 0;
}

.ai-chat-file-name {
  font-size: 11px;
  color: var(--text-tertiary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100px;
}

.ai-add-attachment-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 8px;
  padding: 4px 10px;
  border: 1px dashed rgba(67, 97, 238, 0.25);
  border-radius: 999px;
  background: none;
  color: var(--text-tertiary);
  font-size: 11px;
  font-family: var(--font-sans);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.ai-add-attachment-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: rgba(67, 97, 238, 0.04);
}

.ai-add-attachment-btn svg {
  width: 12px;
  height: 12px;
}

/* ---------- Question Cards (多问题分组卡片 - 分步骤) ---------- */

/* 卡片包裹层 - 控制显示/隐藏 */
.ai-question-card-wrapper.hidden {
  display: none;
}

/* 折叠摘要 */
.ai-question-summary {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border: 1px solid rgba(67, 97, 238, 0.1);
  border-radius: 10px;
  background: rgba(67, 97, 238, 0.03);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  margin-bottom: 6px;
}

.ai-question-summary.hidden {
  display: none;
}

.ai-question-summary:hover {
  border-color: rgba(67, 97, 238, 0.25);
  background: rgba(67, 97, 238, 0.06);
}

.ai-question-summary-check {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: rgba(67, 97, 238, 0.15);
  color: var(--primary);
  flex-shrink: 0;
}

.ai-question-summary-check svg {
  width: 11px;
  height: 11px;
}

.ai-question-summary-text {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.ai-question-summary-title {
  font-size: 12px;
  color: var(--text-tertiary);
  line-height: 1.3;
}

.ai-question-summary-answer {
  font-size: 12.5px;
  color: var(--text-secondary);
  font-weight: 500;
  line-height: 1.4;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ai-question-summary-answer.has-answer {
  color: var(--text);
}

.ai-question-summary-arrow {
  width: 14px;
  height: 14px;
  color: var(--text-tertiary);
  flex-shrink: 0;
  transition: transform 0.2s;
}

.ai-question-summary:hover .ai-question-summary-arrow {
  color: var(--primary);
}

/* 步骤导航栏 */
.ai-question-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 4px;
  padding-top: 10px;
  border-top: 1px solid rgba(67, 97, 238, 0.08);
}

.ai-question-progress {
  font-size: 12px;
  color: var(--text-tertiary);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.ai-question-nav-btns {
  display: flex;
  gap: 6px;
}

/* 上一个按钮 */
.ai-question-prev-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 14px;
  border: 1px solid rgba(67, 97, 238, 0.15);
  border-radius: 999px;
  background: transparent;
  color: var(--text-secondary);
  font-size: 12.5px;
  font-weight: 500;
  font-family: var(--font-sans);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.ai-question-prev-btn svg {
  width: 14px;
  height: 14px;
}

.ai-question-prev-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: rgba(67, 97, 238, 0.06);
}

/* 下一个按钮 */
.ai-question-next-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 16px;
  border: none;
  border-radius: 999px;
  background: var(--primary);
  color: #fff;
  font-size: 12.5px;
  font-weight: 600;
  font-family: var(--font-sans);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 2px 10px rgba(67, 97, 238, 0.3);
}

.ai-question-next-btn svg {
  width: 14px;
  height: 14px;
}

.ai-question-next-btn:hover {
  background: var(--primary-hover);
  box-shadow: 0 4px 14px rgba(67, 97, 238, 0.4);
  transform: translateY(-1px);
}

.ai-question-next-btn:active {
  transform: translateY(0);
}

/* ---------- Question Cards Content ---------- */

/* 引导语 */
.ai-question-intro {
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--text);
  padding-left: 10px;
  border-left: 2px solid rgba(67, 97, 238, 0.3);
  margin-bottom: 4px;
}

/* 问题卡片容器 */
.ai-question-cards {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* 单个问题卡片 */
.ai-question-card {
  padding: 12px 14px;
  border: 1px solid rgba(67, 97, 238, 0.1);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.4);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.ai-question-card:hover {
  border-color: rgba(67, 97, 238, 0.2);
  background: rgba(255, 255, 255, 0.55);
}

/* 卡片头部 */
.ai-question-card-header {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 4px;
}

.ai-question-card-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.4;
}

.ai-question-required-mark {
  color: #ef4444;
  font-size: 14px;
  font-weight: 700;
  line-height: 1;
}

/* 问题描述 */
.ai-question-card-desc {
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--text-tertiary);
  margin: 0 0 8px;
}

/* 输入区域 */
.ai-question-card-input {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* 选项容器 */
.ai-question-options {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.ai-question-options-multi {
  gap: 6px;
}

/* 选项按钮 - 胶囊形 */
.ai-question-option {
  display: inline-flex;
  align-items: center;
  padding: 6px 14px;
  border: 1px solid rgba(67, 97, 238, 0.15);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.5);
  color: var(--text-secondary);
  font-size: 12.5px;
  font-weight: 500;
  font-family: var(--font-sans);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.ai-question-option:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: rgba(67, 97, 238, 0.08);
  transform: translateY(-1px);
}

.ai-question-option:active {
  transform: translateY(0);
}

/* 单选选中态 */
.ai-question-option.selected {
  border-color: var(--primary);
  background: var(--primary);
  color: #fff;
  box-shadow: 0 2px 8px rgba(67, 97, 238, 0.25);
}

.ai-question-option.selected:hover {
  background: var(--primary-hover);
  color: #fff;
}

/* "其他"按钮 */
.ai-option-other {
  border-style: dashed;
  color: var(--text-tertiary);
}

.ai-option-other:hover {
  color: var(--primary);
}

.ai-option-other.selected {
  border-style: solid;
  border-color: var(--primary);
  background: var(--primary);
  color: #fff;
}

/* 多选选项按钮 */
.ai-option-multi {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 12px 6px 8px;
  border: 1px solid rgba(67, 97, 238, 0.15);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.5);
  color: var(--text-secondary);
  font-size: 12.5px;
  font-weight: 500;
  font-family: var(--font-sans);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  user-select: none;
}

.ai-option-multi .ai-option-check {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  opacity: 0;
  transform: scale(0.6);
  transition: all 0.18s cubic-bezier(0.4, 0, 0.2, 1);
  color: #fff;
}

.ai-option-multi:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: rgba(67, 97, 238, 0.08);
  transform: translateY(-1px);
}

.ai-option-multi:active {
  transform: translateY(0);
}

.ai-option-multi.selected {
  border-color: var(--primary);
  background: var(--primary);
  color: #fff;
  box-shadow: 0 2px 8px rgba(67, 97, 238, 0.25);
}

.ai-option-multi.selected .ai-option-check {
  opacity: 1;
  transform: scale(1);
}

.ai-option-multi.selected:hover {
  background: var(--primary-hover);
  color: #fff;
}

/* "其他"输入 - 胶囊形输入框 */
.ai-chat-other-input {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
}

.ai-chat-other-input.hidden {
  display: none;
}

.ai-other-text {
  flex: 1;
  padding: 7px 14px;
  border: 1px solid rgba(67, 97, 238, 0.15);
  border-radius: 999px;
  font-size: 12.5px;
  font-family: var(--font-sans);
  color: var(--text);
  outline: none;
  background: rgba(255, 255, 255, 0.6);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.ai-other-text:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(67, 97, 238, 0.1);
  background: rgba(255, 255, 255, 0.8);
}

.ai-other-text::placeholder {
  color: var(--gray-400);
}

.ai-other-send {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: none;
  background: var(--primary);
  color: #fff;
  border-radius: 50%;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 2px 8px rgba(67, 97, 238, 0.25);
}

.ai-other-send:hover {
  background: var(--primary-hover);
  box-shadow: 0 4px 12px rgba(67, 97, 238, 0.35);
  transform: scale(1.06);
}

.ai-other-send:active {
  transform: scale(0.94);
}

.ai-other-send svg {
  width: 14px;
  height: 14px;
  transform: translateX(1px);
}

/* 文本输入 */
.ai-question-text-input {
  width: 100%;
}

.ai-question-textarea {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid rgba(67, 97, 238, 0.15);
  border-radius: 10px;
  font-size: 12.5px;
  font-family: var(--font-sans);
  color: var(--text);
  outline: none;
  background: rgba(255, 255, 255, 0.6);
  resize: vertical;
  min-height: 36px;
  max-height: 120px;
  line-height: 1.5;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.ai-question-textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(67, 97, 238, 0.1);
  background: rgba(255, 255, 255, 0.8);
}

.ai-question-textarea::placeholder {
  color: var(--gray-400);
}

/* 日期输入 */
.ai-question-date-input,
.ai-question-datetime-input {
  width: 100%;
}

.ai-question-date,
.ai-question-datetime {
  width: 100%;
  padding: 7px 12px;
  border: 1px solid rgba(67, 97, 238, 0.15);
  border-radius: 10px;
  font-size: 12.5px;
  font-family: var(--font-sans);
  color: var(--text);
  outline: none;
  background: rgba(255, 255, 255, 0.6);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
}

.ai-question-date:focus,
.ai-question-datetime:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(67, 97, 238, 0.1);
  background: rgba(255, 255, 255, 0.8);
}

/* 错误提示 */
.ai-question-error {
  margin-top: 4px;
  font-size: 11.5px;
  color: #ef4444;
  line-height: 1.4;
}

.ai-question-error.hidden {
  display: none;
}

/* 卡片错误态 */
.ai-question-card-error {
  border-color: rgba(239, 68, 68, 0.4) !important;
  background: rgba(239, 68, 68, 0.03) !important;
}

.ai-question-card-error:hover {
  border-color: rgba(239, 68, 68, 0.5) !important;
}

/* ---------- Question Actions (底部操作栏) ---------- */
.ai-question-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
}

/* 统一提交按钮 */
.ai-question-submit-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 8px 18px;
  border: none;
  border-radius: 999px;
  background: var(--primary);
  color: #fff;
  font-size: 12.5px;
  font-weight: 600;
  font-family: var(--font-sans);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 2px 10px rgba(67, 97, 238, 0.3);
}

.ai-question-submit-btn svg {
  width: 14px;
  height: 14px;
}

.ai-question-submit-btn:hover {
  background: var(--primary-hover);
  box-shadow: 0 4px 14px rgba(67, 97, 238, 0.4);
  transform: translateY(-1px);
}

.ai-question-submit-btn:active {
  transform: translateY(0);
}

/* 快捷按钮 */
.ai-quick-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 12px;
  border: 1px solid rgba(67, 97, 238, 0.12);
  border-radius: 999px;
  background: transparent;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 500;
  font-family: var(--font-sans);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.ai-quick-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: rgba(67, 97, 238, 0.06);
}

.ai-quick-btn svg {
  width: 13px;
  height: 13px;
}

/* 直接生成按钮 - 强调态 */
.ai-quick-generate {
  border-color: rgba(67, 97, 238, 0.3);
  color: var(--primary);
  background: rgba(67, 97, 238, 0.06);
  font-weight: 600;
}

.ai-quick-generate:hover {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
  box-shadow: 0 2px 10px rgba(67, 97, 238, 0.3);
}

/* ---------- Letter Actions ---------- */
.ai-letter-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.ai-modify-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 7px 14px;
  border: 1px solid rgba(67, 97, 238, 0.12);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.5);
  color: var(--text-secondary);
  font-size: 12.5px;
  font-weight: 500;
  font-family: var(--font-sans);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.ai-modify-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: rgba(67, 97, 238, 0.06);
}

.ai-modify-btn svg {
  width: 14px;
  height: 14px;
}

/* ---------- AI Modal Responsive ---------- */
@media (max-width: 768px) {
  .ai-modal {
    padding: 0;
    align-items: flex-end;
  }

  .ai-modal-body {
    max-width: 100%;
    width: 100%;
    height: 88vh;
    max-height: 88vh;
    border-radius: 20px 20px 0 0;
  }

  .ai-modal-header {
    padding: 6px 18px 12px;
  }

  .ai-modal-messages {
    padding: 0 18px 14px;
  }

  .ai-modal-input-area {
    padding: 10px 18px 16px;
  }

  .ai-welcome-title {
    font-size: 18px;
  }

  .ai-welcome-desc {
    font-size: 13px;
  }

  .ai-chat-welcome {
    padding: 36px 20px 24px;
  }
}

/* ============================================
   RESPONSIVE - 响应式
   ============================================ */
@media (max-width: 768px) {
  #pageCompose {
    padding-bottom: 70px; /* 移动端浮动栏改为单行后高度减小 */
  }

  .compose-meta-row,
  .compose-subject-row,
  .compose-template-bar,
  .compose-template-vars {
    padding-left: 16px;
    padding-right: 16px;
  }

  .compose-subject-input {
    font-size: 17px;
  }

  .compose-editor-toolbar {
    padding: 8px 16px;
  }

  .compose-codemirror-wrap .CodeMirror {
    min-height: 320px;
    font-size: 12.5px;
  }

  /* 编辑器下方区域移动端适配 */
  .compose-editor-footer {
    padding: 14px 16px;
    gap: 12px;
  }

  .compose-send-mode-row {
    gap: 10px;
  }

  /* 浮动栏移动端：单行紧凑布局 */
  .compose-floating-bar {
    left: 12px;
    right: 12px;
    transform: none;
    bottom: 12px;
  }

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

  .compose-floating-inner {
    min-width: unset;
    max-width: unset;
    width: 100%;
    border-radius: 14px;
    padding: 8px 12px;
    gap: 10px;
  }

  .compose-floating-left {
    gap: 8px;
  }

  .compose-floating-divider {
    display: none;
  }

  /* 移动端按钮只显示图标，节省空间 */
  .compose-floating-btn span {
    display: none;
  }

  .compose-floating-btn {
    padding: 8px 10px;
  }

  .compose-floating-btn svg {
    width: 18px;
    height: 18px;
  }

  .compose-send-btn {
    padding: 9px 20px;
  }

  .compose-chip-input {
    min-width: 120px;
  }
}

/* Send Mode Radio (legacy support) */
.send-mode-row {
  display: flex;
  gap: 24px;
}

.radio-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font-size: 14px;
  color: var(--text);
}

.radio-label input[type="radio"] {
  accent-color: var(--primary);
  width: 16px;
  height: 16px;
  cursor: pointer;
}

/* Template Select Row (legacy support) */
.template-select-row {
  display: flex;
  gap: 10px;
  align-items: center;
}

.template-select-row .form-control {
  flex: 1;
}

/* Template Variables (legacy support) */
.template-vars-group {
  background: var(--bg-subtle);
  border-radius: var(--radius-sm);
  padding: 16px;
  border: 1px solid var(--border-light);
}

.var-field {
  margin-bottom: 12px;
}

.var-field:last-child {
  margin-bottom: 0;
}

.var-field label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--primary);
  margin-bottom: 4px;
  font-family: var(--font-mono);
}
