/* ─────────────────────────────────────────────────────────────────────────
   chat-widget.css — NepalConnect AI Support Assistant Widget
   Color Palette: Warm Terracotta (#C25E26) & Dark Espresso (#171412)
   on Warm Oat Canvas (#FAF7F2).
   NO GREEN — 100% cohesive with NepalConnect brand palette.
   Supports Voice Interaction (STT / Waveforms / TTS Playback).
   ───────────────────────────────────────────────────────────────────────── */

/* ═══ Launcher FAB Button ═════════════════════════════════════════════════ */

.chat-fab {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 999;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 58px;
  height: 58px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: var(--color-primary, #C25E26);
  color: #FFFFFF;
  box-shadow: 0 10px 28px rgba(194, 94, 38, 0.38);
  cursor: pointer;
  transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1),
              box-shadow 0.2s cubic-bezier(0.4, 0, 0.2, 1),
              background 0.15s ease;
}

.chat-fab:hover {
  background: var(--color-primary-hover, #A74E1B);
  transform: translateY(-2px) scale(1.04);
  box-shadow: 0 14px 32px rgba(194, 94, 38, 0.48);
}

.chat-fab:active {
  transform: scale(0.96);
}

.chat-fab svg {
  width: 26px;
  height: 26px;
}

.chat-fab__close {
  display: none;
}

.chat-fab.open .chat-fab__open {
  display: none;
}

.chat-fab.open .chat-fab__close {
  display: block;
}

/* ═══ Chat Window Panel ═══════════════════════════════════════════════════ */

.chat-panel {
  position: fixed;
  right: 24px;
  bottom: 96px;
  z-index: 998;
  display: flex;
  flex-direction: column;
  width: 384px;
  max-width: calc(100vw - 32px);
  height: 590px;
  max-height: calc(100vh - 120px);
  background: var(--color-bg, #FAF7F2);
  border: 1px solid var(--color-border, #EAE5DD);
  border-radius: 24px;
  box-shadow: 0 24px 52px -10px rgba(23, 20, 18, 0.22), 0 6px 20px rgba(23, 20, 18, 0.08);
  overflow: hidden;
  opacity: 0;
  transform: translateY(16px) scale(0.96);
  transform-origin: bottom right;
  pointer-events: none;
  transition: opacity 0.24s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.24s cubic-bezier(0.16, 1, 0.3, 1);
  font-family: var(--font-body, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif);
}

.chat-panel.open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

/* ═══ Header ══════════════════════════════════════════════════════════════ */

.chat-panel__head {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
  padding: 16px 18px;
  background: var(--color-surface, #FFFFFF);
  border-bottom: 1px solid var(--color-border, #EAE5DD);
}

.chat-panel__avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 14px;
  background: var(--color-primary-tint, #FDF4ED);
  color: var(--color-primary, #C25E26);
  flex-shrink: 0;
}

.chat-panel__avatar svg {
  width: 24px;
  height: 24px;
}

.chat-panel__titles {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
}

.chat-panel__title {
  margin: 0;
  font-family: var(--font-headline, 'Plus Jakarta Sans', sans-serif);
  font-size: 16px;
  font-weight: 700;
  color: var(--color-text-primary, #1C1917);
  line-height: 1.25;
  letter-spacing: -0.01em;
}

.chat-panel__subtitle {
  margin: 2px 0 0 0;
  font-size: 12.5px;
  color: var(--color-text-muted, #78716C);
  line-height: 1.2;
}

.chat-panel__actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.chat-icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: transparent;
  color: var(--color-text-muted, #78716C);
  border: none;
  cursor: pointer;
  transition: all 0.15s ease;
}

.chat-icon-btn:hover {
  background: var(--color-primary-tint, #FDF4ED);
  color: var(--color-primary, #C25E26);
}

.chat-icon-btn svg {
  width: 18px;
  height: 18px;
}

.chat-voice-toggle-btn {
  color: var(--color-primary, #C25E26);
  background: var(--color-primary-tint, #FDF4ED);
}

.chat-voice-toggle-btn.voice-disabled {
  color: var(--color-text-muted, #78716C);
  background: transparent;
  opacity: 0.65;
}

.chat-voice-toggle-btn:hover {
  background: var(--color-primary-tint, #FDF4ED);
  color: var(--color-primary, #C25E26);
  opacity: 1;
}

/* ═══ Login View ═════════════════════════════════════════════════════════ */

.chat-login {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 28px 22px;
  background: var(--color-bg, #FAF7F2);
  overflow-y: auto;
}

.chat-login__hero {
  text-align: center;
  margin-bottom: 22px;
}

.chat-login__icon-circle {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--color-primary-tint, #FDF4ED);
  color: var(--color-primary, #C25E26);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 14px auto;
  border: 1px solid rgba(194, 94, 38, 0.15);
}

.chat-login__icon-circle svg {
  width: 26px;
  height: 26px;
}

.chat-login__heading {
  margin: 0 0 6px 0;
  font-family: var(--font-headline, 'Plus Jakarta Sans', sans-serif);
  font-size: 17px;
  font-weight: 700;
  color: var(--color-text-primary, #1C1917);
  letter-spacing: -0.01em;
}

.chat-login__lede {
  font-size: 13.5px;
  color: var(--color-text-secondary, #57534E);
  margin: 0;
  line-height: 1.45;
}

.chat-login__error {
  display: none;
  padding: 10px 14px;
  background: var(--color-error-bg, #FEE2E2);
  color: var(--color-error, #991B1B);
  border-radius: 10px;
  font-size: 12.5px;
  margin-bottom: 14px;
}

.chat-login__error:not(:empty) {
  display: block;
}

.chat-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}

.chat-field span {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-muted, #78716C);
}

.chat-field input {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid var(--color-border, #EAE5DD);
  border-radius: 12px;
  background: var(--color-surface, #FFFFFF);
  font-family: var(--font-body, inherit);
  font-size: 14px;
  color: var(--color-text-primary, #1C1917);
  outline: none;
  box-sizing: border-box;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.chat-field input:focus {
  border-color: var(--color-primary, #C25E26);
  box-shadow: 0 0 0 3px rgba(194, 94, 38, 0.15);
}

.chat-login__submit {
  margin-top: 10px;
  width: 100%;
  padding: 13px;
  background: var(--color-primary, #C25E26);
  color: #FFFFFF;
  border: none;
  border-radius: 12px;
  font-weight: 600;
  font-size: 14.5px;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(194, 94, 38, 0.3);
  transition: background 0.15s ease, transform 0.15s ease;
}

.chat-login__submit:hover {
  background: var(--color-primary-hover, #A74E1B);
  transform: translateY(-1px);
}

.chat-login__submit:active {
  transform: scale(0.98);
}

.chat-login__alt {
  margin: 16px 0 0;
  text-align: center;
  font-size: 13px;
  color: var(--color-text-muted, #78716C);
}

.chat-login__alt a {
  color: var(--color-primary, #C25E26);
  font-weight: 600;
  text-decoration: none;
}

.chat-login__alt a:hover {
  text-decoration: underline;
}

/* ═══ Chat Area ══════════════════════════════════════════════════════════ */

.chat-area {
  flex: 1;
  display: none;
  flex-direction: column;
  min-height: 0;
  background: var(--color-bg, #FAF7F2);
  position: relative;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 18px 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* ═══ Welcome Empty State ═════════════════════════════════════════════════ */

.chat-welcome-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin: auto 0;
  padding: 24px 12px;
  text-align: center;
}

.chat-welcome-icon {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: var(--color-primary-tint, #FDF4ED);
  border: 1px solid rgba(194, 94, 38, 0.18);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-primary, #C25E26);
  margin-bottom: 16px;
  box-shadow: 0 2px 8px rgba(194, 94, 38, 0.1);
}

.chat-welcome-icon svg {
  width: 32px;
  height: 32px;
}

.chat-welcome-caption {
  font-size: 14.5px;
  color: var(--color-text-secondary, #57534E);
  font-weight: 500;
  margin-bottom: 20px;
}

.chat-welcome-chips {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  max-width: 320px;
}

.chat-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: var(--color-surface, #FFFFFF);
  border: 1px solid var(--color-border, #EAE5DD);
  border-radius: 999px;
  color: var(--color-text-primary, #1C1917);
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
  transition: all 0.15s ease;
}

.chat-chip:hover {
  background: var(--color-primary-tint, #FDF4ED);
  border-color: var(--color-primary, #C25E26);
  color: var(--color-primary, #C25E26);
  transform: translateY(-1px);
}

/* ═══ Message Rows ═══════════════════════════════════════════════════════ */

.msg-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  max-width: 88%;
}

.msg-row.user {
  margin-left: auto;
  flex-direction: row-reverse;
}

.msg-row.bot {
  margin-right: auto;
}

.msg-avatar {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: var(--color-primary-tint, #FDF4ED);
  color: var(--color-primary, #C25E26);
  border: 1px solid rgba(194, 94, 38, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-bottom: 2px;
}

.msg-avatar svg {
  width: 16px;
  height: 16px;
}

.msg {
  padding: 11px 15px;
  border-radius: 16px;
  font-size: 13.5px;
  line-height: 1.5;
  word-break: break-word;
  position: relative;
}

.msg.user {
  background: var(--color-primary, #C25E26);
  color: #FFFFFF;
  border-bottom-right-radius: 4px;
  box-shadow: 0 2px 6px rgba(194, 94, 38, 0.2);
}

.msg.bot {
  background: var(--color-surface, #FFFFFF);
  color: var(--color-text-primary, #1C1917);
  border: 1px solid var(--color-border, #EAE5DD);
  border-bottom-left-radius: 4px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.03);
}

.msg.bot p {
  margin: 0 0 6px 0;
}

.msg.bot p:last-child {
  margin-bottom: 0;
}

.msg.bot ul {
  margin: 4px 0;
  padding-left: 18px;
}

.msg.bot li {
  margin-bottom: 2px;
}

/* ═══ Bot Voice Speaker Playback Button ═══════════════════════════════════ */

.msg-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 6px;
  padding-top: 4px;
}

.msg-voice-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--color-bg, #FAF7F2);
  border: 1px solid var(--color-border, #EAE5DD);
  color: var(--color-text-muted, #78716C);
  cursor: pointer;
  transition: all 0.15s ease;
}

.msg-voice-btn:hover {
  background: var(--color-primary-tint, #FDF4ED);
  color: var(--color-primary, #C25E26);
  border-color: var(--color-primary, #C25E26);
}

.msg-voice-btn svg {
  width: 13px;
  height: 13px;
}

.msg-voice-btn .stop-icon {
  display: none;
}

.msg-voice-btn.speaking {
  background: var(--color-primary, #C25E26);
  color: #FFFFFF;
  border-color: var(--color-primary, #C25E26);
  animation: pulse-ring 1.5s infinite;
}

.msg-voice-btn.speaking .speaker-icon {
  display: none;
}

.msg-voice-btn.speaking .stop-icon {
  display: block;
}

/* Thumbs up / down on a reply */
.msg-actions {
  gap: 4px;
}

.msg-rate-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: transparent;
  border: 1px solid transparent;
  color: var(--color-text-muted, #78716C);
  cursor: pointer;
  transition: all 0.15s ease;
}

.msg-rate-btn svg {
  width: 13px;
  height: 13px;
}

.msg-rate-btn:hover:not(:disabled) {
  color: var(--color-primary, #C25E26);
  border-color: var(--color-border, #EAE5DD);
}

.msg-rate-btn:disabled {
  cursor: default;
  opacity: 0.45;
}

.msg-rate-btn.selected {
  opacity: 1;
  color: var(--color-primary, #C25E26);
  background: var(--color-primary-tint, #FDF4ED);
  border-color: var(--color-primary, #C25E26);
}

@keyframes pulse-ring {
  0% { box-shadow: 0 0 0 0 rgba(194, 94, 38, 0.4); }
  70% { box-shadow: 0 0 0 6px rgba(194, 94, 38, 0); }
  100% { box-shadow: 0 0 0 0 rgba(194, 94, 38, 0); }
}

/* ═══ Payment Attachment ══════════════════════════════════════════════════ */

.payment-attachment {
  border-color: var(--color-warning-border, #FDE68A);
  background: var(--color-surface, #FFFFFF);
}

.payment-attachment-amount {
  font-family: var(--font-headline, 'Plus Jakarta Sans', sans-serif);
  font-size: 16px;
  font-weight: 700;
  color: var(--color-terracotta, #C25E26);
  margin-bottom: 6px;
}

.payment-attachment-meta {
  font-size: 11.5px;
  color: var(--color-text-muted, #78716C);
  margin-top: 4px;
}

.payment-attachment-btn {
  display: block;
  margin-top: 8px;
  padding: 9px 14px;
  background: var(--color-primary, #C25E26);
  color: #FFFFFF;
  border-radius: 8px;
  text-decoration: none;
  text-align: center;
  font-weight: 600;
  font-size: 13px;
  transition: background 0.15s ease;
}

.payment-attachment-btn:hover {
  background: var(--color-primary-hover, #A74E1B);
}

/* ═══ Live Voice Listening Banner & Waveform ═════════════════════════════ */

.chat-voice-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  background: var(--color-primary-tint, #FDF4ED);
  border-top: 1px solid rgba(194, 94, 38, 0.2);
  color: var(--color-primary, #C25E26);
  font-size: 13px;
  font-weight: 600;
  animation: slide-up 0.2s ease;
}

.chat-voice-banner.error {
  background: var(--color-error-bg, #FEE2E2);
  border-top-color: var(--color-error-border, #FECACA);
  color: var(--color-error, #991B1B);
}

.chat-voice-banner.error .chat-voice-wave,
.chat-voice-banner.error .chat-voice-end-btn,
.chat-voice-banner.error .chat-voice-stop-btn {
  display: none !important;
}

.chat-voice-info {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
  gap: 2px;
}

.chat-voice-text {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 12.5px;
  line-height: 1.2;
}

.chat-voice-timer {
  font-size: 11px;
  font-weight: 700;
  color: var(--color-primary, #C25E26);
  font-variant-numeric: tabular-nums;
  opacity: 0.9;
}

.chat-voice-timer.warning {
  color: #DC2626;
  animation: timer-blink 1s infinite alternate;
}

@keyframes timer-blink {
  from { opacity: 1; }
  to { opacity: 0.35; }
}

.chat-voice-wave {
  display: flex;
  align-items: center;
  gap: 3px;
  height: 18px;
}

.wave-bar {
  width: 3px;
  height: 6px;
  background: var(--color-primary, #C25E26);
  border-radius: 2px;
  animation: wave-anim 1s ease-in-out infinite alternate;
}

.wave-bar:nth-child(1) { animation-delay: 0.1s; height: 10px; }
.wave-bar:nth-child(2) { animation-delay: 0.3s; height: 16px; }
.wave-bar:nth-child(3) { animation-delay: 0.2s; height: 8px; }
.wave-bar:nth-child(4) { animation-delay: 0.4s; height: 14px; }
.wave-bar:nth-child(5) { animation-delay: 0.15s; height: 12px; }

@keyframes wave-anim {
  0% { transform: scaleY(0.4); }
  100% { transform: scaleY(1.3); }
}

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

.chat-header-end-call {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  background: #DC2626;
  color: #FFFFFF;
  border: none;
  border-radius: 999px;
  font-family: inherit;
  font-size: 11.5px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.18s ease;
  box-shadow: 0 2px 6px rgba(220, 38, 38, 0.25);
}

.chat-header-end-call:hover {
  background: #B91C1C;
  transform: scale(1.04);
}

.chat-voice-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.chat-voice-mute-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 10px;
  background: #FFFFFF;
  color: var(--color-text, #1C1917);
  border: 1px solid var(--color-border, #E7E5E4);
  border-radius: 999px;
  font-family: inherit;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.16s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.chat-voice-mute-btn:hover {
  background: var(--color-bg, #FAF7F2);
  border-color: var(--color-primary, #C25E26);
  color: var(--color-primary, #C25E26);
  transform: scale(1.03);
}

.chat-voice-mute-btn.muted {
  background: #FEE2E2;
  color: #DC2626;
  border-color: #FCA5A5;
}

.chat-voice-mute-btn.muted:hover {
  background: #FECACA;
}

.chat-voice-end-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 11px;
  background: #DC2626;
  color: #FFFFFF;
  border: none;
  border-radius: 999px;
  font-family: inherit;
  font-size: 11.5px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.18s ease;
  box-shadow: 0 2px 6px rgba(220, 38, 38, 0.25);
}

.chat-voice-end-btn:hover {
  background: #B91C1C;
  transform: scale(1.04);
}

.chat-voice-stop-btn {
  padding: 4px 10px;
  background: var(--color-primary, #C25E26);
  color: #FFFFFF;
  border: none;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
}

/* ═══ Composer Footer (Warm Terracotta & Oat Palette) ═════════════════════ */

.chat-composer {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  background: var(--color-surface, #FFFFFF);
  border-top: 1px solid var(--color-border, #EAE5DD);
  flex-shrink: 0;
}

.chat-input-wrapper {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
}

.chat-composer input {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--color-border, #EAE5DD);
  border-radius: 12px;
  background: var(--color-bg, #FAF7F2);
  font-family: var(--font-body, inherit);
  font-size: 13.5px;
  color: var(--color-text-primary, #1C1917);
  outline: none;
  box-sizing: border-box;
  transition: all 0.15s ease;
}

.chat-composer input:focus {
  background: var(--color-surface, #FFFFFF);
  border-color: var(--color-primary, #C25E26);
  box-shadow: 0 0 0 2px rgba(194, 94, 38, 0.15);
}

.chat-btn-send {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--color-primary-tint, #FDF4ED);
  color: var(--color-primary, #C25E26);
  border: 1px solid rgba(194, 94, 38, 0.2);
  cursor: pointer;
  flex-shrink: 0;
  outline: none;
  transition: all 0.15s ease;
}

.chat-btn-send:hover:not(:disabled) {
  background: var(--color-primary, #C25E26);
  color: #FFFFFF;
  transform: translateY(-1px);
}

.chat-btn-send:active:not(:disabled) {
  transform: scale(0.96);
}

.chat-btn-send:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px rgba(194, 94, 38, 0.35);
}

.chat-btn-send:disabled {
  opacity: 0.38;
  cursor: not-allowed;
  background: var(--color-bg, #FAF7F2);
  color: var(--color-text-muted, #A8A29E);
  border-color: var(--color-border, #EAE5DD);
  transform: none;
}

.chat-btn-send svg {
  width: 17px;
  height: 17px;
}

.chat-btn-mic {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--color-primary, #C25E26);
  color: #FFFFFF;
  border: none;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.15s ease;
  box-shadow: 0 2px 8px rgba(194, 94, 38, 0.3);
}

.chat-btn-mic:hover {
  background: var(--color-primary-hover, #A74E1B);
  transform: scale(1.05);
}

.chat-btn-mic:active {
  transform: scale(0.95);
}

.chat-btn-mic.listening {
  background: var(--color-error, #991B1B);
  animation: mic-pulse 1.2s infinite;
}

.chat-btn-mic.voice-disabled {
  background: #E5E7EB;
  color: #9CA3AF;
  box-shadow: none;
  cursor: pointer;
}

.chat-btn-mic.voice-disabled:hover {
  background: var(--color-primary-tint, #FDF4ED);
  color: var(--color-primary, #C25E26);
  transform: none;
}

@keyframes mic-pulse {
  0% { box-shadow: 0 0 0 0 rgba(153, 27, 27, 0.5); }
  70% { box-shadow: 0 0 0 10px rgba(153, 27, 27, 0); }
  100% { box-shadow: 0 0 0 0 rgba(153, 27, 27, 0); }
}

.chat-btn-mic svg {
  width: 18px;
  height: 18px;
}

/* ═══ Thinking / Loading Indicator ════════════════════════════════════════ */

.thinking {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 10px 14px;
  background: var(--color-surface, #FFFFFF);
  border: 1px solid var(--color-border, #EAE5DD);
  border-radius: 16px;
  border-bottom-left-radius: 4px;
}

.thinking .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--color-text-muted, #78716C);
  animation: bounce-dot 1.4s infinite ease-in-out both;
}

.thinking .dot:nth-child(1) { animation-delay: -0.32s; }
.thinking .dot:nth-child(2) { animation-delay: -0.16s; }

@keyframes bounce-dot {
  0%, 80%, 100% { transform: scale(0); opacity: 0.4; }
  40% { transform: scale(1); opacity: 1; background: var(--color-primary, #C25E26); }
}

/* ═══ Suppress any third-party injected floating call buttons ═══════════════ */

vapi-widget,
#vapi-support-btn,
.vapi-btn,
[class*="vapi-btn"],
[id*="vapi-support"],
[id*="vapi-widget"] {
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
  opacity: 0 !important;
}

/* ═══ Active Voice Call — Interactive Mic States (Live Listening & Muted) ═════ */

.chat-btn-mic.voice-active-listening {
  background: #16A34A !important;
  color: #FFFFFF !important;
  cursor: pointer !important;
  opacity: 1 !important;
  pointer-events: auto !important;
  box-shadow: 0 0 0 0 rgba(22, 163, 74, 0.7) !important;
  animation: mic-live-pulse 1.4s infinite !important;
}

.chat-btn-mic.voice-active-listening:hover {
  background: #15803D !important;
  transform: scale(1.08) !important;
}

.chat-btn-mic.voice-active-muted {
  background: #DC2626 !important;
  color: #FFFFFF !important;
  cursor: pointer !important;
  opacity: 1 !important;
  pointer-events: auto !important;
  box-shadow: 0 2px 8px rgba(220, 38, 38, 0.3) !important;
  animation: none !important;
}

.chat-btn-mic.voice-active-muted:hover {
  background: #B91C1C !important;
  transform: scale(1.08) !important;
}

.chat-btn-mic.voice-active-disabled {
  opacity: 0.38 !important;
  cursor: not-allowed !important;
  pointer-events: none !important;
  background: var(--color-bg, #FAF7F2) !important;
  color: var(--color-text-muted, #A8A29E) !important;
  border: 1px solid var(--color-border, #EAE5DD) !important;
  box-shadow: none !important;
  transform: none !important;
  filter: grayscale(1) !important;
}

@keyframes mic-live-pulse {
  0% { box-shadow: 0 0 0 0 rgba(22, 163, 74, 0.6); transform: scale(1); }
  50% { box-shadow: 0 0 0 7px rgba(22, 163, 74, 0); transform: scale(1.04); }
  100% { box-shadow: 0 0 0 0 rgba(22, 163, 74, 0); transform: scale(1); }
}

/* ═══ Minimized Floating Call Pill & In-Call FAB ═══════════════════════════ */

.chat-floating-call-pill {
  position: fixed;
  right: 24px;
  bottom: 92px;
  z-index: 1000;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: #171412;
  color: #FFFFFF;
  border: 1px solid rgba(194, 94, 38, 0.35);
  border-radius: 999px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.35), 0 0 0 1px rgba(194, 94, 38, 0.2);
  cursor: pointer;
  animation: slide-up 0.24s cubic-bezier(0.16, 1, 0.3, 1);
  font-family: var(--font-body, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.chat-floating-call-pill:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.45);
}

.call-indicator-pulse {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #10B981;
  box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
  animation: pulse-green 1.5s infinite;
  flex-shrink: 0;
}

@keyframes pulse-green {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
  70% { transform: scale(1); box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

.call-pill-label {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: #FDF4ED;
}

.call-pill-timer {
  font-size: 12px;
  font-weight: 700;
  color: var(--color-primary, #C25E26);
  font-variant-numeric: tabular-nums;
  padding: 1px 6px;
  background: rgba(194, 94, 38, 0.2);
  border-radius: 4px;
}

.call-pill-end {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: #DC2626;
  color: #FFFFFF;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease;
}

.call-pill-end:hover {
  background: #B91C1C;
  transform: scale(1.12);
}

.chat-fab.in-call {
  animation: fab-call-pulse 1.8s infinite;
}

@keyframes fab-call-pulse {
  0% { box-shadow: 0 0 0 0 rgba(194, 94, 38, 0.7); }
  70% { box-shadow: 0 0 0 14px rgba(194, 94, 38, 0); }
  100% { box-shadow: 0 0 0 0 rgba(194, 94, 38, 0); }
}

/* ═══ Mobile Responsive Layout ═════════════════════════════════════════════ */

@media (max-width: 640px) {
  .chat-fab {
    right: 16px;
    bottom: 16px;
    width: 52px;
    height: 52px;
  }

  .chat-floating-call-pill {
    right: 16px;
    bottom: 78px;
    padding: 7px 12px;
  }

  .chat-panel {
    right: 12px;
    left: 12px;
    bottom: 78px;
    width: auto;
    max-width: calc(100vw - 24px);
    height: calc(100dvh - 96px);
    max-height: 590px;
    border-radius: 20px;
  }

  .chat-panel__head {
    padding: 12px 14px;
  }

  .chat-panel__title {
    font-size: 15px;
  }

  .chat-panel__subtitle {
    font-size: 11.5px;
  }

  .chat-messages {
    padding: 14px 12px;
  }

  .chat-composer {
    padding: 10px 12px;
    padding-bottom: max(10px, env(safe-area-inset-bottom));
  }

  .chat-composer input {
    font-size: 16px; /* Prevents auto-zoom on iOS */
    padding: 9px 12px;
  }

  .chat-btn-send,
  .chat-btn-mic {
    width: 38px;
    height: 38px;
  }

  .chat-voice-banner {
    padding: 8px 12px;
    gap: 8px;
  }

  .chat-voice-end-btn {
    padding: 4px 10px;
    font-size: 11px;
  }
}

@media (max-width: 420px) {
  .chat-panel {
    right: 8px;
    left: 8px;
    bottom: 72px;
    max-height: calc(100dvh - 84px);
  }
}



/* ═══ Live chat with a person ═════════════════════════════════════════════ */

.chat-handoff-banner {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--color-primary-tint, #FDF4ED);
  border-bottom: 1px solid var(--color-border, #EAE5DD);
  font-size: 13px;
  color: var(--color-text, #292524);
}
.chat-handoff-banner[hidden] { display: none; }
.chat-handoff-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #D97706;
  flex-shrink: 0;
}
.chat-handoff-banner.is-active .chat-handoff-dot { background: #16A34A; }
#widgetHandoffText { flex: 1; min-width: 0; }
.chat-handoff-end {
  border: 1px solid var(--color-border, #EAE5DD);
  background: #FFFFFF;
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 12px;
  cursor: pointer;
  color: inherit;
}
.msg-agent-name {
  font-size: 11px;
  font-weight: 700;
  color: var(--color-primary, #C25E26);
  margin-bottom: 2px;
}
.chat-system-line {
  text-align: center;
  font-size: 12px;
  color: var(--color-text-muted, #78716C);
  margin: 6px 0;
}
