/* ============================================
   现代客服咨询页 - 玻璃拟态 + Aurora 渐变
   ============================================ */

:root {
  --primary: #6366f1;
  --primary-2: #8b5cf6;
  --primary-3: #ec4899;
  --primary-soft: rgba(99, 102, 241, 0.08);
  --bg: #f8fafc;
  --text: #0f172a;
  --text-2: #475569;
  --muted: #94a3b8;
  --border: rgba(15, 23, 42, 0.06);
  --glass: rgba(255, 255, 255, 0.7);
  --glass-strong: rgba(255, 255, 255, 0.88);
  --shadow-sm: 0 2px 8px rgba(15, 23, 42, 0.04);
  --shadow-md: 0 8px 24px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 20px 60px rgba(15, 23, 42, 0.12);
  --green: #10b981;
  --orange: #f59e0b;
  --red: #ef4444;
  --radius-sm: 10px;
  --radius: 16px;
  --radius-lg: 22px;
  --ease: cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }
body {
  font-family: -apple-system, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  display: flex;
  justify-content: center;
  align-items: stretch;
  padding: 16px;
  position: relative;
  overflow: hidden;
}

/* ===== Aurora 光晕背景 ===== */
.aurora {
  position: fixed; inset: 0; z-index: 0; overflow: hidden;
  background:
    radial-gradient(ellipse at top left, #fce7f3 0%, transparent 55%),
    radial-gradient(ellipse at top right, #e0e7ff 0%, transparent 55%),
    radial-gradient(ellipse at bottom right, #cffafe 0%, transparent 55%),
    linear-gradient(135deg, #f5f3ff 0%, #fdf2f8 50%, #ecfeff 100%);
}
.orb {
  position: absolute; border-radius: 50%; filter: blur(80px);
  opacity: 0.55; pointer-events: none;
  animation: float 18s ease-in-out infinite;
}
.orb-1 { width: 480px; height: 480px; top: -120px; left: -100px; background: radial-gradient(circle, #a78bfa, transparent 70%); }
.orb-2 { width: 420px; height: 420px; top: 30%; right: -120px; background: radial-gradient(circle, #f0abfc, transparent 70%); animation-delay: -6s; }
.orb-3 { width: 520px; height: 520px; bottom: -180px; left: 30%; background: radial-gradient(circle, #67e8f9, transparent 70%); animation-delay: -12s; }

@keyframes float {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(40px, -30px) scale(1.08); }
  66% { transform: translate(-30px, 40px) scale(0.95); }
}

/* ===== 主体容器 ===== */
.chat-shell {
  width: 100%; max-width: 760px; height: 100%;
  background: var(--glass-strong);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.6);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column;
  overflow: hidden; position: relative; z-index: 1;
  animation: shellIn .55s var(--ease-out);
}

@keyframes shellIn {
  from { opacity: 0; transform: translateY(20px) scale(0.98); }
  to   { opacity: 1; transform: none; }
}

/* ===== 顶部品牌区 ===== */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px; gap: 12px;
  background: linear-gradient(180deg, rgba(255,255,255,0.9), rgba(255,255,255,0.65));
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(12px);
}
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.logo-box {
  width: 46px; height: 46px; border-radius: 14px;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  display: flex; align-items: center; justify-content: center;
  font-size: 24px; color: #fff;
  box-shadow: 0 6px 16px rgba(99, 102, 241, 0.35);
  position: relative; overflow: hidden;
  transition: transform .35s var(--ease);
  flex-shrink: 0;
}
.logo-box::after {
  content: ''; position: absolute; inset: -1px;
  background: linear-gradient(135deg, transparent 40%, rgba(255,255,255,0.4) 50%, transparent 60%);
  transform: translateX(-100%);
  animation: shine 4s ease-in-out infinite;
}
.logo-box:hover { transform: rotate(-6deg) scale(1.05); }
.logo-box img { width: 100%; height: 100%; object-fit: contain; border-radius: 12px; }
.logo-emoji { display: block; line-height: 1; }

@keyframes shine {
  0%, 80% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

.brand-text { min-width: 0; }
.brand-row { display: flex; align-items: center; gap: 8px; }
.brand-name {
  font-size: 16px; font-weight: 700; color: var(--text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 180px;
}
.status-chip {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11px; font-weight: 600;
  padding: 3px 9px; border-radius: 999px;
  background: rgba(16, 185, 129, 0.12); color: var(--green);
  border: 1px solid rgba(16, 185, 129, 0.2);
}
.status-chip.off { background: rgba(148, 163, 184, 0.12); color: var(--muted); border-color: rgba(148, 163, 184, 0.2); }
.status-chip .dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: currentColor;
  animation: pulse 2s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(1.3); }
}
.brand-sub {
  display: flex; align-items: center; gap: 6px;
  font-size: 12px; color: var(--text-2); margin-top: 3px;
}
.online-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.5);
  animation: ripple 1.8s ease-in-out infinite;
}
@keyframes ripple {
  0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.5); }
  70% { box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
  100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

.topbar-actions { display: flex; gap: 4px; }
.icon-btn {
  width: 36px; height: 36px; border-radius: 10px;
  border: none; background: rgba(255,255,255,0.6);
  cursor: pointer; font-size: 16px; color: var(--text-2);
  transition: all .2s var(--ease);
}
.icon-btn:hover { background: var(--primary-soft); color: var(--primary); transform: translateY(-1px); }

/* ===== 欢迎卡片 ===== */
.welcome-card {
  margin: 14px 18px 0;
  padding: 16px 18px;
  border-radius: var(--radius);
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.08), rgba(236, 72, 153, 0.06));
  border: 1px solid rgba(99, 102, 241, 0.18);
  position: relative; overflow: hidden;
  animation: slideDown .5s var(--ease-out) .15s both;
}
.welcome-deco {
  position: absolute; right: -30px; top: -30px;
  width: 120px; height: 120px; border-radius: 50%;
  background: radial-gradient(circle, rgba(236, 72, 153, 0.18), transparent 70%);
}
.welcome-title { font-size: 15px; font-weight: 700; color: var(--text); margin-bottom: 4px; }
.welcome-text { font-size: 13px; color: var(--text-2); line-height: 1.6; }
@keyframes slideDown {
  from { opacity: 0; transform: translateY(-10px); }
  to   { opacity: 1; transform: none; }
}

/* ===== 消息流 ===== */
.messages {
  flex: 1; overflow-y: auto;
  padding: 16px 18px 8px;
  display: flex; flex-direction: column; gap: 14px;
  scroll-behavior: smooth;
  scrollbar-width: thin;
}
.messages::-webkit-scrollbar { width: 6px; }
.messages::-webkit-scrollbar-thumb { background: rgba(15, 23, 42, 0.12); border-radius: 3px; }
/* ⚠️ 纵向 flex 滚动容器里，overflow 非 visible 的子项（如 .form-card）自动最小尺寸为 0，
   内容超出时会被压缩并被自身 overflow:hidden 裁掉 —— 统一禁止收缩，避免卡片显示不全 */
.messages > * { flex-shrink: 0; }
.messages::-webkit-scrollbar-thumb:hover { background: rgba(15, 23, 42, 0.24); }

.day-divider {
  display: flex; align-items: center; gap: 10px;
  margin: 4px auto 8px;
  font-size: 11px; color: var(--muted);
}
.day-divider::before, .day-divider::after {
  content: ''; flex: 0 0 32px; height: 1px; background: var(--border);
}

/* 消息行 */
.msg { display: flex; gap: 10px; max-width: 86%; animation: msgIn .45s var(--ease-out) both; }
.msg.user { align-self: flex-end; flex-direction: row-reverse; }
.msg.assistant { align-self: flex-start; }

@keyframes msgIn {
  0%   { opacity: 0; transform: translateY(12px) scale(0.96); }
  60%  { opacity: 1; }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

/* 头像 */
.avatar-mini {
  width: 34px; height: 34px; border-radius: 12px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; color: #fff;
  box-shadow: var(--shadow-sm);
  margin-top: 2px;
}
.avatar-mini.bot { background: linear-gradient(135deg, var(--primary), var(--primary-2)); }
.avatar-mini.bot img { width: 100%; height: 100%; object-fit: contain; border-radius: 10px; }
.avatar-mini.you {
  background: linear-gradient(135deg, #f59e0b, #ef4444);
  font-weight: 700;
}
.msg.user .avatar-mini { display: none; }

/* 气泡 */
.bubble {
  padding: 11px 14px;
  border-radius: 18px;
  font-size: 14px; line-height: 1.65;
  white-space: pre-wrap; word-break: break-word;
  position: relative;
  box-shadow: var(--shadow-sm);
  transition: transform .25s var(--ease);
}
.bubble:hover { transform: translateY(-1px); }
.msg.assistant .bubble {
  background: #fff;
  border-top-left-radius: 6px;
  border: 1px solid var(--border);
  color: var(--text);
}
.msg.user .bubble {
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  color: #fff;
  border-top-right-radius: 6px;
  box-shadow: 0 6px 16px rgba(99, 102, 241, 0.25);
}
.msg-text { word-break: break-word; }

/* 意图标签 */
.intent-chip {
  display: inline-flex; align-items: center;
  font-size: 11px; font-weight: 600;
  padding: 2px 9px; border-radius: 999px;
  margin-bottom: 6px;
}
.intent-refund { background: #fee2e2; color: #b91c1c; }
.intent-order { background: #dbeafe; color: #1d4ed8; }
.intent-price { background: #fef3c7; color: #b45309; }
.intent-aftersale { background: #dcfce7; color: #15803d; }
.intent-tech { background: #ede9fe; color: #6d28d9; }
.intent-complaint { background: #fce7f3; color: #be185d; }
.intent-invoice { background: #cffafe; color: #0e7490; }
.intent-product { background: #ffedd5; color: #c2410c; }
.intent-activity { background: #fce7f3; color: #db2777; }
.intent-account { background: #e0e7ff; color: #4338ca; }
.intent-handoff { background: #ffedd5; color: var(--orange); }
.intent-other { background: #f1f5f9; color: var(--muted); }

/* 转人工气泡 */
.handoff-card {
  background: linear-gradient(135deg, #fff7ed, #fffbeb);
  border: 1px solid #fed7aa; border-radius: 14px;
  padding: 14px 16px; font-size: 13px; line-height: 1.7;
  display: flex; align-items: flex-start; gap: 10px;
}
.handoff-card .icon {
  width: 36px; height: 36px; border-radius: 10px;
  background: linear-gradient(135deg, #fb923c, #f59e0b);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; color: #fff; flex-shrink: 0;
  animation: handoffPulse 1.6s ease-in-out infinite;
}
.handoff-card b { color: var(--orange); }
@keyframes handoffPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.08); }
}

/* 打字动画 */
.typing { display: inline-flex; gap: 5px; padding: 6px 2px; }
.typing span {
  width: 8px; height: 8px; border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  animation: typingBounce 1.2s ease-in-out infinite;
}
.typing span:nth-child(2) { animation-delay: .15s; }
.typing span:nth-child(3) { animation-delay: .3s; }
@keyframes typingBounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-8px); opacity: 1; }
}

/* ===== 快捷问题（卡片胶囊）===== */
.quick-row { padding: 6px 18px 8px; }
.quick-label {
  font-size: 11px; color: var(--muted); font-weight: 600;
  margin-bottom: 6px; letter-spacing: 0.5px;
}
.quick-list {
  display: flex; gap: 8px; overflow-x: auto; padding: 4px 0 8px;
  scrollbar-width: none;
}
.quick-list::-webkit-scrollbar { display: none; }
.quick-card {
  flex: 0 0 auto;
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 13px; font-weight: 500;
  padding: 8px 14px;
  background: #fff; border: 1px solid var(--border);
  border-radius: 999px; cursor: pointer;
  color: var(--text-2);
  transition: all .25s var(--ease);
  white-space: nowrap;
  box-shadow: var(--shadow-sm);
  animation: cardIn .4s var(--ease-out) both;
}
.quick-card:hover {
  border-color: var(--primary); color: var(--primary);
  background: var(--primary-soft);
  transform: translateY(-2px);
  box-shadow: 0 6px 14px rgba(99, 102, 241, 0.15);
}
.quick-card:active { transform: translateY(0) scale(0.97); }
@keyframes cardIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: none; }
}

/* ===== 满意度浮层（人工服务结束后弹出，不占对话区） ===== */
.rating-mask {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(15, 23, 42, 0.32);
  backdrop-filter: blur(2px);
  animation: maskIn .25s ease both;
}
.rating-dialog {
  position: relative;
  width: 100%;
  max-width: 300px;
  padding: 20px 20px 16px;
  text-align: center;
  background: #fff;
  border-radius: 20px;
  box-shadow: 0 18px 44px rgba(15, 23, 42, 0.22);
  animation: dialogIn .38s var(--ease) both;
}
@keyframes maskIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes dialogIn {
  from { opacity: 0; transform: translateY(14px) scale(.92); }
  to   { opacity: 1; transform: none; }
}
/* 顶部柔光条，与整套视觉语言保持一致 */
.rating-dialog::before {
  content: '';
  position: absolute;
  inset: 0 0 auto;
  height: 4px;
  border-radius: 20px 20px 0 0;
  background: linear-gradient(135deg, var(--primary), var(--primary-2), var(--primary-3));
}
.rating-close {
  position: absolute;
  top: 10px; right: 12px;
  width: 24px; height: 24px;
  display: flex; align-items: center; justify-content: center;
  border: none; background: none;
  font-size: 14px; color: var(--text-2);
  cursor: pointer; border-radius: 50%;
  transition: all .2s var(--ease);
}
.rating-close:hover { background: var(--primary-soft); color: var(--primary); transform: rotate(90deg); }
.rating-top { display: flex; align-items: center; justify-content: center; gap: 8px; margin-bottom: 6px; }
.rating-emoji { font-size: 26px; transition: transform .3s var(--ease); }
.rating-dialog:hover .rating-emoji { transform: rotate(-10deg) scale(1.1); }
.rating-label { font-size: 15px; color: var(--text); font-weight: 600; }
.rating-sub { font-size: 12px; color: var(--text-2); margin-bottom: 12px; }
.stars { display: flex; justify-content: center; gap: 6px; }
.stars button {
  background: none; border: none; font-size: 30px;
  color: #e2e8f0; cursor: pointer;
  transition: all .25s var(--ease);
  padding: 2px;
}
.stars button:hover { transform: scale(1.25) rotate(-5deg); }
.stars button.on { color: #f59e0b; filter: drop-shadow(0 2px 4px rgba(245, 158, 11, 0.3)); }
.rating-hint { display: block; font-size: 12px; color: var(--text-2); margin-top: 8px; min-height: 16px; }
.rating-later {
  margin-top: 10px;
  padding: 6px 14px;
  border: none; background: none;
  font-size: 12px; color: var(--text-2);
  cursor: pointer; border-radius: 12px;
  transition: all .2s var(--ease);
}
.rating-later:hover { background: var(--primary-soft); color: var(--primary); }

@media (prefers-reduced-motion: reduce) {
  .rating-mask, .rating-dialog { animation: none; }
}

/* ===== 输入区 ===== */
.composer-wrap {
  padding: 10px 14px 14px;
  background: linear-gradient(180deg, rgba(255,255,255,0.5), rgba(255,255,255,0.85));
  border-top: 1px solid var(--border);
}
.composer {
  display: flex; align-items: flex-end; gap: 8px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 6px 6px 6px 8px;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.05);
  transition: all .25s var(--ease);
}
.composer:focus-within {
  border-color: var(--primary);
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.18);
  transform: translateY(-1px);
}
.composer-tools { position: relative; display: flex; gap: 2px; padding-bottom: 4px; }
.tool-btn {
  border: none; background: transparent;
  width: 34px; height: 34px; border-radius: 10px;
  font-size: 18px; cursor: pointer; color: var(--text-2);
  transition: all .2s var(--ease);
  display: flex; align-items: center; justify-content: center;
}
.tool-btn:hover { background: var(--primary-soft); color: var(--primary); transform: scale(1.08); }
.tool-btn:active { transform: scale(0.92); }

.input-wrap {
  flex: 1; display: flex; align-items: flex-end; gap: 6px;
}
.composer textarea {
  flex: 1; resize: none; border: none; outline: none;
  padding: 9px 8px; font-size: 14px; line-height: 1.5;
  font-family: inherit; background: transparent;
  color: var(--text); max-height: 120px;
}
.composer textarea::placeholder { color: var(--muted); }

.send-btn {
  width: 38px; height: 38px; border-radius: 14px; border: none;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  color: #fff; cursor: pointer; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.35);
  transition: all .25s var(--ease);
  position: relative; overflow: hidden;
}
.send-btn::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(135deg, transparent 40%, rgba(255,255,255,0.3) 50%, transparent 60%);
  transform: translateX(-100%);
  transition: transform .6s;
}
.send-btn:hover { transform: translateY(-2px) scale(1.05); box-shadow: 0 8px 18px rgba(99, 102, 241, 0.45); }
.send-btn:hover::after { transform: translateX(100%); }
.send-btn:active { transform: translateY(0) scale(0.96); }
.send-btn:disabled {
  background: linear-gradient(135deg, #cbd5e1, #94a3b8);
  box-shadow: none; cursor: not-allowed;
}

.composer-hint {
  font-size: 11px; color: var(--muted);
  margin-top: 8px; padding-left: 4px;
}

/* ===== 表情面板 ===== */
.emoji-panel {
  position: absolute; bottom: 46px; left: -8px;
  width: 300px; max-height: 240px; overflow-y: auto;
  background: var(--glass-strong);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border); border-radius: 16px;
  padding: 10px;
  box-shadow: var(--shadow-lg);
  z-index: 50;
  display: grid; grid-template-columns: repeat(8, 1fr); gap: 2px;
  transform-origin: bottom left;
  animation: emojiPop .3s var(--ease);
}
@keyframes emojiPop {
  from { opacity: 0; transform: scale(0.85) translateY(8px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}
.emoji-panel span {
  cursor: pointer; font-size: 20px;
  text-align: center; padding: 5px 0;
  border-radius: 8px;
  transition: all .15s var(--ease);
}
.emoji-panel span:hover { background: var(--primary-soft); transform: scale(1.2); }

/* ===== 文件消息 ===== */
.file-msg { display: flex; flex-direction: column; gap: 6px; }
.file-msg img { max-width: 100%; max-height: 280px; border-radius: 12px; display: block; box-shadow: var(--shadow-sm); }
.file-msg video { max-width: 100%; max-height: 280px; border-radius: 12px; display: block; }
.file-link {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 14px; padding: 8px 12px;
  background: rgba(99, 102, 241, 0.08);
  border-radius: 10px; color: var(--primary); text-decoration: none;
  transition: all .2s var(--ease);
}
.file-link:hover { background: var(--primary-soft); transform: translateX(2px); }

/* ===== 图文卡片 ===== */
.card-msg {
  width: 260px; border: 1px solid var(--border); border-radius: 16px;
  overflow: hidden; background: #fff;
  box-shadow: var(--shadow-md);
  transition: transform .3s var(--ease), box-shadow .3s var(--ease);
}
.card-msg:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.card-img { width: 100%; height: 140px; object-fit: cover; display: block; background: linear-gradient(135deg, #f1f5f9, #e0e7ff); }
.card-body { padding: 12px 14px; }
.card-title { font-size: 14px; font-weight: 700; color: var(--text); margin-bottom: 4px; line-height: 1.4; }
.card-desc { font-size: 13px; color: var(--text-2); line-height: 1.5; max-height: 60px; overflow: hidden; }
.card-btn {
  display: inline-flex; align-items: center; gap: 4px;
  margin-top: 10px; font-size: 13px;
  color: var(--primary); text-decoration: none; font-weight: 600;
  transition: gap .2s var(--ease);
}
.card-btn:hover { gap: 8px; }
.card-btn::after { content: '→'; }

/* ===== 智能推荐横滑卡片 ===== */
.rec-wrap { margin: 6px 0 4px; animation: msgIn .5s var(--ease-out); }
.rec-head {
  display: flex; align-items: center; gap: 6px;
  font-size: 12px; color: var(--text-2); margin-bottom: 8px;
  padding-left: 4px; font-weight: 600;
}
.rec-head::before { content: '✨'; }
.rec-list { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 6px; scrollbar-width: none; }
.rec-list::-webkit-scrollbar { display: none; }
.rec-card {
  flex: 0 0 auto; width: 200px;
  border: 1px solid var(--border); border-radius: 14px;
  background: #fff; text-decoration: none; color: inherit;
  display: flex; gap: 10px; align-items: center;
  padding: 10px;
  transition: all .3s var(--ease);
  box-shadow: var(--shadow-sm);
  animation: cardIn .4s var(--ease-out) both;
}
.rec-card:hover {
  border-color: var(--primary);
  transform: translateY(-3px);
  box-shadow: 0 10px 24px rgba(99, 102, 241, 0.18);
}
.rec-card img {
  width: 48px; height: 48px; border-radius: 10px;
  object-fit: cover; flex-shrink: 0;
  background: linear-gradient(135deg, #f1f5f9, #e0e7ff);
}
.rec-icon {
  width: 48px; height: 48px; border-radius: 10px;
  background: linear-gradient(135deg, #ede9fe, #fce7f3);
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; flex-shrink: 0;
}
.rec-body { min-width: 0; flex: 1; }
.rec-name { font-size: 13px; font-weight: 600; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rec-sum { font-size: 12px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 2px; }

/* ===== 表单卡片 ===== */
.form-card {
  width: 100%; max-width: 340px;
  flex: 0 0 auto; /* 不允许被 flex 压缩，否则内容会被 overflow:hidden 裁掉 */
  border: 1px solid var(--border); border-radius: 16px;
  background: #fff; padding: 14px 16px;
  margin-top: 4px;
  box-shadow: var(--shadow-md);
  animation: msgIn .45s var(--ease-out);
  position: relative; overflow: hidden;
}
.form-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: linear-gradient(90deg, var(--primary), var(--primary-2), var(--primary-3));
}
.form-head { font-size: 14px; font-weight: 700; color: var(--text); margin-bottom: 4px; display: flex; align-items: center; gap: 6px; }
.form-intro { font-size: 12px; color: var(--text-2); margin-bottom: 10px; line-height: 1.5; }
.form-row { display: flex; flex-direction: column; gap: 4px; margin-bottom: 10px; }
.form-row label { font-size: 12px; color: var(--text); font-weight: 600; }
.form-row input, .form-row select {
  border: 1px solid var(--border); border-radius: 10px;
  padding: 9px 12px; font-size: 13px; outline: none;
  background: #f8fafc;
  transition: all .2s var(--ease);
  font-family: inherit;
}
.form-row input:focus, .form-row select:focus {
  border-color: var(--primary); background: #fff;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}
.form-actions { display: flex; align-items: center; gap: 10px; margin-top: 4px; }
.form-submit {
  border: none;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  color: #fff; font-size: 13px; font-weight: 600;
  padding: 9px 22px; border-radius: 12px; cursor: pointer;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
  transition: all .2s var(--ease);
}
.form-submit:hover { transform: translateY(-1px); box-shadow: 0 6px 16px rgba(99, 102, 241, 0.4); }
.form-submit:active { transform: translateY(0); }
.form-submit:disabled { background: #cbd5e1; box-shadow: none; cursor: not-allowed; }
.form-hint { font-size: 12px; color: var(--text-2); }

/* ===== 表单里的图片上传字段 ===== */
.form-image-field { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.form-upload-btn {
  border: 1px dashed var(--primary); border-radius: 10px;
  background: rgba(99, 102, 241, 0.06);
  color: var(--primary); font-size: 12px; font-weight: 600;
  padding: 8px 14px; cursor: pointer; font-family: inherit;
  transition: all .2s var(--ease);
}
.form-upload-btn:hover { background: rgba(99, 102, 241, 0.14); transform: translateY(-1px); }
.form-upload-btn:disabled { opacity: .6; cursor: not-allowed; transform: none; }
.form-image-preview { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text-2); flex-wrap: wrap; }
.form-image-tip { color: var(--muted); }
.form-image-thumb img {
  width: 56px; height: 56px; object-fit: cover; border-radius: 10px;
  border: 1px solid var(--border); display: block;
  transition: transform .2s var(--ease);
}
.form-image-thumb:hover img { transform: scale(1.06); }
.form-image-ok { color: #10b981; }
.form-image-err { color: var(--red); }

/* ===== Toast 提示 ===== */
.toast {
  position: fixed; bottom: 80px; left: 50%;
  transform: translateX(-50%) translateY(20px);
  padding: 10px 18px;
  background: rgba(15, 23, 42, 0.85);
  color: #fff; font-size: 13px;
  border-radius: 999px;
  box-shadow: var(--shadow-lg);
  z-index: 100;
  opacity: 0;
  transition: all .3s var(--ease);
  backdrop-filter: blur(8px);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.hidden { display: none !important; }

/* ===== 访问限制遮罩（仅限内部访问） ===== */
.gate-mask {
  position: absolute; inset: 0; z-index: 80;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  background: rgba(248, 250, 252, 0.86);
  backdrop-filter: blur(16px) saturate(160%);
  -webkit-backdrop-filter: blur(16px) saturate(160%);
  animation: gateIn .35s var(--ease-out) both;
}
@keyframes gateIn { from { opacity: 0; } to { opacity: 1; } }

.gate-card {
  width: 100%; max-width: 340px;
  background: var(--glass-strong);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 28px 24px 22px;
  text-align: center;
  animation: gatePop .45s var(--ease) both;
}
@keyframes gatePop { from { opacity: 0; transform: translateY(12px) scale(.96); } to { opacity: 1; transform: none; } }

.gate-logo {
  width: 56px; height: 56px; margin: 0 auto 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 26px; border-radius: 18px;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  box-shadow: 0 8px 20px rgba(99, 102, 241, 0.28);
}
.gate-logo img { width: 100%; height: 100%; object-fit: contain; border-radius: 18px; }

.gate-title { font-size: 16px; font-weight: 700; color: var(--text); margin-bottom: 6px; }
.gate-desc { font-size: 13px; color: var(--text-2); line-height: 1.6; margin-bottom: 18px; }

.gate-form { display: flex; flex-direction: column; gap: 10px; }
.gate-input {
  width: 100%; padding: 11px 14px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: #fff; color: var(--text); font-size: 14px; outline: none;
  transition: all .2s var(--ease);
}
.gate-input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.gate-btn {
  margin-top: 2px; padding: 11px 14px; border: 0; border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  color: #fff; font-size: 14px; font-weight: 600; cursor: pointer;
  box-shadow: 0 6px 16px rgba(99, 102, 241, 0.28);
  transition: transform .2s var(--ease), box-shadow .2s var(--ease);
}
.gate-btn:hover { transform: translateY(-1px); box-shadow: 0 10px 22px rgba(99, 102, 241, 0.34); }
.gate-btn:disabled { opacity: .6; cursor: not-allowed; transform: none; }

.gate-error { margin-top: 10px; font-size: 13px; color: var(--red); min-height: 18px; }
.gate-foot { margin-top: 6px; font-size: 12px; color: var(--muted); line-height: 1.6; }
.gate-exit {
  margin-top: 14px; background: none; border: 0; cursor: pointer;
  font-size: 12px; color: var(--muted); text-decoration: underline;
}
.gate-exit:hover { color: var(--text-2); }

/* ===== 移动端适配 ===== */
@media (max-width: 640px) {
  body { padding: 0; }
  .chat-shell { max-width: 100%; height: 100vh; border-radius: 0; border: none; }
  .orb-1 { width: 280px; height: 280px; }
  .orb-2 { width: 240px; height: 240px; }
  .orb-3 { width: 300px; height: 300px; }
  .msg { max-width: 92%; }
  .card-msg { width: 240px; }
  .rec-card { width: 180px; }
  .brand-name { max-width: 130px; }
}

@media (max-height: 600px) {
  .welcome-card { padding: 10px 14px; }
  .composer-wrap { padding: 6px 10px 10px; }
  .composer-hint { display: none; }
}

/* ===== 减少动画偏好 ===== */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* ============ 嵌入模式（官网挂件 iframe 内，紧凑填满） ============ */
body.embed { overflow: hidden; }
body.embed .aurora { display: none; }
body.embed .chat-shell { max-width: 100%; height: 100vh; height: 100dvh; border: 0; border-radius: 0; box-shadow: none; background: #fff; backdrop-filter: none; -webkit-backdrop-filter: none; animation: none; }
body.embed .topbar { padding: 10px 14px; }
body.embed .brand-sub { display: none; }
body.embed .logo-box { width: 34px; height: 34px; font-size: 17px; }
body.embed .brand-name { font-size: 15px; }
body.embed .messages { padding: 12px 12px 4px; }
body.embed .welcome-card { margin: 10px 12px; }

/* ============ 人工服务中状态条 ============ */
.handoff-bar { display: flex; align-items: center; gap: 10px; margin: 10px 14px 0; padding: 9px 14px; background: rgba(16,185,129,.08); border: 1px solid rgba(16,185,129,.22); border-radius: 12px; animation: slideUp .3s ease both; }
.handoff-bar-dot { width: 8px; height: 8px; border-radius: 50%; background: #10b981; flex-shrink: 0; box-shadow: 0 0 0 4px rgba(16,185,129,.15); animation: pulse 1.6s ease-in-out infinite; }
.handoff-bar-text { flex: 1; font-size: 13px; font-weight: 600; color: #047857; }
.end-handoff-btn { padding: 6px 14px; border: 1px solid rgba(16,185,129,.35); background: #fff; color: #047857; border-radius: 999px; font-size: 12.5px; font-weight: 600; cursor: pointer; font-family: inherit; transition: all .2s; }
.end-handoff-btn:hover { background: #fef2f2; border-color: #fca5a5; color: #dc2626; }
.end-handoff-btn:disabled { opacity: .55; cursor: not-allowed; }

/* ============ 手机号绑定条（P2-10） ============ */
.bind-bar { margin: 0 14px 10px; background: rgba(255,255,255,.86); backdrop-filter: blur(14px); border: 1px solid rgba(99,102,241,.18); border-radius: 16px; box-shadow: 0 8px 26px rgba(15,23,42,.07); padding: 12px 14px; animation: bindIn .32s cubic-bezier(0.34,1.56,0.64,1); }
@keyframes bindIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.bind-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.bind-icon { font-size: 16px; }
.bind-title { font-size: 14px; font-weight: 700; color: #0f172a; }
.bind-state { margin-left: auto; font-size: 12px; color: #10b981; font-weight: 600; }
.bind-tip { font-size: 12px; color: #64748b; margin-bottom: 10px; line-height: 1.5; }
.bind-row { display: flex; gap: 8px; margin-bottom: 8px; }
.bind-input { flex: 1; min-width: 0; height: 38px; padding: 0 12px; border: 1px solid rgba(15,23,42,.1); border-radius: 10px; font-size: 14px; outline: none; background: #fff; color: #0f172a; transition: border-color .18s, box-shadow .18s; }
.bind-input:focus { border-color: #6366f1; box-shadow: 0 0 0 3px rgba(99,102,241,.12); }
.bind-btn { flex: 0 0 auto; height: 38px; padding: 0 14px; border-radius: 10px; border: 1px solid rgba(99,102,241,.3); background: #fff; color: #6366f1; font-size: 13px; font-weight: 600; cursor: pointer; transition: all .18s; }
.bind-btn:hover { background: rgba(99,102,241,.08); }
.bind-btn:disabled { opacity: .55; cursor: not-allowed; }
.bind-btn.primary { background: linear-gradient(135deg,#6366f1,#8b5cf6); border-color: transparent; color: #fff; }
.bind-btn.primary:hover { filter: brightness(1.06); }
.bind-error { font-size: 12px; color: #ef4444; min-height: 16px; }

/* 绑定成功后：整块折叠成一行状态条，不再占对话窗口；点「更换」可重新展开修改 */
.bind-bar { transition: padding .22s ease, background .22s ease, border-color .22s ease; }
.bind-bar.locked {
  padding: 8px 12px;
  background: rgba(16, 185, 129, .08);
  border-color: rgba(16, 185, 129, .24);
  box-shadow: none;
}
.bind-bar.locked .bind-head { margin-bottom: 0; }
.bind-bar.locked .bind-title { display: none; }
.bind-bar.locked .bind-state { margin-left: 0; }
.bind-bar.locked .bind-body { display: none; }
.bind-bar.locked .bind-toggle { display: inline-flex; }
.bind-bar.locked.expanded .bind-title { display: inline; }
.bind-bar.locked.expanded .bind-body { display: block; margin-top: 10px; animation: bindIn .28s ease both; }
.bind-toggle {
  display: none;
  margin-left: auto;
  padding: 4px 10px;
  border: none;
  background: transparent;
  color: #6366f1;
  font-size: 12px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  border-radius: 999px;
  transition: background .18s;
}
.bind-toggle:hover { background: rgba(99, 102, 241, .1); }
