.mqc {
  --mqc-blue: #4a5fe0;
  --mqc-blue-dark: #3a4bc4;
  --mqc-blue-soft: #eef0fd;
  --mqc-ink: #171a20;
  --mqc-muted: #5c5e62;
  --mqc-line: #e2e4e5;
  --mqc-soft: #f5f6f8;
  --mqc-green: #22c55e;
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 10000;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 14px;
  color: var(--mqc-ink);
  -webkit-font-smoothing: antialiased;
}
.mqc *, .mqc *::before, .mqc *::after { box-sizing: border-box; }
.mqc [hidden] { display: none !important; }
.mqc button { font-family: inherit; }

/* ---------- Launcher ---------- */
.mqc__bubble {
  position: relative;
  width: 60px;
  height: 60px;
  border: 0;
  border-radius: 50%;
  background: var(--mqc-blue);
  color: #fff;
  cursor: pointer;
  box-shadow: 0 10px 24px -6px rgba(74, 95, 224, .6), 0 2px 8px rgba(0, 0, 0, .15);
  transition: transform .18s ease, background .18s ease;
}
.mqc__bubble:hover { background: var(--mqc-blue-dark); transform: translateY(-2px); }
.mqc__bubble:focus-visible { outline: 2px solid var(--mqc-blue); outline-offset: 3px; }
.mqc__ic { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; transition: opacity .15s, transform .2s; }
.mqc__ic svg { width: 27px; height: 27px; }
.mqc__ic--close { opacity: 0; transform: rotate(-45deg); }
.mqc__bubble.is-open .mqc__ic--chat { opacity: 0; transform: rotate(45deg); }
.mqc__bubble.is-open .mqc__ic--close { opacity: 1; transform: none; }

/* ---------- Teaser ---------- */
.mqc__teaser {
  position: absolute;
  right: 0;
  bottom: 74px;
  width: 260px;
  padding: 14px 34px 14px 16px;
  background: #fff;
  border: 1px solid var(--mqc-line);
  border-radius: 14px 14px 4px 14px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, .13);
  cursor: pointer;
  animation: mqc-in .3s ease;
}
.mqc__teaser p { margin: 0 0 6px; font-size: 14px; line-height: 1.45; }
.mqc__teaser-cta { font-size: 13px; font-weight: 600; color: var(--mqc-blue); }
.mqc__teaser-x { position: absolute; top: 6px; right: 6px; width: 24px; height: 24px; padding: 5px; border: 0; background: none; color: var(--mqc-muted); cursor: pointer; }
.mqc__teaser-x svg { width: 100%; height: 100%; }

