/* =====================================================================
   MyQuickBill Chatbot Widget - CSS
   Theme: Teal (#0f766e), Plus Jakarta Sans
   v5.11.13 — compact message spacing (collapse runaway <br>, tighter gaps)
   ===================================================================== */

#mqb-chatbot-root {
  --mqb-primary: #0f766e;
  --mqb-primary-dark: #0d5c56;
  --mqb-primary-light: #14b8a6;
  --mqb-bg: #ffffff;
  --mqb-bg-soft: #f0fdfa;
  --mqb-text: #0f172a;
  --mqb-text-soft: #475569;
  --mqb-border: #e2e8f0;
  --mqb-user-bubble: #0f766e;
  --mqb-bot-bubble: #f1f5f9;
  --mqb-shadow: 0 10px 30px -8px rgba(15, 118, 110, 0.35);

  font-family: 'Plus Jakarta Sans', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* =====================  Floating bubble  =================== */
.mqb-chat-bubble {
  position: fixed;
  bottom: 22px;
  right: 22px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--mqb-primary), var(--mqb-primary-light));
  border: none;
  cursor: pointer;
  box-shadow: var(--mqb-shadow);
  z-index: 99998;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform .2s ease, box-shadow .2s ease;
}
.mqb-chat-bubble:hover {
  transform: scale(1.08);
  box-shadow: 0 12px 32px -6px rgba(15, 118, 110, 0.5);
}
.mqb-chat-bubble:active { transform: scale(0.96); }
.mqb-bubble-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  pointer-events: none;
}
.mqb-bubble-icon svg { display: block; }

.mqb-bubble-pulse {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: var(--mqb-primary);
  opacity: 0.5;
  animation: mqb-pulse 2s ease-out infinite;
  z-index: -1;
}
@keyframes mqb-pulse {
  0%   { transform: scale(1);   opacity: 0.5; }
  100% { transform: scale(1.6); opacity: 0;   }
}

/* Hide bubble when window open */
#mqb-chatbot-root.is-open .mqb-chat-bubble { display: none; }

/* =====================  Chat window  =================== */
.mqb-chat-window {
  position: fixed;
  bottom: 22px;
  right: 22px;
  width: 380px;
  height: 580px;
  max-height: calc(100vh - 44px);
  background: var(--mqb-bg);
  border-radius: 16px;
  box-shadow: 0 20px 60px -10px rgba(15, 23, 42, 0.25);
  z-index: 99999;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  font-size: 14px;
  color: var(--mqb-text);
  animation: mqb-slide-up .25s ease-out;
}
/* 🛡️ CRITICAL: ensure `hidden` HTML attribute always wins over display:flex.
   Without this, on some pages CSS specificity battle causes chat to auto-open. */
