/* chat: a customer asks, the assistant answers word by word with the sources it used */
/* in a .to-edge wrapper the body grows to fill it, so the input always sits past the panel's edge */
.ui-chat {
  width: 400px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.ui-chat > .ui-head,
.ui-chat__input {
  flex: none;
}
.ui-chat .ui-head .ui-agent {
  width: 20px;
  height: 20px;
}
.ui-chat__online {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 13px;
  color: var(--u-muted);
}
/* a quiet ink dot, as every status in the kit: no off-palette green */
.ui-chat__online::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.7;
}
.ui-chat__tool {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  color: var(--u-muted);
}
/* --chat-body sets the empty room above the input, so a placement can push the input past the panel's
   edge by a clear margin (cut on purpose) or keep it in view */
.ui-chat__body {
  flex: 1 0 auto;
  display: grid;
  gap: 12px;
  padding: 12px 16px 16px;
  min-height: var(--chat-body, 216px);
  align-content: start;
}
.ui-chat__day {
  justify-self: center;
  font-size: 13px;
  line-height: 16px;
  color: var(--u-muted);
}
.ui-msg {
  font-size: 13px;
  line-height: 20px;
  transition:
    opacity 260ms var(--u-ease),
    transform 360ms var(--u-ease);
}
.ui-msg--me {
  justify-self: end;
  max-width: 280px;
  padding: 8px 12px;
  border-radius: 14px 14px 4px 14px;
  background: var(--u-fill-2);
  color: var(--u-ink);
  box-shadow: inset 0 0 0 1px var(--u-line);
}
.ui-msg--bot {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  max-width: 340px;
}
.ui-msg__av {
  width: 22px;
  height: 22px;
  margin-top: 1px;
}
.ui-msg__col {
  display: grid;
  gap: 10px;
  min-width: 0;
  color: var(--u-text-2);
}
.ui-msg--bot b {
  font-weight: 500;
  color: var(--u-ink);
}
.ui-msg.is-hidden {
  opacity: 0;
  transform: translateY(6px);
}
.ui-chat__srcs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.ui-chat__src {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 24px;
  padding: 0 8px 0 6px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  line-height: 16px;
  color: var(--u-muted);
  background: var(--u-bg);
  box-shadow: inset 0 0 0 1px var(--u-line-2);
}
.ui-chat__src :is(.ui-icon, .ui-brand) {
  width: 13px;
  height: 13px;
}
/* the answer's last sentence is written again in place: its words never drop below 72% ink */
.ui-chat__w {
  transition: opacity 180ms var(--u-ease);
}
.ui-chat__w.is-off {
  opacity: 0.72;
}
.ui-chat__srcs.is-hidden {
  opacity: 0;
}
.ui-chat__src {
  transition:
    opacity 240ms var(--u-ease, ease),
    transform 240ms var(--u-ease, ease);
}
.ui-chat__src.is-wait {
  opacity: 0;
  transform: translateY(3px);
}
/* the typing dots: under the answer where its sources sit, only while the next words are on their way */
.ui-msg__col {
  position: relative;
}
.ui-chat__typing {
  position: absolute;
  left: 0;
  bottom: 4px;
  display: flex;
  gap: 4px;
  opacity: 0;
  transition: opacity 160ms ease;
  pointer-events: none;
}
.ui-chat__typing i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--u-muted, #6b6b6b);
  animation: ui-chat-dot 900ms ease-in-out infinite;
}
.ui-chat__typing i:nth-child(2) {
  animation-delay: 150ms;
}
.ui-chat__typing i:nth-child(3) {
  animation-delay: 300ms;
}
.ui-chat.is-typing .ui-chat__typing {
  opacity: 1;
}
@keyframes ui-chat-dot {
  0%,
  60%,
  100% {
    transform: none;
    opacity: 0.45;
  }
  30% {
    transform: translateY(-3px);
    opacity: 1;
  }
}
@media (prefers-reduced-motion: reduce) {
  .ui-chat__typing {
    display: none;
  }
}
.ui-chat__srcs {
  transition: opacity 320ms var(--u-ease);
}
.ui-chat__input {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  margin: 0 12px 12px;
  padding: 0 4px 0 12px;
  border-radius: 10px;
  background: var(--u-fill);
  box-shadow: inset 0 0 0 1px var(--u-line-2);
  font-size: 13px;
  color: var(--u-soft);
}
.ui-chat__ph {
  flex: 1;
}
.ui-chat__send {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 7px;
  background: var(--u-ink);
  color: var(--u-bg);
}
