.locus-rag-chat {
  max-width: 760px;
  border: 1px solid #d7d7d7;
  border-radius: 16px;
  background: linear-gradient(180deg, #ffffff 0%, #f4f1e8 100%);
  padding: 20px;
  box-shadow: 0 14px 40px rgba(47, 43, 32, 0.08);
  box-sizing: border-box;
}

.locus-rag-chat__header h3 {
  margin: 0 0 12px;
  font-size: 1.25rem;
  color: #2f2a1f;
}

.locus-rag-chat__header {
  display: block;
}

.locus-rag-chat__messages {
  min-height: 280px;
  max-height: 480px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.7);
  border-radius: 12px;
  border: 1px solid #e3dcc8;
  scroll-behavior: smooth;
}

.locus-rag-chat__message {
  max-width: 80%;
  padding: 12px 14px;
  border-radius: 14px;
  line-height: 1.45;
  white-space: pre-wrap;
}

.locus-rag-chat__message--user {
  align-self: flex-end;
  background: #173c3a;
  color: #fff;
}

.locus-rag-chat__message--assistant {
  align-self: flex-start;
  background: #efe3c2;
  color: #2f2a1f;
}

.locus-rag-chat.is-waiting .locus-rag-chat__messages {
  opacity: 0.88;
}

.locus-rag-chat__label {
  font-size: 0.75rem;
  font-weight: 700;
  margin-bottom: 4px;
  opacity: 0.8;
}

.locus-rag-chat__form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 16px;
  width: 100%;
}

.locus-rag-chat__input {
  width: 100%;
  min-height: 100px;
  resize: vertical;
  border-radius: 12px;
  border: 1px solid #cabf9a;
  padding: 12px 14px;
  font: inherit;
  background: #fffdf8;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
  box-sizing: border-box;
  display: block;
  max-width: 100%;
}

.locus-rag-chat__input:focus {
  outline: none;
  border-color: #9d5c0d;
  box-shadow: 0 0 0 3px rgba(157, 92, 13, 0.14);
}

.locus-rag-chat__actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.locus-rag-chat__submit {
  border: 0;
  border-radius: 999px;
  background: #9d5c0d;
  color: #fff;
  padding: 12px 18px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.12s ease, opacity 0.12s ease, background 0.12s ease;
}

.locus-rag-chat__submit:hover:not(:disabled) {
  background: #834d0c;
  transform: translateY(-1px);
}

.locus-rag-chat__reset {
  border: 1px solid #cabf9a;
  background: #fffaf0;
  color: #5c4321;
  border-radius: 999px;
  padding: 10px 14px;
  font-weight: 700;
  cursor: pointer;
}

.locus-rag-chat__reset:disabled {
  opacity: 0.6;
  cursor: default;
}

.locus-rag-chat__submit:disabled {
  opacity: 0.6;
  cursor: default;
}

@media (max-width: 640px) {
  .locus-rag-chat {
    padding: 14px;
  }

  .locus-rag-chat__message {
    max-width: 92%;
  }

  .locus-rag-chat__actions {
    flex-direction: column;
    align-items: stretch;
  }
}