.mqb-chat-window[hidden],
#mqb-chatbot-root .mqb-chat-window[hidden] {
  display: none !important;
}
@keyframes mqb-slide-up {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

@media (max-width: 480px) {
  .mqb-chat-window {
    bottom: 0;
    right: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    max-height: 100vh;
    border-radius: 0;
  }
}

/* Header */
.mqb-chat-header {
  background: linear-gradient(135deg, var(--mqb-primary), var(--mqb-primary-dark));
  color: white;
  padding: 14px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
}
.mqb-chat-title { display: flex; align-items: center; gap: 12px; }
.mqb-chat-avatar {
  width: 38px; height: 38px;
  background: rgba(255,255,255,0.18);
  border: 1.5px solid rgba(255,255,255,0.25);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  flex-shrink: 0;
}
.mqb-chat-avatar svg { display: block; }

/* === Logo override for header avatar (when logo-white.png provided) === */
/* logo-white.png is expected to be already white/light themed for the teal header */
.mqb-logo-img {
  display: block;
  border-radius: 50%;
  background: transparent;
  object-fit: contain;
}
.mqb-logo-avatar {
  width: 100%; height: 100%;
  padding: 4px;
}
.mqb-chat-name { font-weight: 700; font-size: 15px; line-height: 1.2; }
.mqb-chat-status {
  font-size: 11px;
  opacity: 0.9;
  margin-top: 2px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.mqb-chat-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: #4ade80;
  display: inline-block;
}
.mqb-chat-actions { display: flex; gap: 6px; }
.mqb-chat-actions .mqb-icon-btn,
.mqb-chat-actions button {
  background: rgba(255,255,255,0.15);
  border: none;
  color: white;
  width: 32px; height: 32px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all .15s ease;
  padding: 0;
}
.mqb-chat-actions button:hover { background: rgba(255,255,255,0.3); transform: scale(1.05); }
.mqb-chat-actions button:active { transform: scale(0.95); }
.mqb-chat-actions svg { display: block; pointer-events: none; }

/* Body (messages area) */
.mqb-chat-body {
  flex: 1;
  overflow-y: scroll;            /* always show scrollbar (not just on hover) */
  padding: 16px;
  background: linear-gradient(180deg, var(--mqb-bg-soft) 0%, var(--mqb-bg) 100%);
  scroll-behavior: smooth;
  /* Firefox scrollbar — thin with visible thumb + light track */
  scrollbar-width: thin;
  scrollbar-color: #94a3b8 #eef2f6;
}
/* Webkit (Chrome, Edge, Safari) — wider, always-visible, easy to grab */
.mqb-chat-body::-webkit-scrollbar {
  width: 10px;
}
.mqb-chat-body::-webkit-scrollbar-track {
  background: #eef2f6;           /* light grey track so the lane is visible */
  border-radius: 6px;
  margin: 4px 0;
}
.mqb-chat-body::-webkit-scrollbar-thumb {
  background: #b4c0cf;           /* visible grey thumb */
  border-radius: 6px;
  border: 2px solid #eef2f6;     /* padding effect so thumb looks slimmer */
  min-height: 40px;              /* easy to grab even with lots of content */
}
.mqb-chat-body::-webkit-scrollbar-thumb:hover {
  background: #0f766e;           /* teal on hover — matches brand */
}

/* Message bubbles */
.mqb-msg {
  margin-bottom: 8px;            /* v5.11.13: was 12px — tighter gap between messages */
  display: flex;
  flex-direction: column;
  animation: mqb-msg-in .2s ease-out;
}
@keyframes mqb-msg-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.mqb-msg-user { align-items: flex-end; }
.mqb-msg-bot  { align-items: flex-start; }

.mqb-msg-bubble {
  max-width: 85%;
  padding: 9px 13px;             /* v5.11.13: slightly tighter padding */
  border-radius: 16px;
  line-height: 1.4;              /* v5.11.13: was 1.45 — more compact, still fine for Bangla */
  word-wrap: break-word;
  font-size: 13.5px;
}
.mqb-msg-user .mqb-msg-bubble {
  background: var(--mqb-user-bubble);
  color: white;
  border-bottom-right-radius: 4px;
}
.mqb-msg-bot .mqb-msg-bubble {
  background: var(--mqb-bot-bubble);
  color: var(--mqb-text);
  border-bottom-left-radius: 4px;
  border: 1px solid var(--mqb-border);
}
.mqb-msg-bubble b { color: var(--mqb-primary); font-weight: 700; }
.mqb-msg-user .mqb-msg-bubble b { color: #d1fae5; }
/* v5.11.13: COMPACT PARAGRAPH SPACING — the real fix for the huge gaps.
   The AI reply often contains several <br> in a row (nl2br + <br><br>),
   and the old rule turned every extra <br> into a FULL blank line → the
   bubble ballooned and needed lots of scrolling.
   Fix: collapse ANY run of consecutive <br> down to a single line break.
   The first <br> in a run breaks the line; every following consecutive
   <br> is hidden. So <br>, <br><br>, <br><br><br>… all look the same:
   one clean line break, no empty gaps.
   (Want a *small* paragraph gap instead of none? Replace the line below
    with:  .mqb-msg-bubble br + br { display:block; margin-top:5px; }  ) */
.mqb-msg-bubble br + br { display: none; }

.mqb-msg-time {
  font-size: 10.5px;
  color: var(--mqb-text-soft);
  margin-top: 4px;
  padding: 0 8px;
}

/* Helpful feedback buttons */
.mqb-msg-feedback {
  display: flex;
  gap: 6px;
  margin-top: 6px;
  padding-left: 8px;
}
.mqb-msg-feedback button {
  background: white;
  border: 1px solid var(--mqb-border);
  border-radius: 12px;
  padding: 3px 10px;
  font-size: 11px;
  cursor: pointer;
  color: var(--mqb-text-soft);
  transition: all .15s;
}
.mqb-msg-feedback button:hover {
  background: var(--mqb-bg-soft);
  border-color: var(--mqb-primary);
  color: var(--mqb-primary);
}
.mqb-msg-feedback button.selected {
  background: var(--mqb-primary);
  color: white;
  border-color: var(--mqb-primary);
}

/* Typing indicator */
.mqb-typing {
  display: inline-flex;
  gap: 3px;
  padding: 12px 14px;
  background: var(--mqb-bot-bubble);
  border-radius: 16px;
  border: 1px solid var(--mqb-border);
}
.mqb-typing span {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--mqb-text-soft);
  animation: mqb-blink 1.4s infinite both;
}
.mqb-typing span:nth-child(2) { animation-delay: 0.2s; }
.mqb-typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes mqb-blink {
  0%, 80%, 100% { opacity: 0.3; }
  40%           { opacity: 1; }
}

/* ─── v5.10: Collapsible suggestion bar ───────────────────────────── */
.mqb-suggestions-wrap {
  /* v5.10.4: Start hidden — JS shows it once chips are rendered.
     Prevents brief flash of empty toggle bar before suggestions load. */
  display: none;
  flex-direction: column;
  border-top: 1px solid var(--mqb-border);
  background: var(--mqb-bg);
  flex-shrink: 0;
}
.mqb-suggestions-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 5px 12px;
  background: transparent;
  border: none;
  border-bottom: 1px solid transparent;
  color: #64748b;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  cursor: pointer;
  transition: all 0.15s ease;
  font-family: inherit;
}
.mqb-suggestions-toggle:hover {
  background: rgba(15, 118, 110, 0.04);
  color: var(--mqb-primary);
}
.mqb-st-label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.mqb-st-chev {
  transition: transform 0.25s ease;
  flex-shrink: 0;
}
/* Collapsed state — chevron points down, chip area hidden */
.mqb-suggestions-wrap.is-collapsed .mqb-st-chev {
  transform: rotate(-90deg);
}
.mqb-suggestions-wrap.is-collapsed .mqb-chat-suggestions {
  max-height: 0 !important;
  padding-top: 0 !important;
  padding-bottom: 0 !important;
  border: none;
  overflow: hidden;
  opacity: 0;
}

