.hi {
  width: 1em;
  height: 1em;
  display: inline-block;
  vertical-align: -0.125em;
  color: currentColor;
}

.agent-badge {
  display: inline-flex;
  align-items: center;
  height: 19px;
  padding: 2px 10px;
  border: 1px solid #cfe9da;
  border-radius: 9999px;
  background: var(--agent-green);
  color: var(--agent-green-text);
  font-size: 11px;
  font-weight: 500;
}

.agent-badge--private {
  border-color: #ddd7f6;
  background: #f4f1ff;
  color: #6553bd;
}

.agent-badge--prospect {
  border-color: #f5d9a8;
  background: #fff7e8;
  color: #a15c06;
}

.agent-badge--onboarding {
  border-color: #cfdcfb;
  background: #eff4ff;
  color: #3659c9;
}

.agent-badge--client {
  border-color: #bde7d2;
  background: #edf9f2;
  color: #237a51;
}

.field {
  margin-bottom: 1rem;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
/* File-type tiles shared by Files rows, staged uploads, and message chips. */
.file-type-icon {
  position: relative;
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 20px;
  height: 22px;
  overflow: hidden;
  border: 1.4px solid currentColor;
  border-radius: 3px 5px 3px 3px;
  background: color-mix(in srgb, currentColor 9%, var(--agent-surface));
  color: var(--agent-muted);
  line-height: 1;
}

.file-type-icon::before {
  position: absolute;
  top: -1px;
  right: -1px;
  width: 7px;
  height: 7px;
  background: linear-gradient(225deg, var(--agent-surface) 0 45%, currentColor 46% 55%, transparent 56%);
  content: "";
}

.file-type-icon__mark {
  margin-top: 4px;
  font-size: 6px;
  font-weight: 850;
  letter-spacing: -0.02em;
}

.file-type-icon--compact {
  width: 16px;
  height: 18px;
  border-width: 1.2px;
}

.file-type-icon--compact::before {
  width: 6px;
  height: 6px;
}

.file-type-icon--compact .file-type-icon__mark {
  margin-top: 3px;
  font-size: 5px;
}

.file-type-icon[data-file-type-kind="pdf"],
.file-type-icon[data-file-type-kind="video"] {
  color: #ef4444;
}

.file-type-icon[data-file-type-kind="document"],
.file-type-icon[data-file-type-kind="image"],
.file-type-icon[data-file-type-kind="email"] {
  color: #3b82f6;
}

.file-type-icon[data-file-type-kind="spreadsheet"],
.file-type-icon[data-file-type-kind="financial"] {
  color: #16a34a;
}

.file-type-icon[data-file-type-kind="presentation"],
.file-type-icon[data-file-type-kind="archive"],
.file-type-icon[data-file-type-kind="audio"] {
  color: #d97706;
}
/* One compact source affordance per financial row; hover/focus/click reveals
   the complete citation list without widening the table's Src column. */
.source-popover {
  position: relative;
  z-index: 2;
  display: inline-block;
}

.source-popover__trigger {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.4rem;
  height: 1.4rem;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--agent-muted);
  cursor: pointer;
  list-style: none;
}

.source-popover__trigger:hover,
.source-popover__trigger:focus-visible,
.source-popover__trigger[aria-expanded="true"] {
  background: var(--agent-hover);
  color: var(--agent-text);
  outline: none;
}

.source-popover__trigger svg {
  width: 0.82rem;
  height: 0.82rem;
}

.source-popover__count {
  position: absolute;
  top: -0.2rem;
  right: -0.25rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 0.85rem;
  height: 0.85rem;
  padding: 0 0.18rem;
  border: 1px solid var(--agent-surface);
  border-radius: 999px;
  background: var(--agent-body);
  color: var(--agent-surface);
  font-size: 8px;
  font-weight: 750;
  line-height: 1;
}

.source-popover__card {
  position: fixed;
  z-index: 50;
  inset: auto;
  width: min(17.5rem, calc(100vw - 2rem));
  max-height: calc(100dvh - 1rem);
  margin: 0;
  padding: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  border: 1px solid var(--agent-line);
  border-radius: 10px;
  background: var(--agent-surface);
  box-shadow: 0 10px 28px rgb(16 24 40 / 0.16);
  text-align: left;
}

.source-popover__heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0.65rem;
  border-bottom: 1px solid var(--agent-line-soft);
  background: var(--agent-card);
  color: var(--agent-muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.source-popover__list {
  display: grid;
  max-height: min(22rem, 60vh);
  overflow-y: auto;
  padding: 0.25rem;
}

.source-popover__item {
  display: grid;
  grid-template-columns: 1.5rem minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.45rem;
  min-width: 0;
  padding: 0.45rem;
  border-radius: 7px;
  color: var(--agent-text);
  text-decoration: none;
}

.source-popover__item:hover,
.source-popover__item:focus-visible {
  background: var(--agent-hover);
  outline: none;
}

.source-popover__item.is-dangling {
  color: var(--agent-faint);
}

.source-popover__item-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 6px;
  background: var(--agent-sunken);
  color: var(--agent-muted);
}

.source-popover__item-icon svg,
.source-popover__chevron svg {
  width: 0.75rem;
  height: 0.75rem;
}

.source-popover__item-copy {
  display: grid;
  min-width: 0;
  gap: 0.1rem;
}

.source-popover__item-copy strong,
.source-popover__item-copy span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.source-popover__item-copy strong {
  font-size: 11.5px;
  font-weight: 650;
}

.source-popover__item-copy span {
  color: var(--agent-muted);
  font-size: 10px;
}

.source-popover__chevron {
  display: inline-flex;
  color: var(--agent-faint);
}

/* Review exceptions share the source popover's accessible hover/focus/click
   behavior while remaining visibly distinct at rest. */
.review-popover__trigger {
  background: #fbf2e6;
  color: #b45309;
}

.review-popover__trigger:hover,
.review-popover__trigger:focus-visible,
.review-popover__trigger[aria-expanded="true"] {
  background: #fbf2e6;
  color: #9a6206;
}

.review-popover__item {
  cursor: default;
}

.review-popover__item:hover {
  background: transparent;
}

.review-popover__item-icon {
  background: #fbf2e6;
  color: #b45309;
}
