#siteChatPanel[hidden] {
  display: none !important;
}

.site-chat {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 9999;
  font-family: Inter, system-ui, sans-serif;
}

.site-chat__toggle {
  width: 62px;
  height: 62px;
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  font-size: 24px;
  color: #fff;
  background: linear-gradient(135deg, #7f1d1d, #111827);
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.25);
}

.site-chat__panel {
  position: absolute;
  right: 0;
  bottom: 76px;
  width: 390px;
  max-width: calc(100vw - 24px);
  height: min(74vh, 640px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid rgba(0,0,0,.1);
  border-radius: 22px;
  background: #fff;
  box-shadow: 0 30px 70px rgba(0, 0, 0, .25);
}

.site-chat__header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  padding: 16px 18px;
  color: #fff;
  background: linear-gradient(135deg, #111827, #7f1d1d);
}

.site-chat__sub {
  margin-top: 4px;
  font-size: 12px;
  opacity: .92;
  max-width: 250px;
}

.site-chat__actions {
  display: flex;
  gap: 8px;
}

.site-chat__actions button {
  border: 0;
  background: rgba(255,255,255,.14);
  color: #fff;
  border-radius: 10px;
  padding: 8px 10px;
  cursor: pointer;
}

.site-chat__messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  background: #f8fafc;
}

.site-chat__msg {
  max-width: 88%;
  margin-bottom: 12px;
  padding: 12px 14px;
  border-radius: 16px;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
}

.site-chat__msg--assistant {
  background: #fff;
  color: #111827;
  border-top-left-radius: 6px;
  box-shadow: 0 3px 12px rgba(0,0,0,.05);
}

.site-chat__msg--user {
  margin-left: auto;
  background: #7f1d1d;
  color: #fff;
  border-top-right-radius: 6px;
}

.site-chat__msg--meta {
  font-size: 12px;
  color: #64748b;
  margin: 0 0 12px;
}

.site-chat__msg--error {
  background: #fff7ed;
  color: #9a3412;
  border: 1px solid #fdba74;
}

.site-chat__sources {
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 13px;
}

.site-chat__sources a {
  color: #7f1d1d;
  text-decoration: none;
}

.site-chat__sources a:hover {
  text-decoration: underline;
}

.site-chat__chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.site-chat__chip {
  border: 1px solid #e5e7eb;
  background: #fff;
  color: #111827;
  border-radius: 999px;
  padding: 7px 10px;
  cursor: pointer;
  font-size: 12px;
}

.site-chat__form {
  display: flex;
  gap: 10px;
  padding: 14px;
  border-top: 1px solid #e5e7eb;
  background: #fff;
}

.site-chat__form textarea {
  flex: 1;
  resize: none;
  min-height: 46px;
  max-height: 120px;
  border-radius: 14px;
  border: 1px solid #d1d5db;
  padding: 12px 14px;
  outline: none;
  font: inherit;
}

.site-chat__form button {
  border: 0;
  border-radius: 14px;
  padding: 0 16px;
  cursor: pointer;
  color: white;
  background: #111827;
  font-weight: 600;
}

.site-chat__form button[disabled] {
  opacity: .6;
  cursor: wait;
}

.site-chat__msg--thinking {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.site-chat__msg--thinking span {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #64748b;
  display: inline-block;
  animation: sitechat-bounce 1s infinite ease-in-out;
}
.site-chat__msg--thinking span:nth-child(2) { animation-delay: .12s; }
.site-chat__msg--thinking span:nth-child(3) { animation-delay: .24s; }

@keyframes sitechat-bounce {
  0%, 80%, 100% { transform: scale(.8); opacity: .45; }
  40% { transform: scale(1); opacity: 1; }
}

@media (max-width: 640px) {
  .site-chat {
    right: 12px;
    bottom: 12px;
    left: 12px;
  }

  .site-chat__toggle {
    margin-left: auto;
    display: block;
  }

  .site-chat__panel {
    left: 0;
    right: 0;
    width: auto;
    height: 72vh;
    bottom: 76px;
  }
}
