.chat-thread {
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 10px 2px 12px;
  -webkit-overflow-scrolling: touch;
}

.chat-turn {
  display: grid;
  gap: 8px;
}

.load-older-chat {
  justify-self: center;
  width: auto;
  min-height: 34px;
  padding: 7px 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #ffffff;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
  box-shadow: 0 3px 10px rgba(24, 32, 42, 0.06);
}

.chat-message {
  max-width: min(86%, 560px);
  min-width: 0;
  padding: 11px 13px;
  border: 0;
  border-radius: 18px;
  color: var(--text);
  font: inherit;
  line-height: 1.35;
  overflow-wrap: anywhere;
  text-align: left;
}

.user-message {
  justify-self: end;
  background: #e9eef6;
}

.assistant-message {
  justify-self: start;
  display: inline-grid;
  grid-template-columns: minmax(0, 1fr) 18px;
  gap: 8px;
  align-items: center;
  background: #ffffff;
  border: 1px solid var(--line);
  cursor: pointer;
}

.assistant-message.failed {
  background: #fff4f2;
  color: #7a271a;
}

.assistant-message.pending {
  grid-template-columns: 8px minmax(0, 1fr) auto;
  cursor: default;
  color: #344054;
  background: #f8fafc;
}

.assistant-message.pending.failed {
  color: #7a271a;
  background: #fff4f2;
}

.pending-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #2563eb;
  animation: pendingPulse 1s ease-in-out infinite;
}

.pending-message {
  min-width: 0;
}

.pending-elapsed {
  justify-self: end;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  white-space: nowrap;
}

@keyframes pendingPulse {
  0%, 100% {
    opacity: 0.35;
    transform: scale(0.82);
  }
  50% {
    opacity: 1;
    transform: scale(1);
  }
}

.chat-live-transcript {
  margin: 0;
  min-height: 0;
  max-height: 72px;
  padding: 8px 10px;
  border-color: var(--line);
  background: #ffffff;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
}

.chat-composer {
  position: sticky;
  bottom: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: end;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: #ffffff;
  box-shadow: 0 8px 24px rgba(24, 32, 42, 0.08);
}

.chat-composer textarea {
  min-height: 26px;
  max-height: 140px;
  padding: 9px 4px 8px 8px;
  border: 0;
  background: transparent;
  resize: none;
  line-height: 1.35;
  outline: none;
}

.chat-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.chat-icon-button,
.chat-send-button {
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 999px;
  display: grid;
  place-items: center;
}

.chat-icon-button {
  background: #f2f4f7;
  color: #344054;
}

.chat-send-button {
  background: #111827;
  color: #ffffff;
}

.chat-send-button:disabled,
.chat-icon-button:disabled {
  opacity: 0.45;
}

.chat-icon-button.listening {
  background: #fee4e2;
  color: #b42318;
}

.send-icon {
  width: 19px;
  height: 19px;
  display: block;
  background: currentColor;
  -webkit-mask-image: url("/icons/ui/send.svg");
  -webkit-mask-position: center;
  -webkit-mask-repeat: no-repeat;
  -webkit-mask-size: contain;
  mask-image: url("/icons/ui/send.svg");
  mask-position: center;
  mask-repeat: no-repeat;
  mask-size: contain;
}
