.manual-citations {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.manual-citations-label {
  align-self: center;
  color: #8a919c;
  font-size: 11px;
}

.manual-source-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.manual-source {
  position: relative;
  display: inline-flex;
  align-items: flex-start;
}

.manual-source-chip {
  display: flex;
  align-items: center;
  gap: 5px;
  max-width: 260px;
  padding: 5px 9px;
  border: 1px solid #e1e4e9;
  border-radius: 999px;
  background: #f6f7f8;
  color: #737b87;
  cursor: pointer;
  list-style: none;
  transition: background 160ms ease-out, border-color 160ms ease-out, color 160ms ease-out;
}

.manual-source-chip::-webkit-details-marker {
  display: none;
}

.manual-source-chip:hover,
.manual-source[open] > .manual-source-chip {
  border-color: #d4d9e0;
  background: #eceef1;
  color: #3f4854;
}

.manual-source-chip:active {
  transform: scale(.98);
}

.manual-source-index {
  color: #9aa2ad;
  font-variant-numeric: tabular-nums;
}

.manual-source-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.manual-source-detail {
  position: absolute;
  z-index: 5;
  top: calc(100% + 2px);
  left: 0;
  width: min(380px, calc(100vw - 40px));
  padding: 11px 13px;
  border: 1px solid #e5e5ea;
  border-radius: 12px;
  background: #fff;
  box-shadow: none;
  color: #1d1d1f;
}

.manual-source-meta {
  overflow-wrap: anywhere;
  color: #929aa6;
  font-size: 10px;
}

.manual-source-excerpt {
  max-height: 180px;
  overflow: auto;
  margin: 7px 0 8px;
  font-size: 12px;
  line-height: 1.65;
  white-space: pre-wrap;
}

.manual-source-link {
  color: #3d75cb;
  font-size: 11px;
  text-decoration: none;
}

.manual-source-link:hover {
  text-decoration: underline;
}

@media (max-width: 650px) {
  .manual-source-detail {
    position: fixed;
    top: auto;
    right: 20px;
    bottom: 16px;
    left: 20px;
    width: auto;
    max-height: 45vh;
    overflow: auto;
    box-shadow: none;
  }

  .manual-source-excerpt {
    max-height: none;
  }
}

.message.assistant > .assistant-text {
  display: inline;
}

.manual-citations {
  display: inline-flex;
  vertical-align: baseline;
  gap: 4px;
  margin: 0 0 0 5px;
}

.manual-citations-label {
  display: none;
}

.manual-source-list {
  display: inline-flex;
  gap: 4px;
}

.manual-source {
  display: inline-flex;
  align-items: baseline;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  letter-spacing: normal;
  box-shadow: none;
}

.manual-source-chip {
  min-width: 20px;
  justify-content: center;
  padding: 1px 4px;
  border: 0;
  border-radius: 5px;
  background: #f2f2f7;
  color: #86868b;
  font-size: 10px;
  font-weight: 600;
  line-height: 1.5;
  transition: color 120ms ease, background-color 120ms ease;
}

.manual-source-chip:hover,
.manual-source[open] > .manual-source-chip {
  border: 0;
  background: #e5e5ea;
  color: #515154;
}

.manual-source-chip:active {
  transform: none;
}

.manual-source-title {
  display: inline;
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.inline-citation {
  margin: 0 2px;
  padding: 0 3px;
  border: 0;
  border-radius: 4px;
  background: #f2f2f7;
  color: #6e6e73;
  font: inherit;
  font-size: .82em;
  cursor: pointer;
}

.inline-citation:hover,
.inline-citation:focus-visible {
  background: #e5e5ea;
  color: #1d1d1f;
  outline: none;
}

.manual-source-detail {
  top: calc(100% + 2px);
  left: 50%;
  transform: translateX(-50%);
  transform-origin: 50% 0;
  width: min(340px, calc(100vw - 32px));
  padding: 12px 14px;
  border: 1px solid #e5e5ea;
  border-radius: 12px;
  background: #ffffff;
  box-shadow: none;
  color: #1d1d1f;
}

.manual-source-detail::before {
  content: "";
  position: absolute;
  top: -8px;
  right: 0;
  left: 0;
  height: 8px;
}

.manual-source-meta {
  color: #86868b;
  font-size: 10px;
}

.manual-source-excerpt {
  color: #3c3c43;
  font-size: 12px;
  line-height: 1.55;
}

.manual-source-link {
  color: #6e6e73;
  font-size: 11px;
}

.manual-source-link:hover {
  color: #1d1d1f;
}
