/* Chat Interface Styles - BYD Official Style */

.chat-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    background-color: var(--background-light);
    max-width: 100%;
    margin: 0 auto;
    visibility: hidden;
    opacity: 0;
    transition: opacity .16s ease;
}

body.chat-ready .chat-container { visibility: visible; opacity: 1; }

/* Final cascade: keep the three header controls in one predictable rail and
   apply the glass treatment consistently after legacy rules above. */
.chat-header { padding: 14px clamp(16px, 3vw, 36px); }
.header-content { width: min(100%, 1180px); min-height: 52px; gap: 14px; }
.header-actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; flex: 0 0 auto; margin-left: auto; }
.header-actions button { margin: 0; }
.tts-toggle, .handoff-toggle { height: 40px; margin: 0; border: 1px solid rgba(255,255,255,.38); border-radius: 12px; color: #fff; background: rgba(255,255,255,.14); backdrop-filter: blur(12px) saturate(130%); -webkit-backdrop-filter: blur(12px) saturate(130%); }
.tts-toggle { width: 40px; min-width: 40px; padding: 0; }
.tts-toggle svg { width: 19px; height: 19px; }
.handoff-toggle { min-width: 70px; padding: 0 14px; font-size: 13px; font-weight: 600; white-space: nowrap; }
.intent-toggle { color: color-mix(in srgb, var(--chat-theme) 80%, #12352a); background: rgba(255,255,255,.9); border-color: rgba(255,255,255,.95); }
.human-toggle { background: rgba(6,34,26,.2); }
.tts-toggle:hover, .handoff-toggle:hover { background: rgba(255,255,255,.26); border-color: rgba(255,255,255,.68); transform: translateY(-1px); }
.intent-toggle:hover { background: #fff; }
.chat-header { background: color-mix(in srgb, var(--chat-theme) 84%, #15352d); border-bottom: 1px solid rgba(255,255,255,.28); box-shadow: 0 8px 14px color-mix(in srgb, var(--chat-theme) 18%, transparent); }
.ai-avatar { width: 50px; height: 50px; padding: 2px; border-radius: 16px; border: 1px solid rgba(255,255,255,.7); background: rgba(255,255,255,.86); box-shadow: 0 4px 10px rgba(9,39,29,.16); }
.ai-avatar img { border-radius: 13px; padding: 7px; }
.ai-avatar img.ai-avatar-img { border-radius: 13px; }
.header-info { min-width: 0; flex: 1 1 auto; color: #fff; }
.header-info h1 { margin: 0; color: #fff; font-size: clamp(16px,1.5vw,19px); line-height: 1.2; font-weight: 650; letter-spacing: -.01em; }
.messages-area { background: transparent; padding: 30px max(16px, calc((100% - 980px) / 2)); scrollbar-color: color-mix(in srgb, var(--chat-theme) 35%, transparent) transparent; }
.message { margin-bottom: 18px; }
.message-avatar { width: 38px; height: 38px; border: 1px solid rgba(255,255,255,.9); box-shadow: 0 5px 12px rgba(23,61,48,.11); }
.message.ai .message-avatar { margin-right: 10px; }
.message.user .message-avatar { margin-left: 10px; }
.message-bubble { padding: 13px 16px; border-radius: 16px; font-size: 15px; line-height: 1.62; border: 1px solid rgba(255,255,255,.78); box-shadow: 0 5px 12px rgba(23,61,48,.11); backdrop-filter: blur(17px) saturate(130%); -webkit-backdrop-filter: blur(17px) saturate(130%); }
.message.ai .message-bubble { color: #18332b; background: rgba(255,255,255,.62); }
.message.user .message-bubble { background: color-mix(in srgb, var(--chat-theme) 88%, #0d3d2d); border-color: color-mix(in srgb, var(--chat-theme) 70%, white); color: #fff; }
.message-time { color: #58736a; font-size: 11px; }
.input-area { gap: 10px; padding: 14px max(16px, calc((100% - 980px) / 2)); background: rgba(255,255,255,.48); border-top: 1px solid rgba(255,255,255,.78); backdrop-filter: blur(24px) saturate(140%); -webkit-backdrop-filter: blur(24px) saturate(140%); }
.voice-button, .send-button { width: 44px; height: 44px; min-width: 44px; border-radius: 13px; border: 1px solid rgba(255,255,255,.88); box-shadow: 0 5px 12px rgba(23,61,48,.11); }
.voice-button { color: #58736a; background: rgba(255,255,255,.7); }
.voice-button:hover { background: rgba(255,255,255,.94); color: var(--chat-theme); }
.send-button { background: var(--chat-theme); border-color: color-mix(in srgb, var(--chat-theme) 70%, white); }
.message-input { min-height: 44px; padding: 11px 15px; border-radius: 14px; border: 1px solid rgba(255,255,255,.9); color: #18332b; background: rgba(255,255,255,.76); }
.message-input::placeholder { color: #668178; }
@media (min-width: 769px) {
  .chat-container { max-width: 1240px; margin: 18px auto; height: calc(100vh - 36px); min-height: 600px; border: 1px solid rgba(255,255,255,.78); border-radius: 20px; overflow: hidden; box-shadow: 0 8px 14px rgba(24,68,51,.12); }
  .messages-area { padding-top: 34px; padding-bottom: 34px; }
}
@media (max-width: 520px) {
  .chat-header { padding: 11px 12px; }
  .header-content { gap: 10px; }
  .ai-avatar { width: 42px; height: 42px; border-radius: 13px; }
  .ai-avatar img, .ai-avatar img.ai-avatar-img { border-radius: 10px; }
  .header-actions { gap: 6px; }
  .tts-toggle, .handoff-toggle { height: 36px; }
  .tts-toggle { width: 36px; min-width: 36px; border-radius: 11px; }
  .handoff-toggle { min-width: 0; padding: 0 10px; border-radius: 11px; font-size: 12px; }
  .messages-area { padding: 20px 12px; }
  .message-content { max-width: 86%; }
  .message-bubble { padding: 11px 13px; font-size: 14px; border-radius: 14px; }
  .input-area { padding: 10px 12px calc(10px + env(safe-area-inset-bottom,0px)); gap: 8px; }
  .voice-button, .send-button { width: 40px; height: 40px; min-width: 40px; border-radius: 12px; }
  .message-input { min-height: 40px; padding: 9px 12px; font-size: 14px; }
}

/* Final glass material pass. Keep this last to override legacy rules. */
.chat-header {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  background: color-mix(in srgb, var(--chat-theme) 82%, #0b2f25);
  border-bottom: 1px solid rgba(255,255,255,.34);
  box-shadow: inset 0 -1px 0 rgba(255,255,255,.14);
}
.chat-header::before {
  content: "";
  position: absolute;
  inset: -42% 28% -62% -8%;
  z-index: -1;
  background: radial-gradient(circle, rgba(255,255,255,.28), rgba(255,255,255,0) 68%);
  filter: blur(14px);
  opacity: .7;
  pointer-events: none;
}
.chat-header::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(115deg, rgba(255,255,255,.15), transparent 42%, rgba(255,255,255,.06));
  pointer-events: none;
}
.header-content { position: relative; z-index: 1; }
.tts-toggle, .handoff-toggle {
  display: inline-grid;
  place-items: center;
  box-sizing: border-box;
  min-height: 40px;
  border: 1px solid rgba(255,255,255,.46);
  background: rgba(255,255,255,.16);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.22), inset 0 -8px 18px rgba(0,33,23,.09);
  backdrop-filter: blur(18px) saturate(155%);
  -webkit-backdrop-filter: blur(18px) saturate(155%);
  transition: transform .2s ease, background-color .2s ease, border-color .2s ease;
}
.tts-toggle { width: 40px; min-width: 40px; padding: 0; aspect-ratio: 1; }
.intent-toggle, .human-toggle { min-width: 72px; padding: 0 12px; }
.tts-toggle:hover, .handoff-toggle:hover { transform: translateY(-2px); background: rgba(255,255,255,.28); border-color: rgba(255,255,255,.78); }
.voice-button, .send-button {
  display: grid;
  place-items: center;
  box-sizing: border-box;
  width: 46px;
  min-width: 46px;
  height: 46px;
  min-height: 46px;
  aspect-ratio: 1 / 1;
  padding: 0;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,.8);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.7), inset 0 -10px 18px rgba(0,40,28,.08), 0 6px 14px rgba(12,57,42,.14);
  transition: transform .2s ease, box-shadow .2s ease, background-color .2s ease;
}
.voice-button { color: var(--chat-theme); background: rgba(255,255,255,.72); backdrop-filter: blur(16px) saturate(145%); -webkit-backdrop-filter: blur(16px) saturate(145%); }
.send-button { color: #fff; background: color-mix(in srgb, var(--chat-theme) 90%, #073326); border-color: color-mix(in srgb, var(--chat-theme) 52%, white); }
.voice-button:hover, .send-button:hover { transform: translateY(-2px); box-shadow: inset 0 1px 0 rgba(255,255,255,.76), inset 0 -10px 18px rgba(0,40,28,.12), 0 9px 18px rgba(12,57,42,.2); }
.voice-button:active, .send-button:active { transform: translateY(0) scale(.96); }
.voice-button svg, .send-button svg { width: 21px; height: 21px; stroke-width: 1.9; }
.chat-authority-panel {
  border: 1px solid rgba(255,255,255,.58);
  background: rgba(255,255,255,.38);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.65), inset 0 -12px 22px rgba(24,93,65,.05);
  backdrop-filter: blur(20px) saturate(145%);
  -webkit-backdrop-filter: blur(20px) saturate(145%);
}
.chat-authority-head, .chat-citation-list, .chat-citation-empty, .chat-risk-boundaries { display: none !important; }
.chat-ai-note { display: inline-flex; align-items: center; gap: 7px; margin: 1px 0 8px; color: rgba(46,76,65,.72); font-size: 11px; line-height: 1.45; }
.chat-source-badge, .chat-note-dot { display: inline-grid; place-items: center; flex: 0 0 auto; width: 17px; height: 17px; border-radius: 50%; color: var(--chat-theme); background: rgba(255,255,255,.66); box-shadow: inset 0 1px 0 rgba(255,255,255,.8); }
.chat-source-badge { font-size: 11px; }
.chat-note-dot { width: 6px; height: 6px; margin-left: 5px; background: color-mix(in srgb, var(--chat-theme) 60%, white); }
@media (max-width: 520px) {
  .tts-toggle { width: 36px; min-width: 36px; height: 36px; min-height: 36px; }
  .intent-toggle, .human-toggle { min-width: 0; padding: 0 10px; }
  .voice-button, .send-button { width: 42px; min-width: 42px; height: 42px; min-height: 42px; border-radius: 13px; }
}
@media (prefers-reduced-motion: reduce) {
  .tts-toggle, .handoff-toggle, .voice-button, .send-button { transition: none; }
  .chat-header::before { filter: none; }
}

/* Embedded mall chat keeps its compact host surface. */
body.chat-embed .chat-container { max-width: none; margin: 0; height: 100%; min-height: 100%; border: 0; border-radius: 0; box-shadow: none; }
body.chat-embed .chat-header { display: none; }
body.chat-embed .messages-area { background: #f5f5f7; padding: 12px 14px 8px; }
body.chat-embed .message.ai .message-bubble { background: #fff; border: 1px solid rgba(0,0,0,.06); color: #1d1d1f; box-shadow: 0 1px 3px rgba(0,0,0,.04); }
body.chat-embed .message.user .message-bubble { background: #1d1d1f; border-color: #1d1d1f; color: #fff; }
body.chat-embed .input-area { border-top: 1px solid rgba(0,0,0,.08); padding: 10px 12px calc(10px + env(safe-area-inset-bottom,0px)); background: #fff; backdrop-filter: none; -webkit-backdrop-filter: none; }
body.chat-embed .message-input { border: 1px solid rgba(0,0,0,.12); border-radius: 12px; background: #f5f5f7; color: #1d1d1f; }
body.chat-embed .voice-button { background: #f5f5f7; border-color: rgba(0,0,0,.08); box-shadow: none; }
body.chat-embed .send-button { border: 0; border-radius: 12px; box-shadow: none; }

.intent-conversation-panel {
    margin-top: 10px;
    padding: 12px;
    border: 1px solid color-mix(in srgb, var(--chat-theme) 24%, white);
    border-radius: 14px;
    background: rgba(255,255,255,.52);
    color: #18332b;
    position: relative;
    z-index: 2;
}
.intent-conversation-panel > strong { display: block; margin-bottom: 8px; font-size: 13px; }
.intent-conversation-row { display: flex; justify-content: space-between; gap: 12px; padding: 4px 0; font-size: 12px; }
.intent-conversation-row span { color: #58736a; }
.intent-conversation-row b { text-align: right; overflow-wrap: anywhere; }
.intent-conversation-consent { display: flex; align-items: flex-start; gap: 8px; margin-top: 10px; font-size: 12px; line-height: 1.4; }
.intent-conversation-consent input { margin-top: 2px; accent-color: var(--chat-theme); }
.intent-conversation-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.intent-conversation-actions button:disabled { cursor: not-allowed; opacity: .45; }
.intent-share-panel { display: flex; align-items: center; gap: 12px; margin-top: 10px; padding: 10px; border: 1px solid rgba(255,255,255,.8); border-radius: 14px; background: rgba(255,255,255,.55); }
.intent-share-panel canvas { width: 92px; height: 92px; padding: 5px; border-radius: 9px; background: #fff; }
.intent-share-copy { display: flex; flex-direction: column; gap: 6px; font-size: 12px; }
.intent-share-copy a { color: color-mix(in srgb, var(--chat-theme) 82%, #12352a); font-weight: 650; text-decoration: none; }

/* Embedded mall chat keeps its compact host surface while the full customer
   page uses the glass shell above. */
body.chat-embed .chat-container { max-width: none; margin: 0; height: 100%; min-height: 100%; border: 0; border-radius: 0; box-shadow: none; }
body.chat-embed .chat-header { display: none; }
body.chat-embed .messages-area { background: #f5f5f7; padding: 12px 14px 8px; }
body.chat-embed .message.ai .message-bubble { background: #fff; border: 1px solid rgba(0,0,0,.06); color: #1d1d1f; box-shadow: 0 1px 3px rgba(0,0,0,.04); }
body.chat-embed .message.user .message-bubble { background: #1d1d1f; border-color: #1d1d1f; color: #fff; }
body.chat-embed .input-area { border-top: 1px solid rgba(0,0,0,.08); padding: 10px 12px calc(10px + env(safe-area-inset-bottom,0px)); background: #fff; backdrop-filter: none; -webkit-backdrop-filter: none; }
body.chat-embed .message-input { border: 1px solid rgba(0,0,0,.12); border-radius: 12px; background: #f5f5f7; color: #1d1d1f; }
body.chat-embed .voice-button { background: #f5f5f7; border-color: rgba(0,0,0,.08); box-shadow: none; }
body.chat-embed .send-button { border: 0; border-radius: 12px; box-shadow: none; }

/* ──────────────────────────────────────────────────────────────────────────
   Customer chat visual system v2
   One control rail, one glass language, predictable touch targets.
   ────────────────────────────────────────────────────────────────────────── */
:root {
    --chat-ink: #18332b;
    --chat-ink-muted: #58736a;
    --chat-glass-white: rgba(255, 255, 255, .62);
    --chat-glass-solid: rgba(255, 255, 255, .84);
    --chat-glass-line: rgba(255, 255, 255, .78);
    --chat-glass-shadow-sm: 0 5px 12px rgba(23, 61, 48, .11);
}

body {
    background:
        radial-gradient(80% 65% at 8% 0%, color-mix(in srgb, var(--chat-theme) 17%, transparent), transparent 70%),
        radial-gradient(75% 60% at 95% 100%, color-mix(in srgb, var(--chat-theme) 12%, transparent), transparent 68%),
        #edf5f1;
    color: var(--chat-ink);
}

.chat-container {
    background: rgba(247, 251, 249, .48);
    backdrop-filter: blur(28px) saturate(145%);
    -webkit-backdrop-filter: blur(28px) saturate(145%);
}

.chat-header {
    padding: 14px clamp(16px, 3vw, 36px);
    background: color-mix(in srgb, var(--chat-theme) 84%, #15352d);
    border-bottom: 1px solid rgba(255, 255, 255, .28);
    box-shadow: 0 8px 14px color-mix(in srgb, var(--chat-theme) 18%, transparent);
}

.header-content {
    width: min(100%, 1180px);
    min-height: 52px;
    gap: 14px;
}

.ai-avatar {
    width: 50px;
    height: 50px;
    border-radius: 16px;
    padding: 2px;
    background: rgba(255, 255, 255, .86);
    border: 1px solid rgba(255, 255, 255, .7);
    box-shadow: 0 4px 10px rgba(9, 39, 29, .16);
}

.ai-avatar img { border-radius: 13px; padding: 7px; }
.ai-avatar img.ai-avatar-img { border-radius: 13px; }

.header-info {
    min-width: 0;
    flex: 1 1 auto;
    color: #fff;
}

.header-info h1 {
    margin: 0;
    color: #fff;
    font-size: clamp(16px, 1.5vw, 19px);
    line-height: 1.2;
    font-weight: 650;
    letter-spacing: -.01em;
}

.header-info .status-indicator { color: rgba(255, 255, 255, .78); }

.header-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    flex: 0 0 auto;
    margin-left: auto;
}

.header-actions button { margin: 0; }

.tts-toggle,
.handoff-toggle {
    height: 40px;
    border: 1px solid rgba(255, 255, 255, .38);
    color: #fff;
    background: rgba(255, 255, 255, .14);
    backdrop-filter: blur(12px) saturate(130%);
    -webkit-backdrop-filter: blur(12px) saturate(130%);
    transition: background-color .2s ease, border-color .2s ease, transform .2s ease;
}

.tts-toggle {
    width: 40px;
    min-width: 40px;
    padding: 0;
    border-radius: 12px;
}

.tts-toggle svg { width: 19px; height: 19px; }

.handoff-toggle {
    min-width: 70px;
    padding: 0 14px;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
}

.intent-toggle {
    background: rgba(255, 255, 255, .9);
    border-color: rgba(255, 255, 255, .95);
    color: color-mix(in srgb, var(--chat-theme) 80%, #12352a);
}

.human-toggle { background: rgba(6, 34, 26, .2); }

.tts-toggle:hover,
.handoff-toggle:hover {
    background: rgba(255, 255, 255, .25);
    border-color: rgba(255, 255, 255, .68);
    transform: translateY(-1px);
}

.intent-toggle:hover { background: #fff; }

.messages-area {
    background: transparent;
    padding: 30px max(16px, calc((100% - 980px) / 2));
    scrollbar-color: color-mix(in srgb, var(--chat-theme) 35%, transparent) transparent;
}

.message { margin-bottom: 18px; }

.message-avatar {
    width: 38px;
    height: 38px;
    border: 1px solid rgba(255, 255, 255, .9);
    box-shadow: var(--chat-glass-shadow-sm);
}

.message.ai .message-avatar { margin-right: 10px; }
.message.user .message-avatar { margin-left: 10px; }

.message-bubble {
    padding: 13px 16px;
    border-radius: 16px;
    font-size: 15px;
    line-height: 1.62;
    box-shadow: var(--chat-glass-shadow-sm);
    border: 1px solid var(--chat-glass-line);
    backdrop-filter: blur(17px) saturate(130%);
    -webkit-backdrop-filter: blur(17px) saturate(130%);
}

.message.ai .message-bubble {
    color: var(--chat-ink);
    background: var(--chat-glass-white);
}

.message.user .message-bubble {
    background: color-mix(in srgb, var(--chat-theme) 88%, #0d3d2d);
    border-color: color-mix(in srgb, var(--chat-theme) 70%, white);
    color: #fff;
}

.message-time { color: var(--chat-ink-muted); font-size: 11px; }

.input-area {
    gap: 10px;
    padding: 14px max(16px, calc((100% - 980px) / 2));
    background: rgba(255, 255, 255, .48);
    border-top: 1px solid rgba(255, 255, 255, .78);
    backdrop-filter: blur(24px) saturate(140%);
    -webkit-backdrop-filter: blur(24px) saturate(140%);
}

.voice-button,
.send-button {
    width: 44px;
    height: 44px;
    min-width: 44px;
    border-radius: 13px;
    border: 1px solid rgba(255, 255, 255, .88);
    box-shadow: var(--chat-glass-shadow-sm);
    transition: transform .2s ease, background-color .2s ease, color .2s ease;
}

.voice-button {
    color: var(--chat-ink-muted);
    background: rgba(255, 255, 255, .7);
}

.voice-button:hover { background: rgba(255, 255, 255, .94); color: var(--chat-theme); }

.send-button {
    background: var(--chat-theme);
    color: #fff;
    border-color: color-mix(in srgb, var(--chat-theme) 70%, white);
}

.send-button:hover { background: color-mix(in srgb, var(--chat-theme) 78%, #12392d); }

.message-input {
    min-height: 44px;
    padding: 11px 15px;
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, .9);
    color: var(--chat-ink);
    background: rgba(255, 255, 255, .76);
    box-shadow: inset 0 1px 1px rgba(24, 51, 43, .04);
}

.message-input::placeholder { color: #668178; }

@media (min-width: 769px) {
    .chat-container {
        max-width: 1240px;
        margin: 18px auto;
        height: calc(100vh - 36px);
        min-height: 600px;
        border: 1px solid rgba(255, 255, 255, .78);
        border-radius: 20px;
        overflow: hidden;
        box-shadow: 0 8px 14px rgba(24, 68, 51, .12);
    }
    .messages-area { padding-top: 34px; padding-bottom: 34px; }
}

@media (max-width: 520px) {
    .chat-header { padding: 11px 12px; }
    .header-content { gap: 10px; }
    .ai-avatar { width: 42px; height: 42px; border-radius: 13px; }
    .ai-avatar img, .ai-avatar img.ai-avatar-img { border-radius: 10px; }
    .header-actions { gap: 6px; }
    .tts-toggle, .handoff-toggle { height: 36px; }
    .tts-toggle { width: 36px; min-width: 36px; border-radius: 11px; }
    .handoff-toggle { min-width: 0; padding: 0 10px; border-radius: 11px; font-size: 12px; }
    .messages-area { padding: 20px 12px; }
    .message-content { max-width: 86%; }
    .message-bubble { padding: 11px 13px; font-size: 14px; border-radius: 14px; }
    .input-area { padding: 10px 12px calc(10px + env(safe-area-inset-bottom, 0px)); gap: 8px; }
    .voice-button, .send-button { width: 40px; height: 40px; min-width: 40px; border-radius: 12px; }
    .message-input { min-height: 40px; padding: 9px 12px; font-size: 14px; }
}

@media (prefers-reduced-motion: reduce) {
    .tts-toggle, .handoff-toggle, .voice-button, .send-button { transition: none; }
}

/* PC端优化 */
@media (min-width: 769px) {
    .chat-container {
        max-width: 1400px;
        box-shadow: 0 0 20px rgba(0, 0, 0, 0.1);
    }
}

/* Chat Header - BYD Dark Gray Style */
.chat-header {
    background-color: var(--primary-dark);
    color: white;
    padding: 16px 24px;
    box-shadow: var(--shadow-subtle);
    z-index: 10;
}

.header-content {
    display: flex;
    align-items: center;
    gap: 16px;
    max-width: 1200px;
    margin: 0 auto;
}

.ai-avatar {
    width: 48px;
    height: 48px;
    border-radius: 4px;
    overflow: hidden;
    flex-shrink: 0;
    background-color: white;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ai-avatar img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 8px;
}

/* Custom avatar from channel - no padding needed */
.ai-avatar img.ai-avatar-img {
    padding: 0;
    object-fit: cover;
    border-radius: 4px;
}

.header-info h1 {
    font-size: 18px;
    font-weight: 400;
    margin-bottom: 4px;
    letter-spacing: 0.5px;
}

.status-indicator {
    font-size: 13px;
    opacity: 0.8;
    font-weight: 300;
}

.status-indicator::before {
    content: '';
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: #4ade80;
    margin-right: 6px;
    animation: pulse 2s infinite;
}

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

/* Messages Area */
.messages-area {
    flex: 1;
    overflow-y: auto;
    padding: 24px 16px;
    background-color: var(--background-light);
    max-width: 100%;
    width: 100%;
    margin: 0 auto;
}

/* PC端消息区域优化 */
@media (min-width: 769px) {
    .messages-area {
        padding: 32px 10%;
    }
}

.message {
    display: flex;
    margin-bottom: 20px;
    animation: slideIn 0.3s ease;
    align-items: flex-start;
}

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

.message.user {
    justify-content: flex-end;
}

.message.ai {
    justify-content: flex-start;
}

/* Avatar in message */
.message-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    flex-shrink: 0;
    overflow: hidden;
    background-color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.message-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* AI Avatar Image - Custom avatar from channel */
.message-avatar .ai-avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
    background-color: white;
}

/* Default SVG logo padding */
.message-avatar img:not(.ai-avatar-img) {
    padding: 6px;
    object-fit: contain;
}

.message.ai .message-avatar {
    margin-right: 12px;
}

.message.user .message-avatar {
    margin-left: 12px;
    background-color: var(--primary-gray);
    color: white;
    font-weight: 400;
    font-size: 14px;
}

.message-content {
    display: flex;
    flex-direction: column;
    max-width: 80%;
}

/* PC端消息宽度优化 */
@media (min-width: 769px) {
    .message-content {
        max-width: 60%;
    }
}

@media (min-width: 1200px) {
    .message-content {
        max-width: 50%;
    }
}

.message.user .message-content {
    align-items: flex-end;
}

.message.ai .message-content {
    align-items: flex-start;
}

.message-bubble {
    padding: 12px 16px;
    border-radius: 8px;
    word-wrap: break-word;
    position: relative;
    line-height: 1.6;
    font-size: 15px;
    font-weight: 300;
    box-shadow: var(--shadow-subtle);
}

.message.user .message-bubble {
    background-color: var(--primary-gray);
    color: white;
}

.message.ai .message-bubble {
    background-color: white;
    color: var(--text-dark);
    border: 1px solid var(--border-light);
}

.chat-authority-panel {
    width: 100%;
    margin-top: 8px;
    padding: 10px;
    border: 1px solid #d9e2e7;
    border-radius: 8px;
    background: #f7fafb;
    color: var(--text-dark);
    box-shadow: 0 1px 4px rgba(20, 35, 45, 0.05);
}

.chat-authority-head {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--text-gray);
    margin-bottom: 8px;
}

.chat-authority-head span {
    font-weight: 600;
    color: var(--text-dark);
}

.chat-authority-head strong {
    padding: 2px 6px;
    border-radius: 999px;
    background: #e7f4ec;
    color: #17653a;
    font-size: 11px;
}

.chat-authority-head em {
    margin-left: auto;
    font-style: normal;
    color: #8a4b00;
    font-size: 11px;
}

.chat-citation-list {
    display: grid;
    gap: 6px;
}

.chat-citation-item {
    display: grid;
    grid-template-columns: 22px 1fr;
    gap: 8px;
    align-items: start;
    padding: 7px;
    border-radius: 6px;
    background: white;
    border: 1px solid #e4eaee;
}

.chat-citation-item > span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--primary-dark);
    color: white;
    font-size: 11px;
}

.chat-citation-item strong {
    display: block;
    font-size: 12px;
    line-height: 1.35;
    color: var(--text-dark);
}

.chat-citation-item small {
    display: block;
    margin-top: 2px;
    font-size: 11px;
    color: var(--text-gray);
}

.chat-citation-empty {
    padding: 8px;
    border-radius: 6px;
    background: #fff8ec;
    color: #744100;
    font-size: 12px;
}

.chat-next-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

.chat-action-button {
    border: 1px solid #d4dde3;
    border-radius: 6px;
    background: white;
    color: var(--text-dark);
    padding: 7px 10px;
    font-size: 12px;
    line-height: 1;
    cursor: pointer;
}

.chat-action-button:hover {
    border-color: var(--primary-gray);
}

.chat-action-button.tone-primary {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
    color: white;
}

.chat-action-button.tone-warning {
    border-color: #f0c36d;
    background: #fff7e5;
    color: #774500;
}

.chat-product-cards {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 12px;
}

.chat-product-cards-title {
    font-size: 12px;
    font-weight: 600;
    color: #6e6e73;
    letter-spacing: 0.02em;
}

.chat-product-card {
    display: flex;
    gap: 12px;
    padding: 10px;
    border-radius: 12px;
    border: 1px solid rgba(0, 0, 0, 0.08);
    background: #fff;
    text-decoration: none;
    color: inherit;
    transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.chat-product-card:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
    transform: translateY(-1px);
}

.chat-product-card-media {
    width: 72px;
    height: 72px;
    flex-shrink: 0;
    border-radius: 10px;
    overflow: hidden;
    background: #f5f5f7;
}

.chat-product-card-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.chat-product-card-body {
    min-width: 0;
    flex: 1;
}

.chat-product-card-body strong {
    display: block;
    font-size: 14px;
    line-height: 1.35;
    margin-bottom: 4px;
}

.chat-product-card-body p {
    font-size: 12px;
    line-height: 1.45;
    color: #6e6e73;
    margin: 0 0 6px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.chat-product-card-price {
    font-size: 14px;
    font-weight: 600;
    color: #1d1d1f;
}

.chat-risk-boundaries {
    margin-top: 8px;
    font-size: 12px;
    color: var(--text-gray);
}

.chat-risk-boundaries summary {
    cursor: pointer;
    color: var(--text-dark);
}

.chat-risk-boundaries ul {
    margin: 6px 0 0 18px;
}

.message-time {
    font-size: 12px;
    color: var(--text-light);
    margin-top: 6px;
    padding: 0 4px;
    font-weight: 300;
}

/* Typing Indicator - Spinner Loading */
.typing-indicator {
    display: flex;
    gap: 8px;
    padding: 16px 20px;
    align-items: center;
}

.typing-spinner {
    width: 20px;
    height: 20px;
    border: 2.5px solid rgba(43, 43, 43, 0.1);
    border-top-color: var(--primary-gray);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.thinking-text {
    font-size: 14px;
    color: var(--text-light);
    font-weight: 300;
    margin-left: 4px;
}

/* Input Area */
.input-area {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 24px;
    background-color: white;
    border-top: 1px solid var(--border-light);
    max-width: 100%;
    width: 100%;
    margin: 0 auto;
}

/* PC端输入区域优化 */
@media (min-width: 769px) {
    .input-area {
        padding: 20px 10%;
    }
}

.voice-button,
.send-button {
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
    border: none;
    border-radius: 4px;
    background-color: var(--background-light);
    color: var(--text-gray);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.2s ease;
}

.voice-button:hover {
    background-color: #e8e8e8;
}

.voice-button:active,
.send-button:active {
    transform: scale(0.95);
}

.send-button {
    background-color: var(--primary-dark);
    color: white;
}

.send-button:hover {
    background-color: var(--primary-gray);
}

/* PC端按钮优化 */
@media (min-width: 769px) {
    .voice-button,
    .send-button {
        width: 48px;
        height: 48px;
        min-width: 48px;
        min-height: 48px;
    }
}

.text-input-container {
    flex: 1;
    display: flex;
    align-items: center;
}

.message-input {
    width: 100%;
    min-height: 44px;
    max-height: 120px;
    padding: 11px 16px;
    border: 1px solid var(--border-light);
    border-radius: 4px;
    font-size: 15px;
    font-family: inherit;
    font-weight: 300;
    resize: none;
    overflow-y: auto;
    background-color: var(--background-light);
    transition: border-color 0.3s ease;
    line-height: 1.5;
}

.message-input:focus {
    border-color: var(--primary-dark);
    background-color: white;
}

.message-input::placeholder {
    color: var(--text-light);
}

/* PC端输入框优化 */
@media (min-width: 769px) {
    .message-input {
        min-height: 48px;
        max-height: 150px;
        font-size: 16px;
        padding: 13px 16px;
    }
}

/* Voice Recording */
.voice-recording {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background-color: var(--accent-red);
    color: white;
    padding: 16px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    z-index: 100;
}

.recording-indicator {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 300;
}

.recording-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: white;
    animation: pulse 1s infinite;
}

/* Scrollbar Styling */
.messages-area::-webkit-scrollbar {
    width: 6px;
}

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

.messages-area::-webkit-scrollbar-thumb {
    background: #d0d0d0;
    border-radius: 3px;
}

.messages-area::-webkit-scrollbar-thumb:hover {
    background: #b0b0b0;
}

/* Responsive Design */
@media (max-width: 768px) {
    .chat-header {
        padding: 14px 16px;
    }
    
    .header-content {
        gap: 12px;
    }
    
    .ai-avatar {
        width: 40px;
        height: 40px;
    }
    
    .header-info h1 {
        font-size: 16px;
    }
    
    .messages-area {
        padding: 16px 12px;
    }
    
    .message-content {
        max-width: 85%;
    }
    
    .message-bubble {
        font-size: 14px;
        padding: 10px 12px;
    }
    
    .input-area {
        padding: 12px 16px;
        gap: 10px;
    }
    
    .voice-button,
    .send-button {
        width: 40px;
        height: 40px;
    }
    
    .message-input {
        font-size: 14px;
        min-height: 40px;
    }
}

/* 超小屏幕优化 */
@media (max-width: 375px) {
    .header-info h1 {
        font-size: 15px;
    }
    
    .message-content {
        max-width: 90%;
    }
    
    .message-bubble {
        font-size: 13px;
    }
}

/* 大屏幕优化 */
@media (min-width: 1400px) {
    .messages-area {
        padding: 32px 15%;
    }
    
    .input-area {
        padding: 20px 15%;
    }
    
    .message-content {
        max-width: 45%;
    }
}


/* Markdown Styles for AI Messages */
.message.ai .message-bubble p {
    margin: 0.5em 0;
}

.message.ai .message-bubble p:first-child {
    margin-top: 0;
}

.message.ai .message-bubble p:last-child {
    margin-bottom: 0;
}

.message.ai .message-bubble h1,
.message.ai .message-bubble h2,
.message.ai .message-bubble h3,
.message.ai .message-bubble h4 {
    margin: 1em 0 0.5em 0;
    font-weight: 600;
    color: var(--primary-dark);
}

.message.ai .message-bubble h1:first-child,
.message.ai .message-bubble h2:first-child,
.message.ai .message-bubble h3:first-child,
.message.ai .message-bubble h4:first-child {
    margin-top: 0;
}

.message.ai .message-bubble ul,
.message.ai .message-bubble ol {
    margin: 0.5em 0;
    padding-left: 1.5em;
}

.message.ai .message-bubble li {
    margin: 0.3em 0;
    line-height: 1.6;
}

.message.ai .message-bubble code {
    background-color: rgba(0, 0, 0, 0.05);
    padding: 0.2em 0.4em;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
}

.message.ai .message-bubble pre {
    background-color: rgba(0, 0, 0, 0.05);
    padding: 1em;
    border-radius: 6px;
    overflow-x: auto;
    margin: 0.5em 0;
}

.message.ai .message-bubble pre code {
    background-color: transparent;
    padding: 0;
}

.message.ai .message-bubble blockquote {
    border-left: 3px solid var(--primary-dark);
    padding-left: 1em;
    margin: 0.5em 0;
    color: #666;
}

.message.ai .message-bubble strong {
    font-weight: 600;
    color: var(--primary-dark);
}

.message.ai .message-bubble em {
    font-style: italic;
}

.message.ai .message-bubble a {
    color: var(--primary-dark);
    text-decoration: underline;
}

.message.ai .message-bubble hr {
    border: none;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
    margin: 1em 0;
}

.message.ai .message-bubble table {
    border-collapse: collapse;
    width: 100%;
    margin: 0.5em 0;
}

.message.ai .message-bubble th,
.message.ai .message-bubble td {
    border: 1px solid rgba(0, 0, 0, 0.1);
    padding: 0.5em;
    text-align: left;
}

.message.ai .message-bubble th {
    background-color: rgba(0, 0, 0, 0.05);
    font-weight: 600;
}

/* History Divider */
.history-divider {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 20px 0;
    padding: 0 20px;
}

.history-divider::before,
.history-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: linear-gradient(to right, transparent, #ccc, transparent);
}

.history-divider span {
    color: #999;
    font-size: 12px;
    padding: 0 16px;
    white-space: nowrap;
}

/* Quick Questions in Welcome Bubble */
.welcome-message .message-bubble a[href^="#q"] {
    display: inline-block;
    background-color: #f5f5f5;
    color: var(--primary-dark);
    padding: 6px 14px;
    border-radius: 16px;
    text-decoration: none;
    font-size: 14px;
    margin: 4px 4px 4px 0;
    transition: all 0.2s ease;
    border: 1px solid var(--border-light);
}

.welcome-message .message-bubble a[href^="#q"]:hover {
    background-color: var(--primary-dark);
    color: white;
    border-color: var(--primary-dark);
}

.welcome-message .message-bubble a[href^="#q"]:active {
    transform: scale(0.96);
}

/* Quick Questions */
.quick-questions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding: 12px 0;
    margin: 8px 0 16px 52px;
}

.quick-question-btn {
    background-color: white;
    border: 1px solid var(--border-light);
    border-radius: 20px;
    padding: 8px 16px;
    font-size: 14px;
    font-weight: 300;
    color: var(--text-dark);
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.quick-question-btn:hover {
    background-color: var(--primary-dark);
    color: white;
    border-color: var(--primary-dark);
}

.quick-question-btn:active {
    transform: scale(0.96);
}

/* 移动端快捷问题优化 */
@media (max-width: 768px) {
    .quick-questions {
        margin: 8px 0 16px 0;
        padding: 12px 0;
    }
    
    .quick-question-btn {
        font-size: 13px;
        padding: 6px 12px;
    }
}

.handoff-toggle {
    margin-left: auto;
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.35);
    border-radius: 4px;
    padding: 6px 10px;
    font-size: 13px;
    cursor: pointer;
}
.handoff-toggle:hover {
    background: rgba(255, 255, 255, 0.22);
}

/* 渠道客服统一视觉：轻量液态玻璃，仅用于真实交互层，不改变信息结构。 */
:root {
    --chat-theme: var(--accent-red, #0b8f4d);
    --chat-glass-surface: rgba(255, 255, 255, 0.72);
    --chat-glass-border: rgba(255, 255, 255, 0.72);
    --chat-glass-shadow: 0 18px 48px rgba(16, 55, 42, 0.12);
}

body {
    background:
        radial-gradient(circle at 8% 8%, color-mix(in srgb, var(--chat-theme) 15%, transparent), transparent 34%),
        radial-gradient(circle at 92% 86%, color-mix(in srgb, var(--chat-theme) 10%, transparent), transparent 38%),
        #edf5f1;
}

.chat-container {
    background: rgba(245, 250, 248, 0.78);
    backdrop-filter: blur(22px) saturate(135%);
    -webkit-backdrop-filter: blur(22px) saturate(135%);
}

.chat-header {
    background: color-mix(in srgb, var(--chat-theme) 88%, #0b2435);
    border-bottom: 1px solid rgba(255, 255, 255, 0.24);
    box-shadow: 0 8px 24px color-mix(in srgb, var(--chat-theme) 18%, transparent);
    backdrop-filter: blur(18px) saturate(135%);
    -webkit-backdrop-filter: blur(18px) saturate(135%);
}

.messages-area {
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.34), rgba(237, 245, 241, 0.58)),
        transparent;
}

.message-bubble,
.chat-product-card,
.chat-authority-panel {
    border-color: var(--chat-glass-border);
    background: var(--chat-glass-surface);
    box-shadow: var(--chat-glass-shadow);
    backdrop-filter: blur(16px) saturate(125%);
    -webkit-backdrop-filter: blur(16px) saturate(125%);
}

.message.user .message-bubble,
.quick-question-btn:hover,
.chat-action-button.tone-primary {
    background: var(--chat-theme);
    border-color: var(--chat-theme);
}

.quick-question-btn,
.chat-action-button,
.message-input,
.voice-button,
.send-button {
    border-radius: 14px;
}

.input-area {
    border-top-color: rgba(255, 255, 255, 0.76);
    background: rgba(255, 255, 255, 0.66);
    backdrop-filter: blur(22px) saturate(135%);
    -webkit-backdrop-filter: blur(22px) saturate(135%);
}

.message-input {
    border-color: rgba(255, 255, 255, 0.9);
    background: rgba(255, 255, 255, 0.78);
}

.message-input:focus {
    border-color: var(--chat-theme);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--chat-theme) 18%, transparent);
}

.send-button {
    background: var(--chat-theme);
}

.send-button:hover {
    background: color-mix(in srgb, var(--chat-theme) 82%, #0b2435);
}

.handoff-toggle {
    border-color: rgba(255, 255, 255, 0.42);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.16);
}

@media (min-width: 769px) {
    .chat-container {
        max-width: 1440px;
        margin: 16px auto;
        height: calc(100vh - 32px);
        min-height: 620px;
        border: 1px solid var(--chat-glass-border);
        border-radius: 24px;
        overflow: hidden;
        box-shadow: var(--chat-glass-shadow);
    }
}

@media (prefers-reduced-transparency: reduce) {
    .chat-container,
    .chat-header,
    .message-bubble,
    .chat-product-card,
    .chat-authority-panel,
    .input-area {
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
    }
}

/* Mall embed — light theme aligned with homepage */
html.chat-embed-root,
html:has(body.chat-embed),
body.chat-embed {
  height: 100%;
  min-height: 100%;
  overflow: hidden;
  background: #f5f5f7;
}

body.chat-embed #app {
  height: 100%;
  min-height: 100%;
  overflow: hidden;
}

body.chat-embed .chat-container {
  height: 100%;
  min-height: 100%;
  max-width: none;
  box-shadow: none;
  background: #f5f5f7;
  display: flex;
  flex-direction: column;
}

body.chat-embed .chat-header {
  display: none;
}

body.chat-embed .messages-area {
  background: transparent;
  padding: 12px 14px 8px;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  touch-action: pan-y;
}

body.chat-embed .message.ai .message-bubble {
  background: #fff;
  border: 1px solid rgba(0, 0, 0, 0.06);
  color: #1d1d1f;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

body.chat-embed .message.user .message-bubble {
  background: #1d1d1f;
  color: #fff;
}

body.chat-embed .input-area {
  border-top: 1px solid rgba(0, 0, 0, 0.08);
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom, 0px));
  background: #fff;
}

body.chat-embed .message-input {
  border-radius: 12px;
  border: 1px solid rgba(0, 0, 0, 0.12);
  background: #f5f5f7;
}

body.chat-embed .message-input:focus {
  border-color: #0071e3;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(0, 113, 227, 0.12);
}

body.chat-embed .send-button {
  border-radius: 10px;
  background-color: #1d1d1f;
}

body.chat-embed .send-button:hover {
  background-color: #333;
}

body.chat-embed .voice-button {
  border-radius: 10px;
  background: #f5f5f7;
}

body.chat-embed .welcome-section {
  background: #fff;
  border: 1px solid rgba(0, 0, 0, 0.06);
  border-radius: 12px;
}

body.chat-embed .quick-question-btn {
  border-radius: 999px;
  border-color: rgba(0, 0, 0, 0.1);
  background: #fff;
}

/* PC 商城弹窗：只展示 AI 回复，隐藏底部输入栏 */
body.chat-embed-panel .input-area,
body.chat-embed-panel .voice-recording {
  display: none !important;
}

body.chat-embed-panel .messages-area {
  padding-bottom: 16px;
}

body.chat-embed .chat-product-card {
  background: #fff;
}

body.chat-embed-panel .chat-product-card {
  cursor: pointer;
}

.chat-embed-mall-bar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  min-height: 48px;
  padding: max(10px, env(safe-area-inset-top)) 14px 10px;
  background: rgba(255, 255, 255, 0.92);
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  flex-shrink: 0;
}

.chat-embed-mall-back {
  justify-self: start;
  color: #0071e3;
  text-decoration: none;
  font-size: 14px;
  white-space: nowrap;
}

.chat-embed-mall-title {
  grid-column: 2;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
  color: #1d1d1f;
  white-space: nowrap;
}

.chat-embed-ai-badge {
  flex-shrink: 0;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: #fff;
  background: linear-gradient(135deg, #0071e3, #5856d6);
  padding: 3px 6px;
  border-radius: 6px;
}

.chat-embed-mall-sound {
  justify-self: end;
  border: none;
  background: rgba(0, 0, 0, 0.04);
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #6e6e73;
  position: relative;
  transition: background 0.2s ease, opacity 0.2s ease;
}

.chat-embed-mall-sound:hover {
  background: rgba(0, 0, 0, 0.08);
}

.chat-embed-mall-sound:focus {
  outline: none;
}

.chat-embed-mall-sound:focus-visible {
  box-shadow: 0 0 0 3px rgba(0, 113, 227, 0.25);
}

.chat-embed-mall-sound.muted,
.chat-embed-mall-sound.is-muted {
  opacity: 0.45;
}

.chat-embed-mall-sound.muted svg path:last-child,
.chat-embed-mall-sound.is-muted svg path:last-child {
  opacity: 0.35;
}

.chat-embed-mall-sound.muted::after,
.chat-embed-mall-sound.is-muted::after {
  content: '';
  position: absolute;
  width: 2px;
  height: 22px;
  background: #86868b;
  transform: rotate(-45deg);
  border-radius: 1px;
  pointer-events: none;
}

body.chat-embed-with-bar {
  display: flex;
  flex-direction: column;
}

body.chat-embed-with-bar #app {
  flex: 1 1 auto;
  min-height: 0;
  height: auto;
}

/* 移动端全屏客服页 — 与 PC 商城弹窗视觉一致 */
body.chat-embed-with-bar:not(.chat-embed-panel) {
  background: #f5f5f7;
}

body.chat-embed-with-bar:not(.chat-embed-panel) .chat-container {
  background: #f5f5f7;
}

body.chat-embed-with-bar:not(.chat-embed-panel) .messages-area {
  padding: 14px 16px 10px;
}

body.chat-embed-with-bar:not(.chat-embed-panel) .input-area {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 12px calc(12px + env(safe-area-inset-bottom, 0px));
  padding: 6px 6px 6px 14px;
  border: none;
  border-top: none;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 2px 16px rgba(0, 0, 0, 0.08);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

body.chat-embed-with-bar:not(.chat-embed-panel) .text-input-container {
  flex: 1;
  min-width: 0;
}

body.chat-embed-with-bar:not(.chat-embed-panel) .message-input {
  border: none;
  border-radius: 0;
  background: transparent;
  padding: 8px 0;
  font-size: 15px;
  box-shadow: none;
  outline: none;
}

body.chat-embed-with-bar:not(.chat-embed-panel) .message-input:focus {
  border: none;
  background: transparent;
  box-shadow: none;
  outline: none;
}

body.chat-embed-with-bar:not(.chat-embed-panel) .message-input:focus-visible {
  outline: none;
}

body.chat-embed-with-bar:not(.chat-embed-panel) .voice-button:focus,
body.chat-embed-with-bar:not(.chat-embed-panel) .send-button:focus {
  outline: none;
}

body.chat-embed-with-bar:not(.chat-embed-panel) .voice-button:focus-visible,
body.chat-embed-with-bar:not(.chat-embed-panel) .send-button:focus-visible {
  box-shadow: 0 0 0 3px rgba(0, 113, 227, 0.2);
}

body.chat-embed-with-bar:not(.chat-embed-panel) .voice-button {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.04);
  color: #6e6e73;
}

body.chat-embed-with-bar:not(.chat-embed-panel) .send-button {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: #0071e3;
  color: #fff;
}

body.chat-embed-with-bar:not(.chat-embed-panel) .send-button:hover {
  background: #0077ed;
}

body.chat-embed-with-bar:not(.chat-embed-panel) .send-button svg {
  width: 18px;
  height: 18px;
}

body.chat-embed-with-bar:not(.chat-embed-panel) .welcome-section {
  border-radius: 16px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

body.chat-embed-with-bar:not(.chat-embed-panel) .message.ai .message-bubble {
  border-radius: 16px 16px 16px 4px;
}

body.chat-embed-with-bar:not(.chat-embed-panel) .message.user .message-bubble {
  border-radius: 16px 16px 4px 16px;
  background: #0071e3;
}

@media (prefers-color-scheme: dark) {
  body.chat-embed {
    background: #1c1c1e;
  }

  body.chat-embed .chat-container {
    background: #1c1c1e;
  }

  body.chat-embed .message.ai .message-bubble {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.1);
    color: #f5f5f7;
  }

  body.chat-embed .input-area {
    background: #1c1c1e;
    border-top-color: rgba(255, 255, 255, 0.1);
  }

  body.chat-embed .message-input {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.12);
    color: #f5f5f7;
  }

  body.chat-embed-with-bar:not(.chat-embed-panel) .input-area {
    border: none;
    border-top: none;
    background: rgba(28, 28, 30, 0.96);
  }

  body.chat-embed-with-bar:not(.chat-embed-panel) .message-input {
    color: #f5f5f7;
  }

  body.chat-embed-with-bar:not(.chat-embed-panel) .voice-button {
    background: rgba(255, 255, 255, 0.08);
    color: #a1a1a6;
  }

  body.chat-embed-with-bar:not(.chat-embed-panel) .send-button {
    background: #0a84ff;
  }

  .chat-embed-mall-bar {
    background: rgba(28, 28, 30, 0.92);
    border-bottom-color: rgba(255, 255, 255, 0.1);
  }

  .chat-embed-mall-title {
    color: #f5f5f7;
  }

  .chat-embed-mall-back {
    color: #0a84ff;
  }

  .chat-embed-mall-sound {
    background: rgba(255, 255, 255, 0.08);
    color: #a1a1a6;
  }

  .chat-embed-mall-sound:hover {
    background: rgba(255, 255, 255, 0.12);
  }
}

/* v2 final cascade for normal customer chat */
.chat-header { padding: 14px clamp(16px, 3vw, 36px); background: color-mix(in srgb, var(--chat-theme) 84%, #15352d); border-bottom: 1px solid rgba(255,255,255,.28); }
.header-content { width: min(100%, 1180px); min-height: 52px; gap: 14px; }
.header-actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; flex: 0 0 auto; margin-left: auto; }
.header-actions button { margin: 0; }
.tts-toggle, .handoff-toggle { height: 40px; margin: 0; border: 1px solid rgba(255,255,255,.38); border-radius: 12px; color: #fff; background: rgba(255,255,255,.14); }
.tts-toggle { width: 40px; min-width: 40px; padding: 0; }
.tts-toggle svg { width: 19px; height: 19px; }
.handoff-toggle { min-width: 70px; padding: 0 14px; font-size: 13px; font-weight: 600; white-space: nowrap; }
.intent-toggle { color: color-mix(in srgb, var(--chat-theme) 80%, #12352a); background: rgba(255,255,255,.9); border-color: rgba(255,255,255,.95); }
.human-toggle { background: rgba(6,34,26,.2); }
.tts-toggle:hover, .handoff-toggle:hover { background: rgba(255,255,255,.26); border-color: rgba(255,255,255,.68); transform: translateY(-1px); }
.intent-toggle:hover { background: #fff; }
.ai-avatar { width: 50px; height: 50px; padding: 2px; border-radius: 16px; border: 1px solid rgba(255,255,255,.7); background: rgba(255,255,255,.86); box-shadow: 0 4px 10px rgba(9,39,29,.16); }
.ai-avatar img { border-radius: 13px; padding: 7px; }
.ai-avatar img.ai-avatar-img { border-radius: 13px; }
.header-info { min-width: 0; flex: 1 1 auto; color: #fff; }
.header-info h1 { margin: 0; color: #fff; font-size: clamp(16px,1.5vw,19px); line-height: 1.2; font-weight: 650; letter-spacing: -.01em; }
.messages-area { background: transparent; padding: 30px max(16px, calc((100% - 980px) / 2)); scrollbar-color: color-mix(in srgb, var(--chat-theme) 35%, transparent) transparent; }
.message { margin-bottom: 18px; }
.message-avatar { width: 38px; height: 38px; border: 1px solid rgba(255,255,255,.9); box-shadow: 0 5px 12px rgba(23,61,48,.11); }
.message.ai .message-avatar { margin-right: 10px; }
.message.user .message-avatar { margin-left: 10px; }
.message-bubble { padding: 13px 16px; border-radius: 16px; font-size: 15px; line-height: 1.62; border: 1px solid rgba(255,255,255,.78); box-shadow: 0 5px 12px rgba(23,61,48,.11); backdrop-filter: blur(17px) saturate(130%); -webkit-backdrop-filter: blur(17px) saturate(130%); }
.message.ai .message-bubble { color: #18332b; background: rgba(255,255,255,.62); }
.message.user .message-bubble { background: color-mix(in srgb, var(--chat-theme) 88%, #0d3d2d); border-color: color-mix(in srgb, var(--chat-theme) 70%, white); color: #fff; }
.message-time { color: #58736a; font-size: 11px; }
.input-area { gap: 10px; padding: 14px max(16px, calc((100% - 980px) / 2)); background: rgba(255,255,255,.48); border-top: 1px solid rgba(255,255,255,.78); backdrop-filter: blur(24px) saturate(140%); -webkit-backdrop-filter: blur(24px) saturate(140%); }
.voice-button, .send-button { width: 44px; height: 44px; min-width: 44px; border-radius: 13px; border: 1px solid rgba(255,255,255,.88); box-shadow: 0 5px 12px rgba(23,61,48,.11); }
.voice-button { color: #58736a; background: rgba(255,255,255,.7); }
.voice-button:hover { background: rgba(255,255,255,.94); color: var(--chat-theme); }
.send-button { background: var(--chat-theme); border-color: color-mix(in srgb, var(--chat-theme) 70%, white); }
.message-input { min-height: 44px; padding: 11px 15px; border-radius: 14px; border: 1px solid rgba(255,255,255,.9); color: #18332b; background: rgba(255,255,255,.76); }
.message-input::placeholder { color: #668178; }
@media (min-width: 769px) {
  .chat-container { max-width: 1240px; margin: 18px auto; height: calc(100vh - 36px); min-height: 600px; border: 1px solid rgba(255,255,255,.78); border-radius: 20px; overflow: hidden; box-shadow: 0 8px 14px rgba(24,68,51,.12); }
  .messages-area { padding-top: 34px; padding-bottom: 34px; }
}
@media (max-width: 520px) {
  .chat-header { padding: 11px 12px; }
  .header-content { gap: 10px; }
  .ai-avatar { width: 42px; height: 42px; border-radius: 13px; }
  .ai-avatar img, .ai-avatar img.ai-avatar-img { border-radius: 10px; }
  .header-actions { gap: 6px; }
  .tts-toggle, .handoff-toggle { height: 36px; }
  .tts-toggle { width: 36px; min-width: 36px; border-radius: 11px; }
  .handoff-toggle { min-width: 0; padding: 0 10px; border-radius: 11px; font-size: 12px; }
  .messages-area { padding: 20px 12px; }
  .message-content { max-width: 86%; }
  .message-bubble { padding: 11px 13px; font-size: 14px; border-radius: 14px; }
  .input-area { padding: 10px 12px calc(10px + env(safe-area-inset-bottom,0px)); gap: 8px; }
  .voice-button, .send-button { width: 40px; height: 40px; min-width: 40px; border-radius: 12px; }
  .message-input { min-height: 40px; padding: 9px 12px; font-size: 14px; }
}
