.hx-rag-demo {
  box-sizing: border-box;
  color: #102033;
  font-family: inherit;
  width: 100%;
}

.hx-rag-demo *,
.hx-rag-demo *::before,
.hx-rag-demo *::after {
  box-sizing: border-box;
  border-radius: 0 !important;
}

.hx-rag-demo__shell {
  background: #ffffff;
  border: 1px solid #d8e2ec;
  border-radius: 0 !important;
  box-shadow: none !important;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  height: 520px;
  margin: 0 auto;
  max-width: 860px;
  overflow: hidden;
}

.hx-rag-demo__header {
  border-bottom: 1px solid #e2e8f0;
  display: grid;
  gap: 4px;
  padding: 18px 22px;
}

.hx-rag-demo__header span {
  color: #aa0000;
  font-size: 14px;
  font-weight: 700;
  text-transform: uppercase;
}

.hx-rag-demo__messages {
  background: #f8fafc;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 0;
  overflow-y: auto;
  padding: 22px;
}

.hx-rag-demo__empty {
  align-self: center;
  color: #6b7a8c;
  font-size: 12px;
  line-height: 1.6;
  margin: auto;
  max-width: 420px;
  text-align: center;
}

.hx-rag-demo__message {
  border: 1px solid #d8e2ec;
  border-radius: 0 !important;
  display: grid;
  gap: 6px;
  font-size: 12px;
  line-height: 1.55;
  max-width: min(680px, 88%);
  padding: 12px 14px;
}

.hx-rag-demo__message span {
  color: #5d6c7f;
  font-size: 12px;
  font-weight: 700;
}

.hx-rag-demo__message p {
  color: #102033;
  font-size: 12px;
  margin: 0;
  white-space: pre-wrap;
}

.hx-rag-demo__message figure {
  margin: 0;
}

.hx-rag-demo__message img {
  border: 1px solid rgba(16, 32, 51, 0.16);
  display: block;
  max-height: 180px;
  max-width: 260px;
  object-fit: cover;
  width: 100%;
}

.hx-rag-demo__message--user {
  align-self: flex-end;
  background: #aa0000;
  border-color: #aa0000;
}

.hx-rag-demo__message--user span,
.hx-rag-demo__message--user p {
  color: #ffffff;
}

.hx-rag-demo__message--assistant {
  align-self: flex-start;
  background: #ffffff;
}

.hx-rag-demo__thinking p {
  align-items: center;
  display: flex;
  gap: 5px;
  min-height: 24px;
}

.hx-rag-demo__thinking i {
  animation: hx-rag-demo-pulse 1s infinite ease-in-out;
  background: #aa0000;
  border-radius: 0 !important;
  display: block;
  height: 7px;
  opacity: 0.35;
  width: 7px;
}

.hx-rag-demo__thinking i:nth-child(2) {
  animation-delay: 0.15s;
}

.hx-rag-demo__thinking i:nth-child(3) {
  animation-delay: 0.3s;
}

.hx-rag-demo .hx-rag-demo__form {
  background: #ffffff;
  border-top: 1px solid #e2e8f0;
  display: grid;
  gap: 10px;
  padding: 16px;
}

.hx-rag-demo__composer {
  align-items: center;
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(0, 1fr) auto;
}

.hx-rag-demo__input-wrap {
  display: block;
  min-width: 0;
  position: relative;
}

.hx-rag-demo__preview {
  align-items: center;
  border: 1px solid #d8e2ec;
  display: grid;
  gap: 10px;
  grid-template-columns: 54px minmax(0, 1fr) auto;
  padding: 8px;
}

.hx-rag-demo__preview[hidden] {
  display: none;
}

.hx-rag-demo__preview img {
  display: block;
  height: 44px;
  object-fit: cover;
  width: 54px;
}

