.chat-launcher {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 200;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 18px 8px 8px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--ink);
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: transform 0.2s, border-color 0.2s, background 0.2s;
}
.chat-launcher:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
}
.chat-launcher img {
  width: 48px;
  height: 48px;
}
.chat-launcher-label {
  padding-right: 6px;
}

.chat-panel {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 201;
  width: 360px;
  max-width: calc(100vw - 32px);
  height: 540px;
  max-height: calc(100vh - 44px);
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  transform: translateY(24px) scale(0.98);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.25s, opacity 0.25s;
}
.chat-panel.open {
  transform: translateY(0) scale(1);
  opacity: 1;
  pointer-events: auto;
}

.chat-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 14px 12px;
  border-bottom: 1px solid var(--border);
}
.chat-header img {
  width: 48px;
  height: 48px;
}
.chat-title {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  font-size: 1rem;
}
.chat-sub {
  font-size: 0.8rem;
  color: var(--ink-dim);
}
.chat-close {
  margin-left: auto;
  background: transparent;
  border: none;
  color: var(--ink-dim);
  font-size: 1.1rem;
  cursor: pointer;
  padding: 6px 8px;
  border-radius: 8px;
  transition: background 0.2s, color 0.2s;
}
.chat-close:hover { background: var(--bg-card); color: var(--ink); }

.chat-body {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scroll-behavior: smooth;
}

.msg {
  max-width: 82%;
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 0.95rem;
  line-height: 1.45;
  word-wrap: break-word;
  animation: pop 0.2s ease-out;
}
@keyframes pop {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}
.msg a { color: var(--accent); }

.msg-bot {
  align-self: flex-start;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
}
.msg-user {
  align-self: flex-end;
  background: var(--accent);
  color: #1a0d0a;
  border-bottom-right-radius: 4px;
}

.typing {
  align-self: flex-start;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  border-bottom-left-radius: 4px;
  padding: 12px 14px;
  display: inline-flex;
  gap: 4px;
}
.typing span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ink-dim);
  animation: blink 1.2s infinite;
}
.typing span:nth-child(2) { animation-delay: 0.15s; }
.typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes blink {
  0%, 60%, 100% { opacity: 0.3; }
  30% { opacity: 1; }
}

.chat-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 10px 14px 0;
}
.chip {
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--ink-dim);
  font-size: 0.82rem;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s, transform 0.15s;
}
.chip:hover {
  border-color: var(--accent);
  color: var(--accent);
  transform: translateY(-1px);
}

.chat-form {
  display: flex;
  gap: 8px;
  padding: 12px 14px 14px;
  border-top: 1px solid var(--border);
}
.chat-form input {
  flex: 1;
  padding: 10px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--ink);
  font-family: inherit;
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.2s;
}
.chat-form input:focus { border-color: var(--accent); }
.chat-form button {
  background: var(--accent);
  border: none;
  color: #1a0d0a;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  cursor: pointer;
  transition: transform 0.15s;
}
.chat-form button:hover { transform: scale(1.05); }

@media (max-width: 560px) {
  .chat-launcher-label { display: none; }
  .chat-launcher { padding: 6px; }
  .chat-panel {
    right: 10px;
    left: 10px;
    bottom: 10px;
    width: auto;
    height: 80vh;
  }
}
