/* ═══════════ AI CHAT WIDGET (bottom-right) ═══════════ */
#q-chat {
  position: fixed;
  right: 14px;
  bottom: calc(16px + var(--safe-bottom, 0px));
  z-index: 90;
  font-family: inherit;
}

body.has-sticky #q-chat {
  bottom: calc(78px + var(--safe-bottom, 0px));
}

.q-chat-fab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: none;
  border-radius: 14px;
  padding: 12px 14px;
  background: linear-gradient(180deg, #ff9a3d 0%, var(--orange) 45%, var(--orange-dark) 100%);
  color: #fff;
  font: inherit;
  font-weight: 800;
  font-size: 14px;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(255, 122, 0, 0.35);
}

.q-chat-fab.is-open { opacity: 0; pointer-events: none; }

.q-chat-panel {
  width: min(360px, calc(100vw - 28px));
  height: min(480px, calc(100vh - 120px));
  display: flex;
  flex-direction: column;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.q-chat-panel[hidden] { display: none !important; }

.q-chat-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  background: var(--orange-soft);
  border-bottom: 1px solid var(--line);
}

.q-chat-head strong {
  display: block;
  font-size: 14px;
  color: var(--text);
}

.q-chat-head span {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}

.q-chat-close {
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  padding: 0 4px;
}

.q-chat-msgs {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--bg-soft);
}

.q-chat-bubble {
  max-width: 92%;
  padding: 10px 12px;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.45;
  white-space: pre-wrap;
}

.q-chat-bot {
  align-self: flex-start;
  background: var(--bg);
  border: 1px solid var(--line);
  color: var(--text);
}

.q-chat-user {
  align-self: flex-end;
  background: var(--green-soft);
  border: 1px solid rgba(56, 142, 60, 0.25);
  color: var(--text);
}

.q-chat-thinking { opacity: 0.7; font-style: italic; }

.q-chat-support {
  padding: 8px 12px;
  font-size: 12px;
  color: var(--muted);
  border-top: 1px solid var(--line);
  background: var(--bg);
}

.q-chat-support a { color: var(--orange); font-weight: 700; }

.q-chat-form {
  display: flex;
  gap: 8px;
  padding: 10px;
  border-top: 1px solid var(--line);
  background: var(--bg);
}

.q-chat-form input {
  flex: 1;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg-soft);
  color: var(--text);
  padding: 12px;
  font: inherit;
  font-size: 14px;
  outline: none;
}

.q-chat-form button {
  width: 44px;
  border: none;
  border-radius: 12px;
  background: var(--orange);
  color: #fff;
  font-weight: 800;
  font-size: 18px;
  cursor: pointer;
}

.q-chat-form button:disabled { opacity: 0.5; cursor: wait; }
