/* An answer in the transcript: the message, its sources and skills, the tools row and feedback, the user's bubble and attachments.
   Moved out of base.css, shared-components.css and features.css in their
   original cascade order; loaded after features.css and before type.css. */

/* Fixed rather than sticky: sticky still occupies a row in the chat's flex
   column, which is exactly the vertical space the messages should keep.
   Anchored left, past the rail -- the right edge is where the artifact
   panel opens. */
.shared-chat-badge {
  display: none;
  position: fixed;
  top: 14px;
  left: calc(var(--rail-width) + var(--main-pad));
  z-index: 40;
  align-items: center;
  gap: 8px;
  padding: 9px 16px 9px 13px;
  /* The constructive family rather than a grey chip: this is information
     about the conversation, and it has to hold its own floating over the
     page instead of reading as a disabled control. */
  border: 1px solid var(--green-border);
  border-radius: var(--r-pill);
  background: var(--green-soft);
  color: var(--green-deep);
  font-size: var(--text-sm);
  font-weight: 560;
  line-height: 1;
  letter-spacing: -.01em;
  white-space: nowrap;
  box-shadow: 0 1px 2px rgba(var(--muted-rgb) / .08), 0 6px 16px rgba(var(--muted-rgb) / .10);
  pointer-events: none;
}

.shared-chat-badge svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: 0 0 auto;
  opacity: .85;
}

@media (max-width: 720px) {
  .shared-chat-badge {
      left: auto;
      right: var(--main-pad);
    }
}
@media (prefers-reduced-motion: reduce) {
  button.table-hover-copy-btn {
      transition: none;
    }
}
.message {
  max-width: var(--content-width);
  width: 100%;
  margin: 0 auto;
}

.message.user {
  background: transparent;
  border: none;
  padding: 0;
  display: flex;
  /* A column so attachment rows stack above the bubble; align-items keeps
     everything on the right edge exactly as justify-content used to. */
  flex-direction: column;
  align-items: flex-end;
}

.message.user .bubble {
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 14px 18px;
  width: fit-content;
  max-width: 75%;
  white-space: pre-wrap;
  word-break: break-word;
}

.message.assistant {
  background: transparent;
  border: 0;
  border-radius: 0;
  padding: 2px 0;
  box-shadow: none;
}

/* Voice mode in the chat (js/voice-turns.js). What the user is saying shows
   as a bubble at once and fills in with the transcript; the reply fades in
   word by word as it is spoken, as in ChatGPT. */
.message.user.voice-utterance.is-transcribing .bubble > div::after {
  content: "\2022\2022\2022";
  color: var(--muted);
  letter-spacing: 3px;
  animation: voice-transcribing 1.2s ease-in-out infinite;
}

@keyframes voice-transcribing {
  0%, 100% { opacity: .35; }
  50% { opacity: 1; }
}

.voice-reply .voice-word {
  animation: voice-word-in .7s ease-out both;
}

@keyframes voice-word-in {
  from { opacity: .2; }
  to { opacity: 1; }
}

/* The question voice mode put to the analyst: the user already said it, so
   it is one quiet line above the analyst's work, not a second bubble. */
.message.voice-ask {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 8px;
  color: var(--muted);
  font-size: var(--text-sm);
  line-height: 1.45;
}

.voice-ask-label { font-weight: 500; }

@media (prefers-reduced-motion: reduce) {
  .message.user.voice-utterance.is-transcribing .bubble > div::after,
  .voice-reply .voice-word { animation: none; }
}