/* Suggestion chips */
.mqb-chat-suggestions {
  padding: 8px 12px;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  background: var(--mqb-bg);
  max-height: 100px;
  overflow-y: auto;
  transition: max-height 0.25s ease, padding 0.25s ease, opacity 0.2s ease;
  opacity: 1;
}
/* v5.10.3 — :empty rule removed; JS now controls wrap visibility for reliable toggle.
   When sugBox is empty, JS sets the WRAP to display:none so the user never sees
   a "💡 SUGGESTIONS" header with nothing to expand. */
.mqb-chat-suggestions:empty { /* handled by JS now */ }
.mqb-suggestion-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--mqb-bg-soft);
  border: 1px solid var(--mqb-primary);
  color: var(--mqb-primary);
  padding: 6px 12px 6px 10px;
  border-radius: 16px;
  font-size: 12px;
  cursor: pointer;
  transition: all .15s;
  white-space: nowrap;
  font-weight: 500;
  font-family: inherit;
}
.mqb-suggestion-chip:hover {
  background: var(--mqb-primary);
  color: white;
}
.mqb-chip-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}
.mqb-chip-icon svg {
  width: 14px;
  height: 14px;
}

/* Input row */
.mqb-chat-input-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-top: 1px solid var(--mqb-border);
  background: var(--mqb-bg);
  flex-shrink: 0;
}
#mqb-chat-input {
  flex: 1;
  border: 1px solid var(--mqb-border);
  border-radius: 22px;
  padding: 9px 14px;
  font-size: 13.5px;
  outline: none;
  font-family: inherit;
  color: var(--mqb-text);
  transition: border-color .15s;
}
#mqb-chat-input:focus {
  border-color: var(--mqb-primary);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.12);
}
#mqb-chat-send {
  background: var(--mqb-primary);
  color: white;
  border: none;
  width: 38px; height: 38px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s, transform .1s;
  flex-shrink: 0;
}
#mqb-chat-send:hover { background: var(--mqb-primary-dark); }
#mqb-chat-send:active { transform: scale(0.9); }
#mqb-chat-send:disabled { background: #cbd5e1; cursor: not-allowed; }

/* Footer */
.mqb-chat-footer {
  text-align: center;
  font-size: 10.5px;
  color: var(--mqb-text-soft);
  padding: 6px;
  background: var(--mqb-bg);
  border-top: 1px solid var(--mqb-border);
}
.mqb-chat-footer b { color: var(--mqb-primary); }

/* ===== Sender label (admin / system messages) ===== */
.mqb-msg-sender {
  font-size: 11px;
  color: var(--mqb-primary);
  font-weight: 600;
  margin-bottom: 4px;
  padding: 0 6px;
}
.mqb-msg-bubble.mqb-msg-ai {
  border-left: 3px solid var(--mqb-primary-light);
  background: linear-gradient(135deg, #f0fdfa 0%, #ecfdf5 100%);
}
.mqb-msg-bubble.mqb-msg-system {
  background: #fef3c7;
  color: #78350f;
  border: 1px dashed #fbbf24;
  font-size: 12px;
}

/* ===== Handoff form ===== */
.mqb-handoff-form {
  padding: 14px;
  background: var(--mqb-bg-soft);
  border-top: 1px solid var(--mqb-border);
}
.mqb-handoff-form h4 {
  font-size: 14px;
  margin-bottom: 8px;
  color: var(--mqb-primary);
}
.mqb-handoff-form input,
.mqb-handoff-form textarea {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--mqb-border);
  border-radius: 8px;
  font-size: 13px;
  font-family: inherit;
  margin-bottom: 8px;
  outline: none;
}
.mqb-handoff-form input:focus,
.mqb-handoff-form textarea:focus {
  border-color: var(--mqb-primary);
}
.mqb-handoff-form textarea { resize: vertical; }
.mqb-handoff-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}
.mqb-btn-cancel, .mqb-btn-submit {
  padding: 7px 14px;
  border-radius: 8px;
  border: none;
  font-size: 13px;
  cursor: pointer;
  font-weight: 500;
}
.mqb-btn-cancel {
  background: white;
  border: 1px solid var(--mqb-border);
  color: var(--mqb-text-soft);
}
.mqb-btn-submit {
  background: var(--mqb-primary);
  color: white;
}
.mqb-btn-submit:hover { background: var(--mqb-primary-dark); }

