.aikm-rag-root {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 99999;
  font-family: "Noto Sans TC", "Segoe UI", sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: #1a1a1a;
}

.aikm-rag-toggle {
  border: 0;
  border-radius: 999px;
  padding: 12px 18px;
  background: #0f3d2e;
  color: #fff;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(15, 61, 46, 0.28);
}

.aikm-rag-panel {
  width: min(380px, calc(100vw - 32px));
  height: min(520px, calc(100vh - 100px));
  margin-bottom: 12px;
  display: flex;
  flex-direction: column;
  background: #f7f5f1;
  border: 1px solid #d9d2c5;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.18);
}

.aikm-rag-panel[hidden] {
  display: none !important;
}

.aikm-rag-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  background: #0f3d2e;
  color: #fff;
}

.aikm-rag-close {
  border: 0;
  background: transparent;
  color: #fff;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}

.aikm-rag-messages {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  background: linear-gradient(180deg, #f7f5f1 0%, #efeae1 100%);
}

.aikm-rag-msg {
  margin: 0 0 12px;
  padding: 10px 12px;
  border-radius: 12px;
  max-width: 92%;
  white-space: pre-wrap;
  word-break: break-word;
}

.aikm-rag-msg.user {
  margin-left: auto;
  background: #dceee6;
}

.aikm-rag-msg.bot {
  margin-right: auto;
  background: #fff;
  border: 1px solid #e4ddd1;
}

.aikm-rag-sources {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid #ebe4d8;
  font-size: 13px;
}

.aikm-rag-sources a {
  display: block;
  color: #0b5fff;
  text-decoration: underline;
  margin: 4px 0;
}

.aikm-rag-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  padding: 10px;
  background: #fff;
  border-top: 1px solid #e4ddd1;
}

.aikm-rag-form textarea {
  width: 100%;
  resize: none;
  border: 1px solid #d0c8ba;
  border-radius: 10px;
  padding: 8px 10px;
  font: inherit;
}

.aikm-rag-form button {
  border: 0;
  border-radius: 10px;
  padding: 0 14px;
  background: #0f3d2e;
  color: #fff;
  cursor: pointer;
}

.aikm-rag-form button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.aikm-rag-typing {
  opacity: 0.7;
  font-style: italic;
}