.message .label {
  font-size: var(--text-2xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 8px;
}

.answer-text {
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: normal;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  padding-top: 10px;
  padding-top: 10px;
  padding: 4px 0;
}

.answer-text .katex {
  font-size: 1.02em;
}

.answer-text .katex-display {
  margin: 10px 0 12px;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 2px 0;
}

.sources-toggle {
  display: inline-block;
  margin-top: 12px;
  margin-right: 12px;
  font-size: var(--text-xs);
  letter-spacing: 0.01em;
  cursor: pointer;
  user-select: none;
  border: none;
  background: none;
  padding: 4px 0;
  opacity: 0.92;
  transition: color 0.15s ease, opacity 0.15s ease;
}

.sources-toggle:hover {
  text-decoration: none;
  opacity: 1;
}

.sources-list { display: none; margin-top: 8px; }

.sources-list.open { display: block; }

.message > .sources-list,
.message > .skills-list,
.message > .answer-exports,
.message > .analysis-solution,
.message > .agent-trace {
  display: none !important;
}

.data-source-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
}

/* A row, like the catalogue's: the type icon first so a table and a
   spreadsheet are told apart before the name is read. */
.data-source-card {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 10px 12px;
  text-decoration: none;
  transition: border-color var(--dur) var(--ease-out), background var(--dur) var(--ease-out);
}

/* A row whose text is one line centres against its icon; flex-start left
   the name sitting ~4.5px above the icon's middle, because the icon box is
   24px tall against a 16.9px line. Rows with a description keep flex-start,
   so the icon stays level with the first line rather than the block. */
.data-source-card:has(.data-source-icon):not(:has(.data-source-description)) {
  align-items: center;
}

.data-source-card:has(.data-source-icon):not(:has(.data-source-description)) .data-source-icon {
  margin-top: 0;
}

.data-source-card:hover {
  text-decoration: none;
}

.data-source-icon {
  flex: 0 0 auto;
  width: 20px;
  height: 20px;
  margin-top: 1px;
  color: var(--muted);
}

.data-source-icon svg { width: 18px; height: 18px; }

.data-source-card:hover .data-source-icon { color: var(--accent); }

.data-source-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

/* Not blue: it is a row in a list, and the icon already says it is a
   source you can open. */
