/* ═══════════════════════════════════════════════════════
   LIVE CHAT WIDGET  (deliberately single dark theme)
   ═══════════════════════════════════════════════════════ */
.chat-launcher {
  position: fixed; bottom: 28px; right: 28px; z-index: 9990;
  width: 58px; height: 58px; border-radius: 50%; border: none;
  background: #2d9e5f; cursor: pointer;
  box-shadow: 0 4px 22px rgba(22,163,74,.45), 0 1px 6px rgba(0,0,0,.2);
  display: flex; align-items: center; justify-content: center;
  transition: transform .2s ease, box-shadow .2s ease; color: #fff;
}
.chat-launcher:hover { transform: scale(1.1); box-shadow: 0 6px 30px rgba(22,163,74,.6); }
.chat-launcher:focus-visible { outline: 3px solid #4ade80; outline-offset: 3px; }
.chat-launcher.open .icon-chat { display: none; }
.chat-launcher.open .icon-close { display: block; }
.chat-launcher .icon-close { display: none; }
.chat-unread {
  position: absolute; top: -1px; right: -1px; min-width: 20px; height: 20px; padding: 0 5px;
  background: #ef4444; border-radius: 100px; font-size: .65rem; font-weight: 800;
  color: #fff; display: flex; align-items: center; justify-content: center; border: 2px solid #fff;
}
.chat-unread.hidden { display: none; }
@keyframes pulse-ring {
  0%   { box-shadow: 0 0 0 0 rgba(45,158,95,.55); }
  70%  { box-shadow: 0 0 0 14px rgba(45,158,95,0); }
  100% { box-shadow: 0 0 0 0 rgba(45,158,95,0); }
}
.chat-launcher.pulsing { animation: pulse-ring 2.4s ease-out infinite; }

.chat-panel {
  position: fixed; bottom: 98px; right: 28px; z-index: 9989;
  width: 384px; height: 588px; max-height: calc(100vh - 130px);
  background: #0d1a10; border: 1px solid rgba(255,255,255,.09); border-radius: 20px;
  box-shadow: 0 28px 72px rgba(0,0,0,.55), 0 6px 20px rgba(0,0,0,.35);
  display: flex; flex-direction: column; overflow: hidden;
  transform: translateY(16px) scale(.96); opacity: 0; pointer-events: none;
  transition: transform .3s cubic-bezier(.34,1.35,.64,1), opacity .22s ease;
}
.chat-panel.open { transform: translateY(0) scale(1); opacity: 1; pointer-events: auto; }
@media (max-width: 480px) {
  .chat-panel { right: 10px; left: 10px; width: auto; bottom: 84px; height: calc(100vh - 108px); }
  .chat-launcher { bottom: 18px; right: 16px; }
}

.chat-header { background: #2d9e5f; padding: 13px 15px; display: flex; align-items: center; gap: 11px; flex-shrink: 0; }
.chat-avatar {
  width: 40px; height: 40px; border-radius: 50%; background: rgba(255,255,255,.25);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-size: .85rem; font-weight: 800; color: #fff;
  flex-shrink: 0; border: 2px solid rgba(255,255,255,.3);
}
.chat-agent-info { flex: 1; min-width: 0; }
.chat-agent-name { font-family: var(--font-display); font-size: .95rem; font-weight: 700; color: #fff; line-height: 1.2; }
.chat-agent-status { display: flex; align-items: center; gap: 5px; margin-top: 2px; }
.chat-status-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; background: #94a3b8; }
.chat-status-dot.online { background: #d9f99d; box-shadow: 0 0 0 2px rgba(255,255,255,.25); }
.chat-agent-role { font-size: .75rem; color: rgba(255,255,255,.85); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-header-btns { display: flex; gap: 6px; }
.chat-hbtn {
  width: 30px; height: 30px; border-radius: 8px; border: none;
  background: rgba(255,255,255,.15); color: rgba(255,255,255,.9); cursor: pointer;
  display: flex; align-items: center; justify-content: center; transition: background .15s;
}
.chat-hbtn:hover { background: rgba(255,255,255,.3); }

.chat-status-bar {
  background: rgba(255,255,255,.05); border-bottom: 1px solid rgba(255,255,255,.08);
  padding: 8px 13px; display: flex; align-items: flex-start; gap: 8px; flex-shrink: 0;
}
.chat-status-bar svg { color: rgba(255,255,255,.45); flex-shrink: 0; margin-top: 2px; }
.chat-status-bar span { font-size: .74rem; color: rgba(255,255,255,.58); line-height: 1.5; }
.chat-status-bar.warn { background: rgba(251,191,36,.12); border-bottom-color: rgba(251,191,36,.25); }
.chat-status-bar.warn svg, .chat-status-bar.warn span { color: #fcd34d; }

.chat-scroll { flex: 1; overflow-y: auto; display: flex; flex-direction: column; }
.chat-scroll::-webkit-scrollbar { width: 4px; }
.chat-scroll::-webkit-scrollbar-thumb { background: rgba(255,255,255,.15); border-radius: 4px; }
.chat-messages { padding: 16px 13px 8px; display: flex; flex-direction: column; gap: 11px; }

.chat-msg { display: flex; flex-direction: column; gap: 3px; max-width: 88%; }
.chat-msg.them { align-self: flex-start; }
.chat-msg.me   { align-self: flex-end; }
.chat-bubble { padding: 10px 13px; font-size: .87rem; line-height: 1.55; word-wrap: break-word; white-space: pre-wrap; }
.chat-msg.them .chat-bubble { background: rgba(255,255,255,.09); color: #e8f5ec; border-radius: 4px 15px 15px 15px; }
.chat-msg.me .chat-bubble { background: #2d9e5f; color: #fff; border-radius: 15px 4px 15px 15px; }
.chat-meta { font-size: .66rem; color: rgba(255,255,255,.38); display: flex; align-items: center; gap: 4px; }
.chat-msg.me .chat-meta { justify-content: flex-end; }
.chat-tick { color: #4ade80; font-weight: 700; }

.chat-system {
  align-self: center; text-align: center; font-size: .72rem; color: rgba(255,255,255,.4);
  background: rgba(255,255,255,.05); border-radius: 100px; padding: 5px 14px; max-width: 92%;
}

.chat-typing { display: flex; align-items: center; gap: 4px; padding: 11px 14px; }
.typing-dot { width: 6px; height: 6px; border-radius: 50%; background: rgba(255,255,255,.45); animation: typing-bounce .9s ease-in-out infinite; }
.typing-dot:nth-child(2) { animation-delay: .15s; }
.typing-dot:nth-child(3) { animation-delay: .3s; }
@keyframes typing-bounce { 0%,80%,100% { transform: translateY(0); opacity: .4; } 40% { transform: translateY(-5px); opacity: 1; } }
.typing-bubble { background: rgba(255,255,255,.09); border-radius: 4px 15px 15px 15px; display: inline-flex; align-items: center; padding: 0; }

/* pre-chat form */
.prechat { padding: 18px 16px; display: flex; flex-direction: column; gap: 12px; }
.prechat-title { font-family: var(--font-display); font-size: .95rem; font-weight: 700; color: #fff; }
.prechat-sub { font-size: .8rem; color: rgba(255,255,255,.55); line-height: 1.55; margin-top: -6px; }
.prechat-label { font-size: .74rem; font-weight: 600; color: rgba(255,255,255,.6); margin-bottom: -6px; }
.dark-input {
  width: 100%; background: rgba(255,255,255,.07); border: 1.5px solid rgba(255,255,255,.13);
  border-radius: 10px; padding: 10px 13px; font-family: var(--font-body); font-size: .87rem;
  color: #e8f5ec; outline: none; transition: border-color .15s;
}
.dark-input::placeholder { color: rgba(255,255,255,.3); }
.dark-input:focus { border-color: #2d9e5f; }

.chat-chips { padding: 2px 13px 10px; display: flex; gap: 7px; flex-wrap: wrap; flex-shrink: 0; }
.chat-chip {
  padding: 7px 13px; border-radius: 100px; border: 1.5px solid #2d9e5f; background: transparent;
  font-family: var(--font-display); font-size: .77rem; font-weight: 600; color: #4ade80;
  cursor: pointer; transition: all .16s; white-space: nowrap;
}
.chat-chip:hover, .chat-chip.selected { background: #2d9e5f; color: #fff; }

.chat-actions { padding: 2px 13px 8px; display: flex; flex-direction: column; gap: 7px; flex-shrink: 0; }
.chat-action-btn {
  width: 100%; padding: 11px 15px; border-radius: 11px; border: none;
  font-family: var(--font-display); font-size: .85rem; font-weight: 600; cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 8px; transition: all .16s; text-decoration: none;
}
.chat-action-btn.primary { background: #2d9e5f; color: #fff; }
.chat-action-btn.primary:hover { background: #238c52; }
.chat-action-btn.primary:disabled { background: rgba(255,255,255,.12); color: rgba(255,255,255,.4); cursor: not-allowed; }
.chat-action-btn.secondary { background: rgba(255,255,255,.07); color: #c4d9cb; border: 1px solid rgba(255,255,255,.12); }
.chat-action-btn.secondary:hover { background: rgba(255,255,255,.14); color: #fff; }

.chat-input-area { border-top: 1px solid rgba(255,255,255,.08); padding: 10px 11px; display: flex; align-items: flex-end; gap: 8px; flex-shrink: 0; }
.chat-input {
  flex: 1; background: rgba(255,255,255,.07); border: 1.5px solid rgba(255,255,255,.12);
  border-radius: 12px; padding: 9px 13px; font-family: var(--font-body); font-size: .87rem;
  color: #e8f5ec; outline: none; transition: border-color .15s; resize: none; line-height: 1.45; max-height: 84px;
}
.chat-input::placeholder { color: rgba(255,255,255,.32); }
.chat-input:focus { border-color: #2d9e5f; }
.chat-input:disabled { opacity: .5; cursor: not-allowed; }
.chat-send {
  width: 38px; height: 38px; border-radius: 10px; border: none; flex-shrink: 0;
  background: #2d9e5f; color: #fff; cursor: pointer;
  display: flex; align-items: center; justify-content: center; transition: background .15s, transform .15s;
}
.chat-send:hover:not(:disabled) { background: #238c52; transform: scale(1.05); }
.chat-send:disabled { background: rgba(255,255,255,.12); color: rgba(255,255,255,.35); cursor: not-allowed; }
.chat-footer-bar { text-align: center; padding: 4px 0 9px; font-size: .67rem; color: rgba(255,255,255,.28); flex-shrink: 0; }
.chat-footer-bar a { color: rgba(255,255,255,.42); text-decoration: none; }
.chat-footer-bar a:hover { color: rgba(255,255,255,.75); }

/* thank-you overlay */
.chat-thankyou { display: none; flex-direction: column; background: #0d1a10; position: absolute; inset: 0; z-index: 10; }
.chat-thankyou.visible { display: flex; animation: fadeIn .3s ease; }
.chat-ty-header { background: #2d9e5f; padding: 15px 20px; font-family: var(--font-display); font-size: 1rem; font-weight: 700; color: #fff; text-align: center; }
.chat-ty-body { flex: 1; padding: 30px 22px; display: flex; flex-direction: column; align-items: center; gap: 13px; overflow-y: auto; }
.chat-ty-title { font-family: var(--font-display); font-weight: 800; font-size: 1.05rem; color: #fff; text-align: center; line-height: 1.4; }
.chat-ty-subtitle { font-size: .86rem; color: rgba(255,255,255,.6); text-align: center; line-height: 1.65; }
.chat-ty-subtitle a { color: #4ade80; }
.chat-ty-btns { display: flex; gap: 9px; width: 100%; margin-top: 6px; }
.chat-ty-btns .chat-action-btn { flex: 1; }
.chat-ty-hint {
  display: flex; align-items: flex-start; gap: 9px; background: rgba(255,255,255,.05);
  border: 1px solid rgba(255,255,255,.08); border-radius: 12px; padding: 12px 14px; margin-top: 4px;
}
.chat-ty-hint svg { color: rgba(255,255,255,.4); flex-shrink: 0; margin-top: 2px; }
.chat-ty-hint span { font-size: .77rem; color: rgba(255,255,255,.5); line-height: 1.55; }