/* === Attach (paperclip) button in input row === */
.mqb-icon-btn-input {
  background: transparent;
  border: none;
  color: var(--mqb-text-soft);
  width: 36px; height: 36px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all .15s ease;
  flex-shrink: 0;
}
.mqb-icon-btn-input:hover {
  background: var(--mqb-bg-soft);
  color: var(--mqb-primary);
}
.mqb-icon-btn-input svg { display: block; pointer-events: none; }

/* === Image attachment in messages === */
.mqb-msg-attachment {
  margin: 4px 0;
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  max-width: 240px;
}
.mqb-msg-attachment img {
  width: 100%;
  max-height: 240px;
  object-fit: cover;
  display: block;
  transition: transform .2s;
}
.mqb-msg-attachment:hover img { transform: scale(1.02); }
.mqb-msg-attachment-name {
  font-size: 11px;
  color: var(--mqb-text-soft);
  margin-top: 4px;
  padding: 0 4px;
  word-break: break-all;
}
.mqb-msg-user .mqb-msg-attachment-name { color: rgba(255,255,255,0.85); }

/* === End-chat mode for handoff button (red tint) === */
.mqb-chat-actions button.mqb-end-chat-mode {
  background: rgba(239, 68, 68, 0.25);
}
.mqb-chat-actions button.mqb-end-chat-mode:hover {
  background: rgba(239, 68, 68, 0.45);
}