.hx-rag-demo__preview span {
  color: #102033;
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hx-rag-demo__preview button,
.hx-rag-demo__upload {
  align-items: center;
  background: #ffffff;
  border: 1px solid #cbd7e3;
  color: #102033;
  cursor: pointer;
  display: inline-flex;
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  justify-content: center;
  min-height: 48px;
  padding: 0 14px;
}

.hx-rag-demo__upload {
  border-color: transparent;
  bottom: 6px;
  color: #aa0000;
  min-height: 36px;
  padding: 0 12px;
  position: absolute;
  right: 6px;
  top: 6px;
  z-index: 2;
}

.hx-rag-demo__upload[hidden] {
  display: none !important;
}

.hx-rag-demo__preview button {
  min-height: 34px;
}

.hx-rag-demo__upload:hover,
.hx-rag-demo__upload:focus-within,
.hx-rag-demo__preview button:hover,
.hx-rag-demo__preview button:focus {
  border-color: #aa0000;
  color: #aa0000;
  outline: none;
}

.hx-rag-demo__upload input {
  height: 1px;
  opacity: 0;
  overflow: hidden;
  position: absolute;
  width: 1px;
}

.hx-rag-demo input.hx-rag-demo__input {
  background: #ffffff;
  border: 1px solid #cbd7e3;
  border-radius: 0 !important;
  color: #000000 !important;
  font: inherit;
  font-size: 14px;
  min-height: 48px;
  line-height: 48px;
  margin: 0;
  outline: none;
  padding: 0 18px;
  -webkit-text-fill-color: #000000 !important;
  width: 100%;
}

.hx-rag-demo input.hx-rag-demo__input:focus {
  border-color: #aa0000;
  box-shadow: none !important;
  color: #000000 !important;
  -webkit-text-fill-color: #000000 !important;
}

.hx-rag-demo input.hx-rag-demo__input:hover,
.hx-rag-demo input.hx-rag-demo__input:active,
.hx-rag-demo input.hx-rag-demo__input:disabled {
  color: #000000 !important;
  -webkit-text-fill-color: #000000 !important;
}

.hx-rag-demo input.hx-rag-demo__input:-webkit-autofill,
.hx-rag-demo input.hx-rag-demo__input:-webkit-autofill:hover,
.hx-rag-demo input.hx-rag-demo__input:-webkit-autofill:focus {
  -webkit-text-fill-color: #000000 !important;
}

.hx-rag-demo input.hx-rag-demo__input::placeholder {
  color: #8a8f98 !important;
  opacity: 1 !important;
  -webkit-text-fill-color: #8a8f98 !important;
}

.hx-rag-demo input.hx-rag-demo__input::-webkit-input-placeholder {
  color: #8a8f98 !important;
  opacity: 1 !important;
  -webkit-text-fill-color: #8a8f98 !important;
}

.hx-rag-demo input.hx-rag-demo__input:focus::placeholder {
  color: transparent !important;
  opacity: 0 !important;
  -webkit-text-fill-color: transparent !important;
}

.hx-rag-demo input.hx-rag-demo__input:focus::-webkit-input-placeholder {
  color: transparent !important;
  opacity: 0 !important;
  -webkit-text-fill-color: transparent !important;
}

.hx-rag-demo button.hx-rag-demo__send {
  background: #aa0000;
  border: 0;
  border-radius: 0 !important;
  color: #ffffff;
  cursor: pointer;
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  min-height: 48px;
  padding: 0 22px;
}

.hx-rag-demo button.hx-rag-demo__send:hover,
.hx-rag-demo button.hx-rag-demo__send:focus {
  background: #850000;
  color: #ffffff;
}

.hx-rag-demo--demo input.hx-rag-demo__input {
  caret-color: transparent;
}

.hx-rag-demo--demo input.hx-rag-demo__input::placeholder {
  color: #8a8f98 !important;
  -webkit-text-fill-color: #8a8f98 !important;
}

.hx-rag-demo--demo input.hx-rag-demo__input::-webkit-input-placeholder {
  color: #8a8f98 !important;
  -webkit-text-fill-color: #8a8f98 !important;
}

.hx-rag-demo--demo input.hx-rag-demo__input:focus::placeholder {
  color: transparent !important;
  opacity: 0 !important;
  -webkit-text-fill-color: transparent !important;
}

.hx-rag-demo--demo input.hx-rag-demo__input:focus::-webkit-input-placeholder {
  color: transparent !important;
  opacity: 0 !important;
  -webkit-text-fill-color: transparent !important;
}

.hx-rag-demo button.hx-rag-demo__send:disabled,
.hx-rag-demo input.hx-rag-demo__input:disabled,
.hx-rag-demo__upload:has(input:disabled) {
  cursor: wait;
  opacity: 0.65;
}

@keyframes hx-rag-demo-pulse {
  0%,
  80%,
  100% {
    transform: translateY(0);
    opacity: 0.35;
  }
  40% {
    transform: translateY(-4px);
    opacity: 1;
  }
}

@media (max-width: 640px) {
  .hx-rag-demo__shell {
    border-radius: 0 !important;
    grid-template-rows: auto minmax(0, 1fr) auto;
    height: 520px;
  }

  .hx-rag-demo__header,
  .hx-rag-demo__messages,
  .hx-rag-demo__form {
    padding-left: 14px;
    padding-right: 14px;
  }

  .hx-rag-demo__form {
    grid-template-columns: 1fr;
  }

  .hx-rag-demo__composer {
    grid-template-columns: 1fr;
  }

  .hx-rag-demo__preview {
    grid-template-columns: 48px minmax(0, 1fr);
  }

  .hx-rag-demo__preview button {
    grid-column: 1 / -1;
    width: 100%;
  }

  .hx-rag-demo__upload {
    width: auto;
  }

  .hx-rag-demo__send {
    width: 100%;
  }
}
