.qm-chat {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 80;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.5;
}

.qm-chat *,
.qm-chat *::before,
.qm-chat *::after {
  box-sizing: border-box;
  letter-spacing: 0;
}

.qm-chat button,
.qm-chat input {
  font: inherit;
}

.qm-chat__button {
  display: inline-flex;
  width: 60px;
  height: 60px;
  min-width: 60px;
  min-height: 60px;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 999px;
  background: #2563eb;
  color: #ffffff;
  box-shadow: 0 18px 45px rgba(15, 23, 42, 0.22);
  cursor: pointer;
  transition: transform 180ms ease, background 180ms ease, box-shadow 180ms ease;
}

.qm-chat__button:hover {
  background: #1d4ed8;
  box-shadow: 0 20px 55px rgba(15, 23, 42, 0.28);
  transform: translateY(-2px);
}

.qm-chat__button svg {
  display: block;
  width: 26px;
  height: 26px;
  flex: 0 0 auto;
}

.qm-chat__button:focus-visible,
.qm-chat__input:focus-visible,
.qm-chat__send:focus-visible,
.qm-chat__close:focus-visible,
.qm-chat__prompt:focus-visible {
  outline: 3px solid rgba(37, 99, 235, 0.28);
  outline-offset: 2px;
}

.qm-chat__panel {
  position: absolute;
  right: 0;
  bottom: 76px;
  display: flex;
  width: min(380px, calc(100vw - 32px));
  height: min(620px, calc(100vh - 116px));
  min-height: 420px;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid #e2e8f0;
  border-radius: 24px;
  background: #ffffff;
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.24);
  text-align: left;
}

.qm-chat__panel[hidden] {
  display: none;
}

.qm-chat__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid #e2e8f0;
  padding: 16px;
  background: #ffffff;
}

.qm-chat__brand {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 12px;
}

.qm-chat__mark {
  display: inline-flex;
  width: 40px;
  height: 40px;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  border-radius: 14px;
  background: #2563eb;
  color: #ffffff;
  font-size: 13px;
  font-weight: 800;
}

.qm-chat__title {
  margin: 0;
  color: #0f172a;
  font-size: 15px;
  font-weight: 750;
  line-height: 1.25;
}

.qm-chat__subtitle {
  margin: 2px 0 0;
  color: #64748b;
  font-size: 12px;
  line-height: 1.35;
}

.qm-chat__close {
  display: inline-flex;
  width: 36px;
  height: 36px;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  background: #ffffff;
  color: #475569;
  cursor: pointer;
  transition: background 160ms ease, color 160ms ease;
}

.qm-chat__close svg,
.qm-chat__send svg {
  display: block;
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
}

.qm-chat__close:hover {
  background: #f8fafc;
  color: #0f172a;
}

.qm-chat__messages {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
  padding: 16px;
  background: #f8fafc;
}

.qm-chat__message {
  max-width: 88%;
  border-radius: 18px;
  padding: 10px 12px;
  font-size: 14px;
  line-height: 1.5;
  white-space: pre-wrap;
}

.qm-chat__message--bot {
  align-self: flex-start;
  border: 1px solid #e2e8f0;
  background: #ffffff;
  color: #334155;
}

.qm-chat__message--user {
  align-self: flex-end;
  background: #2563eb;
  color: #ffffff;
}

.qm-chat__message--error {
  border-color: #fecaca;
  background: #fef2f2;
  color: #991b1b;
}

.qm-chat__prompts {
  display: grid;
  gap: 8px;
  padding: 0 16px 14px;
  background: #f8fafc;
}

.qm-chat__prompt {
  border: 1px solid #dbeafe;
  border-radius: 14px;
  background: #eff6ff;
  color: #1d4ed8;
  cursor: pointer;
  padding: 9px 11px;
  text-align: left;
  font-size: 13px;
  font-weight: 650;
  line-height: 1.3;
}

.qm-chat__prompt:hover {
  background: #dbeafe;
}

.qm-chat__form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  border-top: 1px solid #e2e8f0;
  padding: 12px;
  background: #ffffff;
}

.qm-chat__input {
  min-width: 0;
  border: 1px solid #cbd5e1;
  border-radius: 16px;
  color: #0f172a;
  font: inherit;
  font-size: 14px;
  line-height: 1.4;
  padding: 11px 12px;
}

.qm-chat__input::placeholder {
  color: #94a3b8;
}

.qm-chat__send {
  display: inline-flex;
  width: 44px;
  height: 44px;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 16px;
  background: #2563eb;
  color: #ffffff;
  cursor: pointer;
}

.qm-chat__send:disabled {
  cursor: wait;
  opacity: 0.65;
}

.qm-chat__fineprint {
  margin: 0;
  padding: 0 14px 12px;
  background: #ffffff;
  color: #64748b;
  font-size: 11px;
  line-height: 1.4;
}

@media (max-width: 520px) {
  .qm-chat {
    right: 16px;
    bottom: 16px;
  }

  .qm-chat__button {
    width: 56px;
    height: 56px;
  }

  .qm-chat__panel {
    position: fixed;
    inset: auto 12px 84px 12px;
    width: auto;
    height: min(620px, calc(100vh - 104px));
    min-height: 360px;
  }
}