/* === Welcome card with avatar === */
.mqb-welcome-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 18px 16px 14px;
  margin: 0 0 12px;
  background: linear-gradient(180deg, #f0fdfa 0%, transparent 100%);
  border-radius: 14px;
  animation: mqb-welcome-pop .4s ease;
}
@keyframes mqb-welcome-pop {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.mqb-welcome-avatar {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  background: white;
  border: 3px solid var(--mqb-primary, #0f766e);
  box-shadow: 0 8px 24px rgba(15, 118, 110, 0.18);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
}
.mqb-welcome-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.mqb-welcome-text {
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--mqb-text, #0f172a);
  background: white;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--mqb-border, #e2e8f0);
}
.mqb-welcome-text b {
  color: var(--mqb-primary, #0f766e);
}

/* ===== Custom modal (replaces native confirm/alert) ===== */
.mqb-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: mqb-modal-fade .2s ease;
  transition: opacity .15s ease;
  font-family: var(--mqb-font, 'Plus Jakarta Sans', system-ui, sans-serif);
}
@keyframes mqb-modal-fade {
  from { opacity: 0; }
  to   { opacity: 1; }
}
.mqb-modal {
  background: white;
  border-radius: 16px;
  padding: 24px 24px 18px;
  max-width: 380px;
  width: 100%;
  box-shadow: 0 24px 60px rgba(0,0,0,0.35);
  animation: mqb-modal-pop .25s cubic-bezier(.34,1.56,.64,1);
}
@keyframes mqb-modal-pop {
  from { opacity: 0; transform: translateY(14px) scale(0.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.mqb-modal-title {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 8px;
  color: #0f172a;
  letter-spacing: -0.2px;
}
.mqb-modal-body {
  font-size: 14px;
  line-height: 1.55;
  color: #475569;
  margin-bottom: 22px;
  white-space: pre-wrap;
}
.mqb-modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}
.mqb-modal-btn {
  padding: 9px 18px;
  border-radius: 9px;
  border: none;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s;
  font-family: inherit;
  min-width: 80px;
}
.mqb-modal-cancel {
  background: white;
  color: #64748b;
  border: 1.5px solid #cbd5e1;
}
.mqb-modal-cancel:hover {
  background: #f8fafc;
  border-color: #94a3b8;
}
.mqb-modal-primary {
  background: var(--mqb-primary, #0f766e);
  color: white;
}
.mqb-modal-primary:hover {
  background: var(--mqb-primary-dark, #0d5c56);
}
.mqb-modal-danger {
  background: #dc2626;
  color: white;
}
.mqb-modal-danger:hover {
  background: #b91c1c;
}


/* ===== Contact form (professional, teal-themed) ===== */
.mqb-contact-form {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-left: 4px solid #0f766e;
  border-radius: 10px;
  padding: 16px 18px;
  box-shadow: 0 2px 8px rgba(15, 118, 110, 0.06);
  font-family: inherit;
  margin-top: 4px;
}
.mqb-cf-header {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 14px;
}
.mqb-cf-icon {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, #0f766e 0%, #14b8a6 100%);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(15, 118, 110, 0.25);
}
.mqb-cf-title {
  font-size: 14px;
  font-weight: 600;
  color: #0f172a;
  margin-bottom: 3px;
  line-height: 1.3;
}
.mqb-cf-subtitle {
  font-size: 12.5px;
  color: #64748b;
  line-height: 1.5;
}
.mqb-cf-fields {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 4px;
}
.mqb-cf-field label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: #475569;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  margin-bottom: 4px;
}
.mqb-cf-field input {
  width: 100%;
  padding: 9px 12px;
  border: 1.5px solid #cbd5e1;
  border-radius: 7px;
  font-size: 14px;
  font-family: inherit;
  background: #f8fafc;
  color: #0f172a;
  box-sizing: border-box;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}
.mqb-cf-field input:focus {
  outline: none;
  border-color: #0f766e;
  background: white;
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.12);
}
.mqb-cf-error {
  color: #dc2626;
  font-size: 12px;
  margin-top: 8px;
  padding: 6px 10px;
  background: #fef2f2;
  border-radius: 6px;
  border-left: 3px solid #dc2626;
}
.mqb-cf-actions {
  display: flex;
  gap: 8px;
  margin-top: 14px;
  align-items: stretch;
}
.mqb-cf-submit {
  flex: 1;
  padding: 10px 14px;
  background: #0f766e;
  color: white;
  border: none;
  border-radius: 7px;
  font-size: 13.5px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
  letter-spacing: 0.2px;
}
.mqb-cf-submit:hover:not(:disabled) {
  background: #0d5c56;
}
.mqb-cf-submit:active:not(:disabled) {
  transform: translateY(1px);
}
.mqb-cf-submit:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}
.mqb-cf-skip {
  padding: 10px 16px;
  background: transparent;
  color: #64748b;
  border: 1.5px solid #e2e8f0;
  border-radius: 7px;
  font-size: 13.5px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.mqb-cf-skip:hover:not(:disabled) {
  background: #f8fafc;
  color: #0f172a;
  border-color: #cbd5e1;
}
.mqb-cf-skip:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ===== Inline "Talk to a human" button (in bot messages) ===== */
.mqb-inline-handoff-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  margin: 2px 2px;
  background: linear-gradient(135deg, #0f766e 0%, #14b8a6 100%);
  color: white;
  border: none;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(15, 118, 110, 0.25);
  transition: transform 0.1s, box-shadow 0.15s;
  vertical-align: middle;
}
.mqb-inline-handoff-btn:hover {
  box-shadow: 0 3px 10px rgba(15, 118, 110, 0.35);
  transform: translateY(-1px);
}
.mqb-inline-handoff-btn:active {
  transform: translateY(0);
}

/* =====================  🎤 Voice / Speech buttons  ===================== */

/* Per-message speaker button (small, appears below bot bubble) */
.mqb-speak-btn {
  background: transparent;
  border: 1px solid var(--mqb-border);
  border-radius: 999px;
  width: 26px;
  height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--mqb-text-soft);
  margin-top: 6px;
  margin-left: 4px;
  align-self: flex-start;
  transition: all 0.15s ease;
  padding: 0;
  flex-shrink: 0;
}
.mqb-speak-btn:hover {
  background: var(--mqb-bg-soft);
  color: var(--mqb-primary);
  border-color: var(--mqb-primary-light);
  transform: scale(1.08);
}
.mqb-speak-btn:active { transform: scale(0.95); }
.mqb-speak-btn svg { display: block; pointer-events: none; }

/* Active state: pulsing teal while reading aloud */
.mqb-speak-btn.mqb-speak-active {
  background: var(--mqb-primary);
  color: #fff;
  border-color: var(--mqb-primary);
  animation: mqb-speak-pulse 1.4s ease-in-out infinite;
}
@keyframes mqb-speak-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(15, 118, 110, 0.5); }
  50%      { box-shadow: 0 0 0 6px rgba(15, 118, 110, 0); }
}

/* Header voice-mode toggle button — green dot when ON */
#mqb-chat-voice {
  position: relative;
}
#mqb-chat-voice.mqb-voice-on {
  background: rgba(74, 222, 128, 0.25);
  color: #4ade80;
}
#mqb-chat-voice.mqb-voice-on::after {
  content: '';
  position: absolute;
  top: 4px;
  right: 4px;
  width: 7px;
  height: 7px;
  background: #4ade80;
  border-radius: 50%;
  border: 1.5px solid var(--mqb-primary-dark);
  animation: mqb-voice-blink 1.5s ease-in-out infinite;
}
@keyframes mqb-voice-blink {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.4; }
}

