.chat-message--rich {
  white-space: normal;
}

.chat-message--loading {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  width: fit-content;
  max-width: 100%;
  background: linear-gradient(180deg, #ffffff, #f8fbff);
}

.chat-loading__label {
  font-weight: 700;
  color: var(--color-muted);
}

.chat-loading__dots {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.chat-loading__dots span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--color-blue);
  opacity: 0.35;
  animation: chat-loading-pulse 1.2s ease-in-out infinite;
}

.chat-loading__dots span:nth-child(2) {
  animation-delay: 0.15s;
}

.chat-loading__dots span:nth-child(3) {
  animation-delay: 0.3s;
}

.chat-rich-content {
  display: grid;
  gap: 8px;
}

.chat-rich-content p {
  margin: 0;
  color: inherit;
  line-height: 1.45;
}

.chat-rich-content h4 {
  margin: 2px 0 0;
  font-size: 0.88rem;
  font-weight: 900;
  color: var(--color-navy);
  letter-spacing: 0.01em;
}

.chat-rich-content ol,
.chat-rich-content ul {
  margin: 2px 0 0;
  padding-left: 18px;
  display: grid;
  gap: 4px;
}

.chat-rich-content li {
  line-height: 1.4;
}

.chat-table-wrap {
  border: 1px solid rgba(47, 117, 181, 0.22);
  border-radius: 12px;
  overflow: auto;
  background: linear-gradient(180deg, #ffffff, #f8fbff);
}

.chat-table-wrap table {
  width: 100%;
  border-collapse: collapse;
  min-width: 240px;
  font-size: 0.84rem;
}

.chat-table-wrap th,
.chat-table-wrap td {
  padding: 7px 8px;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid rgba(217, 226, 236, 0.9);
}

.chat-table-wrap th {
  background: rgba(23, 54, 93, 0.06);
  color: var(--color-navy);
  font-weight: 900;
}

.chat-table-wrap tbody tr:nth-child(even) {
  background: rgba(31, 138, 112, 0.05);
}

.chat-table-wrap tbody tr:last-child td {
  border-bottom: 0;
}

@keyframes chat-loading-pulse {
  0%, 80%, 100% {
    opacity: 0.35;
    transform: translateY(0);
  }

  40% {
    opacity: 1;
    transform: translateY(-1px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .chat-loading__dots span {
    animation: none;
    opacity: 0.7;
    transform: none;
  }
}

@media (max-width: 640px) {
  .chat-rich-content {
    gap: 7px;
  }

  .chat-table-wrap table {
    font-size: 0.8rem;
  }

  .chat-message--loading {
    gap: 8px;
  }
}