/* ---------- Panel ---------- */
.mqc__panel {
  position: absolute;
  right: 0;
  bottom: 74px;
  width: 384px;
  height: min(620px, calc(100vh - 120px));
  display: flex;
  flex-direction: column;
  background: #fff;
  border: 1px solid var(--mqc-line);
  border-radius: 16px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, .2);
  overflow: hidden;
  animation: mqc-in .22s ease;
}
@keyframes mqc-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.mqc__head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 12px 12px 14px;
  background: linear-gradient(135deg, var(--mqc-blue), var(--mqc-blue-dark));
  color: #fff;
}
.mqc__logo { width: 38px; height: 38px; flex: none; border-radius: 50%; background: #fff; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.mqc__logo img { width: 30px; height: 30px; object-fit: contain; }
.mqc__htext { flex: 1; min-width: 0; }
.mqc__htext strong { display: block; font-size: 15px; font-weight: 600; line-height: 1.2; }
.mqc__htext span { display: flex; align-items: center; gap: 6px; font-size: 12px; opacity: .9; margin-top: 2px; }
.mqc__htext i { width: 7px; height: 7px; border-radius: 50%; background: var(--mqc-green); box-shadow: 0 0 0 2px rgba(255, 255, 255, .35); }
.mqc__hbtn { width: 32px; height: 32px; flex: none; padding: 7px; border: 0; border-radius: 50%; background: rgba(255, 255, 255, .14); color: #fff; cursor: pointer; }
.mqc__hbtn:hover { background: rgba(255, 255, 255, .26); }
.mqc__hbtn svg { width: 100%; height: 100%; display: block; }

.mqc__progress { height: 3px; background: var(--mqc-blue-soft); }
.mqc__progress span { display: block; height: 100%; width: 4%; background: var(--mqc-blue); transition: width .35s ease; }

/* ---------- Messages ---------- */
.mqc__log {
  flex: 1;
  overflow-y: auto;
  padding: 16px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--mqc-soft);
  overscroll-behavior: contain;
}
.mqc__msg {
  flex-shrink: 0;
  max-width: 86%;
  padding: 10px 13px;
  border-radius: 16px;
  line-height: 1.45;
  overflow-wrap: anywhere;
  animation: mqc-in .2s ease;
}
.mqc__msg--bot { align-self: flex-start; background: #fff; border: 1px solid var(--mqc-line); border-bottom-left-radius: 4px; }
.mqc__msg--user { align-self: flex-end; background: var(--mqc-blue); color: #fff; border-bottom-right-radius: 4px; }
.mqc__msg small { display: block; margin-top: 4px; font-size: 12.5px; color: var(--mqc-muted); }
.mqc__msg b { font-weight: 600; }

.mqc__typing { display: flex; gap: 4px; padding: 13px 14px; }
.mqc__typing span { width: 7px; height: 7px; border-radius: 50%; background: #b5b9c2; animation: mqc-dot 1s infinite ease-in-out; }
.mqc__typing span:nth-child(2) { animation-delay: .15s; }
.mqc__typing span:nth-child(3) { animation-delay: .3s; }
@keyframes mqc-dot { 0%, 80%, 100% { transform: translateY(0); opacity: .5; } 40% { transform: translateY(-4px); opacity: 1; } }

.mqc__ok { width: 34px; height: 34px; margin-bottom: 8px; padding: 7px; border-radius: 50%; background: var(--mqc-green); color: #fff; }
.mqc__ok svg { width: 100%; height: 100%; display: block; }
.mqc__wa {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 10px;
  padding: 10px 14px;
  border-radius: 10px;
  background: #25d366;
  color: #fff !important;
  font-weight: 600;
  text-decoration: none !important;
}
.mqc__wa:hover { background: #1ebe5b; }
.mqc__wa svg { width: 18px; height: 18px; }

/* ---------- Summary card ---------- */
.mqc__msg--card { align-self: stretch; max-width: none; padding: 0; background: #fff; border: 1px solid var(--mqc-line); border-radius: 14px; overflow: hidden; }
.mqc__sum-items { padding: 12px 14px; background: var(--mqc-blue-soft); border-bottom: 1px solid var(--mqc-line); }
.mqc__sum-item { display: flex; align-items: flex-start; gap: 8px; padding: 6px 0; }
.mqc__sum-item + .mqc__sum-item { border-top: 1px dashed #cdd2f5; }
.mqc__sum-item > div { flex: 1; min-width: 0; }
.mqc__sum-item b { display: block; font-size: 14px; }
.mqc__sum-item span { display: block; font-size: 13px; color: var(--mqc-muted); margin-top: 2px; }
.mqc__sum-item button { width: 24px; height: 24px; flex: none; padding: 5px; border: 0; border-radius: 50%; background: #fff; color: var(--mqc-muted); cursor: pointer; }
.mqc__sum-item button svg { width: 100%; height: 100%; display: block; }
.mqc__sum-add { margin-top: 6px; padding: 0; border: 0; background: none; color: var(--mqc-blue); font-size: 13px; font-weight: 600; cursor: pointer; }
.mqc__msg--card dl { margin: 0; padding: 4px 14px 8px; }
.mqc__msg--card dl > div { display: flex; align-items: baseline; gap: 10px; padding: 7px 0; border-bottom: 1px solid #f0f1f3; }
.mqc__msg--card dl > div:last-child { border-bottom: 0; }
.mqc__msg--card dt { width: 82px; flex: none; font-size: 12px; color: var(--mqc-muted); }
.mqc__msg--card dd { flex: 1; min-width: 0; margin: 0; font-size: 13.5px; }
.mqc__msg--card dl button { flex: none; padding: 0; border: 0; background: none; color: var(--mqc-blue); font-size: 12px; font-weight: 600; cursor: pointer; }
.mqc__msg--card button:hover { text-decoration: underline; }

/* ---------- Quick replies ---------- */
.mqc__chips {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  max-height: 168px;
  overflow-y: auto;
  padding: 12px 14px 2px;
  background: #fff;
  border-top: 1px solid var(--mqc-line);
}
.mqc__chips--stack { flex-direction: column; flex-wrap: nowrap; }
.mqc__chips--stack .mqc__chip { text-align: left; border-radius: 10px; line-height: 1.3; }
.mqc__chip {
  padding: 8px 14px;
  border: 1px solid var(--mqc-blue);
  border-radius: 999px;
  background: #fff;
  color: var(--mqc-blue);
  font-size: 13.5px;
  font-weight: 500;
  line-height: 1.2;
  cursor: pointer;
  transition: background .15s, color .15s, transform .1s;
}
.mqc__chip:hover, .mqc__chip:focus-visible { background: var(--mqc-blue); color: #fff; outline: none; }
.mqc__chip:active { transform: scale(.97); }
.mqc__chip em { font-style: normal; font-size: 10.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; padding: 2px 6px; margin-left: 4px; border-radius: 999px; background: var(--mqc-blue); color: #fff; vertical-align: 1px; }
.mqc__chip--hl { background: var(--mqc-blue-soft); }
.mqc__chip--hl:hover em, .mqc__chip--hl:focus-visible em { background: #fff; color: var(--mqc-blue); }
.mqc__chip--primary { background: var(--mqc-blue); color: #fff; font-weight: 600; }
.mqc__chip--primary:hover { background: var(--mqc-blue-dark); }
.mqc__chip--ghost { border-color: var(--mqc-line); color: var(--mqc-muted); }
.mqc__chip--ghost:hover { background: var(--mqc-soft); color: var(--mqc-ink); border-color: #c9ccd1; }
.mqc__chip--wide { flex: 1; padding: 12px; font-size: 15px; border-radius: 12px; }
.mqc__chips + .mqc__form { padding-top: 8px; }
.mqc__chips:not([hidden]) { padding-bottom: 12px; }
.mqc__chips:not([hidden]) + .mqc__form { padding-top: 0; }

/* ---------- Input ---------- */
.mqc__form { display: flex; gap: 8px; padding: 12px 14px; background: #fff; }
.mqc__chips[hidden] + .mqc__form { border-top: 1px solid var(--mqc-line); }
.mqc__input {
  flex: 1;
  min-width: 0;
  height: 44px;
  padding: 0 16px;
  border: 1px solid var(--mqc-line);
  border-radius: 999px;
  font: inherit;
  font-size: 15px;
  color: var(--mqc-ink);
  background: #fff;
}
.mqc .mqc__form .mqc__input:focus, .mqc__input:focus { outline: none; border-color: var(--mqc-blue) !important; box-shadow: 0 0 0 3px rgba(74, 95, 224, .15); }
.mqc__send { width: 44px; height: 44px; flex: none; padding: 11px; border: 0; border-radius: 50%; background: var(--mqc-blue); color: #fff; cursor: pointer; }
.mqc__send:hover { background: var(--mqc-blue-dark); }
.mqc__send svg { width: 100%; height: 100%; display: block; }
/* Site themes style every input / submit button (full width, margins, square
   corners…); these stronger rules keep the chat's own look on every theme. */
.mqc .mqc__form .mqc__input { flex: 1; min-width: 0; padding: 0 16px !important; border: 1px solid var(--mqc-line) !important; border-radius: 999px !important; background: #fff !important; color: var(--mqc-ink) !important; outline: none; width: auto !important; max-width: none; height: 44px !important; margin: 0 !important; line-height: normal; font-size: 15px !important; text-transform: none; letter-spacing: normal; }
.mqc .mqc__form .mqc__send { width: 44px !important; min-width: 0 !important; height: 44px !important; margin: 0 !important; padding: 11px !important; line-height: normal !important; border: 0 !important; border-radius: 50% !important; background: var(--mqc-blue) !important; color: #fff !important; box-shadow: none !important; text-transform: none; letter-spacing: normal; }
.mqc .mqc__form .mqc__send:hover { background: var(--mqc-blue-dark) !important; }
.mqc button.mqc__chip, .mqc button.mqc__hbtn, .mqc button.mqc__bubble { margin: 0; min-width: 0; text-transform: none; letter-spacing: normal; box-shadow: none; }
.mqc__hp { position: absolute !important; left: -9999px !important; width: 1px; height: 1px; opacity: 0; }
.mqc__foot { padding: 0 14px 10px; background: #fff; font-size: 11px; color: #9a9ea6; text-align: center; }

/* ---------- Mobile: full screen ---------- */
@media (max-width: 480px) {
  .mqc { right: 14px; bottom: 14px; }
  .mqc__panel { position: fixed; inset: 0; width: auto; height: 100%; height: 100dvh; border: 0; border-radius: 0; }
  .mqc__teaser { width: calc(100vw - 100px); }
  html.mqc-open, html.mqc-open body { overflow: hidden; }
  html.mqc-open .mqc__bubble { display: none; }
  .mqc__input { font-size: 16px; } /* stops iOS zooming in */
}
@media (prefers-reduced-motion: reduce) {
  .mqc__panel, .mqc__teaser, .mqc__msg, .mqc__typing span { animation: none; }
}