/* ================================================================ */
/* Navigation Link Button — appears when bot answer includes link    */
/* ================================================================ */
.mqb-nav-link-wrap {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed rgba(15, 118, 110, 0.25);
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.mqb-nav-link-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: linear-gradient(135deg, #0f766e, #0a4f49);
  color: #ffffff !important;
  text-decoration: none !important;
  border-radius: 8px;
  font-size: 0.78rem;
  font-weight: 700;
  font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  letter-spacing: 0.01em;
  box-shadow: 0 2px 6px rgba(15, 118, 110, 0.25), 0 1px 2px rgba(15, 23, 42, 0.08);
  transition: all 0.18s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
  white-space: nowrap;
  border: none;
  line-height: 1.3;
}

.mqb-nav-link-btn:hover,
.mqb-nav-link-btn:focus {
  background: linear-gradient(135deg, #14b8a6, #0f766e);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(15, 118, 110, 0.35), 0 2px 4px rgba(15, 23, 42, 0.12);
  color: #ffffff !important;
  text-decoration: none !important;
}

.mqb-nav-link-btn:active {
  transform: translateY(0);
  box-shadow: 0 2px 4px rgba(15, 118, 110, 0.2);
}

.mqb-nav-link-btn::after {
  content: '→';
  margin-left: 2px;
  font-weight: 700;
  font-size: 0.9em;
  transition: transform 0.18s;
}

.mqb-nav-link-btn:hover::after {
  transform: translateX(3px);
}

/* If multiple buttons, wrap nicely */
.mqb-nav-link-wrap .mqb-nav-link-btn + .mqb-nav-link-btn {
  background: rgba(15, 118, 110, 0.08);
  color: #0f766e !important;
  box-shadow: none;
}

.mqb-nav-link-wrap .mqb-nav-link-btn + .mqb-nav-link-btn:hover {
  background: rgba(15, 118, 110, 0.15);
  color: #0f766e !important;
}
/* ════════════════════════════════════════════════════════════════ */
/* VOICE INPUT (v5.8) — mic button, language badge, listening pulse */
/* ════════════════════════════════════════════════════════════════ */
.mqb-mic-btn {
  position: relative;
  transition: all 0.18s ease;
}
.mqb-mic-btn:hover {
  color: #0f766e;
  background: rgba(15, 118, 110, 0.08);
}
/* Language indicator badge on mic */
.mqb-mic-lang {
  position: absolute;
  bottom: 1px;
  right: 1px;
  background: #0f766e;
  color: white;
  font-size: 8px;
  font-weight: 700;
  padding: 1px 4px;
  border-radius: 4px;
  line-height: 1;
  letter-spacing: 0.3px;
  pointer-events: auto;
  cursor: pointer;
  border: 1.5px solid white;
  user-select: none;
  transition: transform 0.15s;
}
.mqb-mic-lang:hover {
  transform: scale(1.18);
  background: #0a4f49;
}
/* Listening state — pulsing red */
.mqb-mic-btn.is-listening {
  color: white !important;
  background: #ef4444 !important;
  animation: mqb-mic-pulse 1.3s infinite ease-in-out;
}
.mqb-mic-btn.is-listening .mqb-mic-lang {
  background: white;
  color: #dc2626;
}
@keyframes mqb-mic-pulse {
  0%, 100% { box-shadow: 0 0 0 0   rgba(239, 68, 68, 0.55); }
  50%      { box-shadow: 0 0 0 8px rgba(239, 68, 68, 0); }
}
/* Disabled state when browser doesn't support speech */
.mqb-mic-btn[disabled] {
  opacity: 0.35;
  cursor: not-allowed;
}

/* Floating voice status banner above input */
.mqb-voice-status {
  position: absolute;
  bottom: 64px;
  left: 50%;
  transform: translateX(-50%);
  background: #1e293b;
  color: white;
  padding: 8px 16px;
  border-radius: 18px;
  font-size: 12.5px;
  font-weight: 500;
  white-space: nowrap;
  max-width: 90%;
  overflow: hidden;
  text-overflow: ellipsis;
  z-index: 100;
  pointer-events: none;
  display: none;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.18);
}
.mqb-voice-status.show { display: block; }
.mqb-voice-status.success { background: #0f766e; }
.mqb-voice-status.error   { background: #dc2626; }
.mqb-voice-status.listening {
  background: #ef4444;
  animation: mqb-status-glow 1.5s infinite ease-in-out;
}
@keyframes mqb-status-glow {
  0%, 100% { box-shadow: 0 8px 22px rgba(239, 68, 68, 0.4); }
  50%      { box-shadow: 0 8px 22px rgba(239, 68, 68, 0.8), 0 0 30px rgba(239, 68, 68, 0.4); }
}
/* ═══════════════════════════════════════════════════════════════════ */
/* DATA ACCESS UI (v5.10) — permission prompts + data result cards    */
/* ═══════════════════════════════════════════════════════════════════ */

/* ─── Permission prompt card ─── */
.mqb-perm-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  padding: 0;
  margin: 6px 0;
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(15, 118, 110, 0.08);
}
/* Header strip with lock icon + title */
.mqb-perm-title {
  display: flex;
  align-items: center;
  gap: 9px;
  font-weight: 700;
  font-size: 14px;
  color: #ffffff;
  line-height: 1.4;
  margin: 0;
  padding: 14px 16px;
  background: linear-gradient(135deg, #0f766e 0%, #0d9488 100%);
}
.mqb-perm-body {
  font-size: 12.5px;
  color: #475569;
  line-height: 1.65;
  margin: 0;
  padding: 14px 16px 4px;
}
/* Each ✅ line becomes a clean row */
.mqb-perm-body br + ✅,
.mqb-perm-body {
  /* spacing handled below via .mqb-perm-feat */
}
.mqb-perm-actions {
  display: flex;
  gap: 10px;
  padding: 12px 16px 16px;
}
.mqb-perm-btn {
  flex: 1;
  padding: 11px 14px;
  border: none;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease, opacity 0.15s, background 0.15s;
  font-family: inherit;
}
.mqb-perm-btn:disabled { opacity: 0.55; cursor: wait; }
.mqb-perm-allow {
  background: linear-gradient(135deg, #0f766e, #0d9488);
  color: white;
  box-shadow: 0 2px 8px rgba(15, 118, 110, 0.25);
}
.mqb-perm-allow:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(15, 118, 110, 0.35);
}
.mqb-perm-deny {
  background: #f8fafc;
  color: #64748b;
  border: 1px solid #e2e8f0;
}
.mqb-perm-deny:hover:not(:disabled) {
  background: #f1f5f9;
  color: #475569;
}
/* Lock icon wrapper in header */
.mqb-perm-lock {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  background: rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  flex-shrink: 0;
}
/* Intro paragraph */
.mqb-perm-intro {
  margin: 0 0 12px;
  font-size: 12.5px;
  color: #475569;
  line-height: 1.6;
}
/* Feature checklist */
.mqb-perm-feats {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 9px;
}
.mqb-perm-feats li {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  font-size: 12.5px;
  color: #334155;
  line-height: 1.45;
}
.mqb-perm-check {
  flex-shrink: 0;
  margin-top: 1px;
  background: #ccfbf1;
  border-radius: 5px;
  padding: 2px;
  box-sizing: content-box;
}
.mqb-perm-feats li b { color: #0f766e; font-weight: 700; }

/* ─── Data result card ─── */
.mqb-data-card {
  background: linear-gradient(135deg, #f0fdfa 0%, #e6fcf5 100%);
  border: 1px solid #5eead4;
  border-radius: 12px;
  padding: 11px 12px;
  margin: 3px 0;
  color: #0f172a;
}
.mqb-data-warn-card {
  background: linear-gradient(135deg, #fff7ed 0%, #ffedd5 100%);
  border-color: #fdba74;
}
.mqb-data-title {
  font-weight: 600;
  font-size: 12.5px;
  color: #0f766e;
  margin-bottom: 6px;
}
.mqb-data-warn-card .mqb-data-title { color: #c2410c; }
.mqb-data-big {
  font-size: 21px;
  font-weight: 700;
  color: #0f766e;
  letter-spacing: -0.3px;
  margin: 4px 0;
  font-family: 'JetBrains Mono', 'Inter', sans-serif;
}
.mqb-data-red { color: #dc2626; }
.mqb-data-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 11px;
  color: #475569;
  margin: 3px 0;
  flex-wrap: wrap;
}
.mqb-data-row span { white-space: nowrap; }
.mqb-data-warn  { color: #c2410c; font-weight: 500; }
.mqb-data-success { color: #15803d; font-weight: 500; }
.mqb-data-sub {
  font-size: 9.5px;
  color: #64748b;
  margin: 6px 0 3px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.mqb-data-empty {
  text-align: center;
  color: #64748b;
  padding: 12px 8px;
  font-size: 12px;
}

/* ─── Debtor / top client list ─── */
.mqb-debtor-list {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin-top: 3px;
}
.mqb-debtor-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 8px;
  background: rgba(255, 255, 255, 0.7);
  border-radius: 6px;
  font-size: 11px;
}
.mqb-debtor-rank {
  width: 18px;
  height: 18px;
  background: #0f766e;
  color: white;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 9.5px;
  flex-shrink: 0;
}
.mqb-data-warn-card .mqb-debtor-rank { background: #dc2626; }
.mqb-debtor-name {
  flex: 1;
  font-weight: 500;
  color: #0f172a;
  min-width: 0;
  word-wrap: break-word;
  line-height: 1.3;
}
.mqb-debtor-name small { color: #94a3b8; font-weight: 400; font-size: 9.5px; }
.mqb-debtor-amt {
  font-weight: 600;
  color: #0f766e;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11.5px;
  white-space: nowrap;
}
.mqb-data-warn-card .mqb-debtor-amt { color: #dc2626; }

/* ─── Monthly trend bars (ascii-like horizontal bars) ─── */
.mqb-trend-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: 4px;
}
.mqb-trend-row {
  display: grid;
  grid-template-columns: 48px 1fr 72px;
  align-items: center;
  gap: 6px;
  font-size: 10.5px;
  padding: 2px 0;
}
.mqb-trend-label {
  font-weight: 600;
  color: #475569;
  font-size: 10px;
}
.mqb-trend-bar {
  background: rgba(255,255,255,0.7);
  border-radius: 3px;
  height: 11px;
  overflow: hidden;
  position: relative;
}
.mqb-trend-bar > span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #14b8a6, #0f766e);
  border-radius: 3px;
  transition: width 0.4s ease;
}
.mqb-trend-val {
  text-align: right;
  font-weight: 600;
  color: #0f766e;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  white-space: nowrap;
}

/* ─── Recent activity list ─── */
.mqb-recent-list {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.mqb-recent-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px;
  padding: 5px 8px;
  background: rgba(255,255,255,0.7);
  border-radius: 5px;
  font-size: 10.5px;
  align-items: center;
}
.mqb-recent-row b { color: #0f172a; font-size: 11px; }
.mqb-recent-row small {
  display: block;
  color: #64748b;
  font-size: 9.5px;
  margin-top: 1px;
}
.mqb-recent-amt {
  font-weight: 600;
  color: #0f766e;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  white-space: nowrap;
}

/* ─── Banner shown after permission granted ─── */
.mqb-data-granted {
  background: #dcfce7;
  color: #15803d;
  border: 1px solid #86efac;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 500;
  margin-bottom: 6px;
}

/* ═══════════════════════════════════════════════════════════════════ */
/* v5.10.2 SVG CHART STYLES — bar charts for sales vs expenses        */
/* ═══════════════════════════════════════════════════════════════════ */

.mqb-svg-chart {
  width: 100%;
  max-width: 100%;
  height: auto;
  display: block;
  margin: 8px 0;
  background: rgba(255,255,255,0.4);
  border-radius: 8px;
  padding: 4px;
}
.mqb-svg-large {
  min-height: 220px;
}

/* Profit/Loss summary box below comparison chart */
.mqb-pl-summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(255, 255, 255, 0.6);
  padding: 10px 12px;
  border-radius: 8px;
  margin-top: 6px;
  flex-wrap: wrap;
  gap: 6px;
}
.mqb-pl-row {
  font-size: 14px;
  font-weight: 600;
}
.mqb-pl-row b { font-weight: 700; }
.mqb-pl-margin {
  font-size: 12px;
  color: #64748b;
  font-weight: 500;
  font-family: 'JetBrains Mono', monospace;
}

.mqb-pl-breakdown {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 11.5px;
  color: #475569;
}
.mqb-pl-breakdown span {
  background: rgba(255,255,255,0.5);
  padding: 3px 8px;
  border-radius: 5px;
}

/* Chart legend below grouped bar chart */
.mqb-chart-legend {
  display: flex;
  justify-content: space-around;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 8px;
  padding: 8px 10px;
  background: rgba(255,255,255,0.5);
  border-radius: 8px;
  font-size: 11.5px;
  color: #334155;
}
.mqb-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-weight: 500;
}
.mqb-legend-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 2px;
}
.mqb-legend-sales { background: linear-gradient(180deg, #14b8a6, #0f766e); }
.mqb-legend-exp   { background: linear-gradient(180deg, #f87171, #dc2626); }

/* ═══════════════════════════════════════════════════════════════════ */
/* v5.11 AI-SQL RESULTS — query result table + Excel export            */
/* ═══════════════════════════════════════════════════════════════════ */
.mqb-sql-card { }
.mqb-sql-count {
  font-size: 12px;
  color: #0f766e;
  font-weight: 600;
  margin: 2px 0 8px;
}
.mqb-sql-table-wrap {
  overflow-x: auto;
  border-radius: 8px;
  border: 1px solid #d1e7e3;
  background: white;
  margin: 6px 0;
  -webkit-overflow-scrolling: touch;
}
.mqb-sql-table {
  border-collapse: collapse;
  width: 100%;
  font-size: 11.5px;
  white-space: nowrap;
}
.mqb-sql-table thead th {
  background: #0f766e;
  color: white;
  padding: 7px 10px;
  text-align: left;
  font-weight: 600;
  position: sticky;
  top: 0;
}
.mqb-sql-table tbody td {
  padding: 6px 10px;
  border-bottom: 1px solid #eef2f6;
  color: #1e293b;
}
.mqb-sql-table tbody tr:nth-child(even) { background: #f8fafc; }
.mqb-sql-table tbody tr:hover { background: #ecfdf5; }
.mqb-sql-more {
  font-size: 11.5px;
  color: #64748b;
  font-style: italic;
  margin: 6px 0;
  text-align: center;
}
.mqb-sql-export-row {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}
.mqb-sql-export-btn {
  flex: 1;
  padding: 9px;
  background: linear-gradient(135deg, #16a34a, #15803d);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.1s, box-shadow 0.1s;
  font-family: inherit;
}
.mqb-sql-export-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 14px rgba(22, 163, 74, 0.3);
}
.mqb-sql-export-pdf {
  background: linear-gradient(135deg, #dc2626, #b91c1c);
}
.mqb-sql-export-pdf:hover {
  box-shadow: 0 6px 14px rgba(220, 38, 38, 0.3);
}