.data-source-name {
  display: block;
  font-size: var(--text-sm);
  font-weight: 500;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.data-source-description {
  margin-top: 5px;
  font-size: var(--text-xs);
  line-height: 1.4;
}

.data-source-description:empty {
  display: none;
}

.not-reliable {
  font-size: var(--text-md);
  margin-top: 8px;
}

/* Failed turn: a quiet notice rather than an answer bubble, so it never
   reads as a result the user could rate. */
.answer-error {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 12px 14px;
  border: 1px solid var(--border-soft);
  border-left: 3px solid var(--red);
  border-radius: var(--r-lg);
  background: var(--surface-inset);
}

.answer-error-icon {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  margin-top: 1px;
  stroke: var(--red);
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.answer-error-title {
  font-size: var(--text-md);
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 2px;
}

.answer-error-text {
  font-size: var(--text-md);
  line-height: 1.5;
  color: var(--text);
  overflow-wrap: anywhere;
}

.answer-error-cause {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 6px;
  margin-top: 7px;
  font-size: var(--text-sm);
  line-height: 1.45;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.answer-error-cause span {
  font-weight: 600;
  color: var(--text);
}

.answer-error-cause ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.answer-error-cause li + li {
  margin-top: 3px;
}

.answer-error-tools {
  gap: 6px;
}

.answer-tools-row {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-top: 10px;
  width: 100%;
}

.answer-tools-row.is-entering {
  animation: answerToolsReveal 520ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

.answer-tools-row.is-entering .answer-feedback > *,
.answer-tools-row.is-entering .answer-more {
  animation: answerToolControlReveal 300ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

.answer-tools-row.is-entering .answer-feedback > :nth-child(2) {
  animation-delay: 55ms;
}

.answer-tools-row.is-entering .answer-more {
  animation-delay: 110ms;
}

@media (prefers-reduced-motion: reduce) {
  .answer-tools-row.is-entering,
  .answer-tools-row.is-entering .answer-feedback > *,
  .answer-tools-row.is-entering .answer-more {
      animation: none;
    }
}
.answer-feedback {
  display: flex;
  gap: 6px;
  margin-top: 10px;
  align-items: center;
}

.answer-tools-row .answer-feedback {
  margin-top: 0;
  margin-left: 0;
}

.answer-feedback button,
.answer-retry {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  background: transparent;
  border: 0;
  color: var(--muted);
  border-radius: var(--r-sm);
  padding: 0;
  cursor: pointer;
  transition: color 0.14s ease, background 0.14s ease, transform 0.14s ease;
}

.answer-feedback button:hover,
.answer-retry:hover {
  background: var(--hover-bg);
}

.answer-feedback button svg,
.answer-retry svg {
  width: 17px;
  height: 17px;
  stroke: currentColor;
  stroke-width: 1.9;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.answer-feedback button.active-up {
  background: var(--active-bg);
  color: var(--ink);
}

.answer-feedback button.active-down {
  background: var(--active-bg);
  color: var(--ink);
}

.answer-feedback button.active-up svg,
.answer-feedback button.active-down svg {
  fill: currentColor;
  stroke-width: 1.7;
}

.answer-feedback button:disabled { opacity: 0.5; cursor: wait; }

.message.user .source-token,
.message.user .graph-token {
  background: transparent;
  color: inherit;
}

.answer-text a.citation-link {
  text-decoration: none;
}

.answer-text a.citation-link:hover {
  text-decoration: underline;
}

.answer-text .source-backed-passage.is-source-highlighted {
  border-radius: 3px;
  background: var(--green-border);
  box-shadow: 0 0 0 3px var(--green-border);
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}

.answer-text h1 {
  margin: 1.5em 0 0.34em;
  font-size: 1.35rem;
  line-height: 1.25;
}

.answer-text h2 {
  margin: 1.3em 0 0.3em;
  font-size: 1.15rem;
  line-height: 1.3;
}

.answer-text h3 {
  margin: 1.1em 0 0.26em;
  font-size: 1rem;
  line-height: 1.35;
}

.answer-text h4 {
  margin: 0.9em 0 0.24em;
  font-size: 0.92rem;
  line-height: 1.35;
}

.answer-text h1 + h1,
.answer-text h1 + h2,
.answer-text h1 + h3,
.answer-text h1 + h4,
.answer-text h2 + h1,
.answer-text h2 + h2,
.answer-text h2 + h3,
.answer-text h2 + h4,
.answer-text h3 + h1,
.answer-text h3 + h2,
.answer-text h3 + h3,
.answer-text h3 + h4,
.answer-text h4 + h1,
.answer-text h4 + h2,
.answer-text h4 + h3,
.answer-text h4 + h4 {
  margin-top: 0.58em;
}

.answer-text h1:first-child,
.answer-text h2:first-child,
.answer-text h3:first-child,
.answer-text h4:first-child {
  margin-top: 0;
}

.answer-text p {
  margin: 0 0 0.68em;
  line-height: 1.6;
}

.answer-text p:last-child {
  margin-bottom: 0;
}

.answer-text ul,
.answer-text ol {
  margin: 0.18em 0 0.56em 1.06em;
  padding-left: 0.74em;
  line-height: 1.58;
}

.answer-text li {
  margin: 0;
  padding-left: 0.08em;
  line-height: 1.5;
}

.answer-text li + li {
  margin-top: 0.22em;
}

.answer-text li > p {
  margin: 0;
}

.answer-text li > p + p {
  margin-top: 0.3em;
}

.answer-text li > ul,
.answer-text li > ol {
  margin-top: 0.2em;
  margin-bottom: 0.2em;
}

.answer-text h1 + p,
.answer-text h2 + p,
.answer-text h3 + p,
.answer-text h4 + p,
.answer-text h1 + ul,
.answer-text h2 + ul,
.answer-text h3 + ul,
.answer-text h4 + ul,
.answer-text h1 + ol,
.answer-text h2 + ol,
.answer-text h3 + ol,
.answer-text h4 + ol {
  margin-top: 0.12em;
}

.answer-text > :first-child {
  margin-top: 0 !important;
}

.answer-text > :last-child {
  margin-bottom: 0 !important;
}

.answer-text blockquote {
  margin: 0.55em 0;
  padding: 0.42em 0.8em;
  border-left: 3px solid #475569;
  background: rgba(148, 163, 184, 0.09);
  border-radius: var(--r-xs);
}

.table-copy-wrapper {
  position: relative;
  width: 100%;
  max-width: 100%;
  overflow: visible;
  margin: 0.85em 0 1.05em;
  border: 0;
  border-radius: 0;
}

.table-copy-scroll {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
}

button.table-copy-btn.table-hover-copy-btn {
  position: absolute;
  z-index: 3;
  top: 5px;
  right: 5px;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--r-xs);
  background: rgba(250, 250, 250, .96);
  color: var(--text);
  box-shadow: 0 1px 3px rgba(15, 23, 42, .08);
  opacity: 0;
  pointer-events: none;
  transform: translateY(-2px);
  transition: opacity 120ms ease, transform 120ms ease, background-color 120ms ease, border-color 120ms ease, color 120ms ease;
}

.table-copy-wrapper:hover > button.table-hover-copy-btn,
.table-copy-wrapper:focus-within > button.table-hover-copy-btn,
button.table-hover-copy-btn:focus-visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

button.table-copy-btn.table-hover-copy-btn:hover,
button.table-copy-btn.table-hover-copy-btn:focus-visible,
button.table-copy-btn.table-hover-copy-btn.copied {
  outline: none;
  border-color: var(--border-card-hover);
  background: var(--hover-bg);
  color: var(--ink);
}

.table-copy-icon {
  position: relative;
  display: block;
  width: 14px;
  height: 14px;
}

.table-copy-icon::before,
.table-copy-icon::after {
  content: '';
  position: absolute;
  width: 8px;
  height: 8px;
  border: 1.5px solid currentColor;
  border-radius: 3.5px;
}

.table-copy-icon::before {
  top: 1px;
  left: 4px;
}

.table-copy-icon::after {
  top: 4px;
  left: 1px;
}

button.table-hover-copy-btn.copied .table-copy-icon {
  display: none;
}

button.table-hover-copy-btn.copied::after {
  content: '✓';
  font-size: var(--text-md);
  font-weight: 650;
  line-height: 1;
}

.answer-text table.md-table {
  border-collapse: collapse;
  border-spacing: 0;
  margin: 0;
  font-size: var(--text-md);
  line-height: 1.5;
  width: max-content;
  min-width: 100%;
  border: 0;
  border-radius: 0;
  overflow: visible;
  font-variant-numeric: tabular-nums;
}

.answer-text table.md-table thead,
.answer-text table.md-table tbody,
.answer-text table.md-table tr {
  width: auto;
}

.answer-text table.md-table th,
.answer-text table.md-table td {
  border: 0;
  border-bottom: 1px solid rgba(148, 163, 184, 0.22);
  padding: 12px 20px;
  min-width: 72px;
  max-width: 240px;
  vertical-align: top;
  white-space: normal;
  overflow-wrap: normal;
}

.answer-text table.md-table th:first-child,
.answer-text table.md-table td:first-child {
  padding-left: 0;
}

.answer-text table.md-table th:last-child,
.answer-text table.md-table td:last-child {
  padding-right: 0;
}

.answer-text table.md-table tbody tr:last-child td {
  border-bottom: 0;
}

.answer-text table.md-table thead th {
  border-bottom-color: rgba(148, 163, 184, 0.42);
  font-weight: 650;
  text-align: left;
}

.answer-export-footer {
  margin: 18px 0 4px;
}

.answer-exports {
  display: none;
}

.message-attachment.is-unavailable {
  cursor: not-allowed;
  opacity: .58;
  filter: grayscale(.35);
}

.table-copy-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: none;
  border-radius: var(--r-sm);
  padding: 4px 12px;
  font-size: var(--text-xs);
  font-weight: 600;
  cursor: pointer;
  transition: background .15s;
  white-space: nowrap;
  vertical-align: middle;
}

.table-copy-btn.copied {
  background: var(--green);
}

.answer-feedback button:hover,
.answer-retry:hover {
  color: var(--ink-strong);
}

.data-source-card {
  background: var(--surface);
  border-color: var(--border);
  color: var(--ink);
  box-shadow: 0 1px 2px rgba(15, 23, 42, .04);
}

/* No border: it was a leftover blue from the slate palette and it drew a
   hard edge round every thing you said. White on the flax ground separates
   the bubble on its own, and matches the composer the text came from. */
.message.user .bubble {
  background: var(--surface);
  border-color: transparent;
  color: var(--ink);
}

.data-source-card:hover {
  background: var(--surface-page);
  border-color: var(--border-card-hover);
  box-shadow: 0 2px 7px rgba(15, 23, 42, .06);
}

.data-source-name {
  color: var(--text);
}

.data-source-card:hover .data-source-name {
  color: var(--ink);
}

.data-source-card:focus-visible {
  outline: 2px solid var(--faint);
  outline-offset: 2px;
}

.data-source-description {
  color: var(--muted);
}

.answer-text {
  color: var(--ink);
}

.answer-text {
  font-size: var(--text-lg);
  line-height: 1.65;
  letter-spacing: -0.004em;
}

.answer-text a {
  color: var(--link);
  text-decoration-color: var(--link-underline);
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
  transition: color 0.14s ease, text-decoration-color 0.14s ease;
}

.answer-text a:visited {
  color: var(--link);
}

.answer-text a:hover {
  color: var(--accent-hover);
  text-decoration-color: currentColor;
}

.answer-text strong {
  color: var(--ink);
  font-weight: 650;
}

.answer-text code {
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--text);
  font-family: inherit;
  font-size: 0.94em;
  font-weight: 560;
}

.answer-text pre {
  margin: 0.85em 0;
  padding: 12px 14px;
  overflow-x: auto;
  border: 1px solid var(--border-input);
  border-radius: var(--r-xs);
  background: var(--surface-page);
  color: var(--ink);
  line-height: 1.5;
}

.answer-text pre code {
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: inherit;
  font-size: 0.88em;
}

.answer-text table.md-table {
  background: transparent;
  border-color: transparent;
  color: var(--ink);
  box-shadow: none;
}

.table-copy-wrapper {
  border-color: transparent;
  background: transparent;
  box-shadow: none;
}

.answer-text table.md-table th,
.answer-text table.md-table td {
  border-color: var(--border-soft);
}

.answer-text table.md-table thead th {
  background: transparent;
  border-color: var(--border-card-hover);
  color: var(--ink-strong);
}

.answer-text table.md-table tbody tr:nth-child(even) {
  background: transparent;
}

.table-copy-btn {
  background: var(--green);
  border-color: var(--green);
  color: var(--on-accent);
}

.table-copy-btn:hover {
	      background: var(--green-hover);
	      border-color: var(--green-hover);
	    }

.answer-text a.citation-link {
  color: var(--link);
}

.message.user .label {
  color: var(--blue);
}

.message.assistant .label {
  color: var(--green);
}

.not-reliable {
  color: var(--red);
}

.document-source-title {
  flex: 1 1 auto;
  min-width: 0;
  text-decoration: none;
}

a.document-source-title:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* Keep the document mark attached to the name, not centred between the
   name and its page links. The links form a second row aligned with the
   title, so the row reads as document first and locations second. */
.document-source-card {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  column-gap: 10px;
  row-gap: 3px;
}

.document-source-heading {
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: 20px minmax(0, 1fr);
  align-items: center;
  column-gap: 10px;
  min-width: 0;
}

.document-source-heading .data-source-icon {
  width: 20px;
  height: 20px;
  margin-top: 0;
}

/* The pages sit right under the document's name and read at nearly its
   size. They were set small and prefixed with the word "Strany", which made
   them look like a metadata line about the row rather than what they are:
   the places in the file you can go. The word said nothing that a number
   under a document title does not already say. */
/* Ordinary inline text rather than a flex row: the numbers are separated by
   commas, and a comma has to sit tight against the number before it. A gap
   either side -- which is all a flex row can offer -- makes it read as a
   bullet that happens to be comma-shaped. Inline flow also wraps the list
   the way a sentence wraps, which is what it is. */
.document-source-pages {
  grid-column: 2;
  min-width: 0;
  margin: 0;
  line-height: 1.5;
}

/* Pages as small chips, so they read as things to click. Pointing at one
   lights the passage it supports in the same green the passage takes. The
   comma separators stay in the markup for screen readers only. */
.document-source-sep {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.document-source-page {
  display: inline-block;
  margin: 4px 4px 0 0;
  padding: 0 8px;
  border-radius: var(--r-pill);
  background: var(--active-bg);
  color: var(--text);
  font-size: var(--text-xs);
  font-weight: 500;
  line-height: 20px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  text-decoration: none;
  transition: background var(--dur) var(--ease-out), color var(--dur) var(--ease-out);
}

a.document-source-page:hover,
a.document-source-page:focus-visible {
  background: var(--green-border);
  color: var(--green-deep);
  text-decoration: none;
}

.sources-toggle {
  color: var(--muted);
  font-weight: 400;
}

.sources-toggle:hover {
  color: var(--text);
}

.sources-list.open {
  margin-top: 10px;
  padding: 12px;
  background: var(--surface-inset);
  border: 1px solid var(--border-soft);
  border-radius: var(--r-lg);
  box-shadow: none;
  overflow: hidden;
}

.sources-list.open > .data-source-list:first-child {
  margin-top: 0;
}

/* A paragraph's sources, collapsed into one chip (js/source-chips.js).
   Neutral at rest so a page of them does not turn green; the outlet's own
   icon is the colour. The rest of the sources open on hover or tap. */
.source-chip-group {
  position: relative;
  display: inline-block;
}

.answer-text .source-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 20px;
  margin-left: 4px;
  padding: 0 8px 0 3px;
  border: 0;
  border-radius: var(--r-pill);
  background: var(--active-bg);
  color: var(--muted);
  font: inherit;
  font-size: var(--text-xs);
  font-weight: 500;
  line-height: 20px;
  text-decoration: none;
  white-space: nowrap;
  vertical-align: 1px;
  cursor: pointer;
  transition: background var(--dur), color var(--dur);
}

.answer-text .source-chip:hover,
.answer-text .source-chip:focus-visible,
.source-chip-group.open > .source-chip {
  background: var(--rail-active-bg);
  color: var(--ink);
}

.source-chip-name {
  max-width: 14em;
  overflow: hidden;
  text-overflow: ellipsis;
}

.source-chip-more {
  color: var(--faint);
}

/* The initial is the fallback: the icon sits on top of it and, if it fails
   to load, is removed and the letter shows through. */
.source-chip-mark {
  position: relative;
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  width: 14px;
  height: 14px;
  overflow: hidden;
  border-radius: 50%;
  background: var(--surface);
  color: var(--muted);
  font-size: 9px;
  font-weight: 700;
  line-height: 1;
}

.source-chip-mark img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: var(--surface);
}

.source-chip-list {
  position: absolute;
  top: calc(100% + 6px);
  left: 4px;
  z-index: 30;
  display: none;
  min-width: 200px;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  background: var(--surface);
  box-shadow: var(--shadow-float);
}

/* The gap between chip and list must not close it on the way down. */
.source-chip-list::before {
  content: "";
  position: absolute;
  inset: -8px 0 auto;
  height: 8px;
}

.source-chip-group.open > .source-chip-list {
  display: grid;
}

@media (hover: hover) {
  .source-chip-group:hover > .source-chip-list {
      display: grid;
    }
}
.answer-text .source-chip-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: var(--r-sm);
  color: var(--ink);
  font-size: var(--text-sm);
  font-weight: 450;
  line-height: 1.3;
  text-decoration: none;
  white-space: nowrap;
}

.answer-text .source-chip-item:hover {
  background: var(--hover-bg);
  color: var(--ink);
}

.source-chip-item .source-chip-mark {
  width: 16px;
  height: 16px;
}

.answer-interruption-note {
  color: var(--muted);
  font-size: var(--text-sm);
}

.answer-visualization-note {
  margin: 10px 0 2px;
  padding: 10px 12px;
  border: 1px solid var(--border-soft);
  border-radius: var(--r-md);
  background: var(--surface-inset);
  color: var(--muted);
  font-size: var(--text-sm);
  line-height: 1.5;
}

/* Files shown with the message that carried them. Sits under the bubble so
   the text keeps its own shape, and reads as a caption rather than a second
   message. */
/* One row per file, stacked above the bubble and aligned with it. */
.message-attachments {
  /* Spans the message so the rows have a width to size against; without it
     the column shrink-wraps and their percentage resolves to nothing. */
  align-self: stretch;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  margin-bottom: 8px;
}

.message-attachment {
  display: flex;
  align-items: center;
  gap: 10px;
  width: min(320px, 75%);
  padding: 9px 12px;
  border: 1px solid var(--border-soft);
  border-radius: var(--r-lg, 12px);
  background: var(--surface);
  box-shadow: var(--shadow-card, 0 1px 2px rgba(15, 23, 42, .04));
  color: inherit;
  text-decoration: none;
  transition: background var(--dur), border-color var(--dur), box-shadow var(--dur);
}

/* It opens, so it behaves like something that opens. */
a.message-attachment { cursor: pointer; }

a.message-attachment:hover {
  background: var(--surface-inset);
  border-color: var(--border-card-hover);
  box-shadow: 0 3px 10px rgba(15, 23, 42, .08);
}

a.message-attachment:focus-visible {
  outline: 2px solid var(--green);
  outline-offset: 2px;
}

/* An image shows itself rather than a row about itself. */
.message-attachment.is-image {
  width: auto;
  max-width: min(320px, 75%);
  padding: 0;
  overflow: hidden;
}

.message-attachment-preview {
  display: block;
  width: 100%;
  max-height: 260px;
  object-fit: cover;
}

/* Name over type, the way the composer chip reads. */
.message-attachment-copy {
  display: flex;
  flex-direction: column;
  min-width: 0;
  gap: 1px;
}

.message-attachment-icon {
  flex: 0 0 auto;
  display: inline-grid;
  place-items: center;
  color: var(--muted);
}

.message-attachment-icon svg {
  width: 26px;
  height: 26px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.message-attachment[data-visual-kind="spreadsheet"] .message-attachment-icon { color: var(--green); }

.message-attachment[data-visual-kind="document"] .message-attachment-icon { color: var(--blue); }

.message-attachment[data-visual-kind="presentation"] .message-attachment-icon { color: var(--presentation); }

.message-attachment[data-visual-kind="pdf"] .message-attachment-icon { color: var(--red); }

.message-attachment-name {
  min-width: 0;
  overflow: hidden;
  color: var(--ink);
  font-size: var(--text-sm);
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.message-attachment-type {
  color: var(--faint);
  font-size: var(--text-xs);
}
