/* User bubble: right-aligned column (bubble + IconActions). Figma
   User_Bubble/message_container 659:38813 — r22 fill, actions gap 6 below. */

.userRow {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}

.userStack {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  min-width: 0;
  /* The figma 525px cap held as a share of the width axis (525/748 ≈ 0.702):
     resolves to the original 525px on the default column and widens with a
     dragged or adaptive column. The 748px fallback covers mounts outside the
     conversation column, where the axis variable is absent. */
  max-width: min(calc(var(--dsh-chat-content-width, 748px) * 0.702), 82%);
}
.bubble {
  /* Figma's 525px cap held as a share of the width axis (525/748 ≈ 0.702) so
     the bubble widens with a user-dragged or adaptive column; percentage
     keeps narrow windows sane. */
  max-width: 100%;
  background: var(--dsw-specific-bubble);
  border-radius: 22px;
  /* 42px single-line bubble at the default size: 22 line + 10 vertical
     padding each side; the Settings font-size preference moves size and line
     height together through the body-published axis. */
  padding: 10px 16px;
  font-size: var(--dsh-content-font-size, 14px);
  line-height: calc(22px + var(--dsh-content-font-delta, 0px));
  color: var(--dsw-alias-label-primary);
  /* The projected user text is inline runs; the bubble owns wrapping so a
     decorated single-line message stays one line. */
  white-space: pre-wrap;
  word-break: break-word;
}

.referenceSummary {
  color: var(--dsw-alias-label-tertiary);
  font-size: var(--dsh-content-font-size-secondary, 13px);
  line-height: calc(18px + var(--dsh-content-font-delta-secondary, 0px));
}
.contextRow {
  padding: 2px 0;
}

/* Compaction marker: one dim 24px row with a context icon at rest and a
   hover/focus disclosure for the summary body. Dimmed title (not
   label-primary) — the row is a boundary notice, not conversation content. */
.compactionRow {
  padding: 2px 0;
}

.compactionButton {
  display: flex;
  align-items: center;
  width: 100%;
  height: calc(24px + var(--dsh-content-font-delta, 0px));
  min-width: 0;
  padding: 0;
  border: none;
  border-radius: 6px;
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
}

.compactionButton:not(:disabled) {
  cursor: pointer;
}

.compactionButton:not(:disabled):hover {
  background: var(--dsw-alias-interactive-bg-hover);
}

.compactionLeading {
  flex: none;
  display: inline-grid;
  place-items: center;
  width: calc(16px + var(--dsh-content-font-delta, 0px));
  height: calc(16px + var(--dsh-content-font-delta, 0px));
  margin-right: 6px;
  color: var(--dsw-alias-label-secondary);
}

/* Same glyph-scaling rule as DisclosureRow's leading: the CSS edge overrides
   the svg attributes so the 14px glyphs follow the font-size delta. */
.compactionLeading svg {
  width: calc(14px + var(--dsh-content-font-delta, 0px));
  height: calc(14px + var(--dsh-content-font-delta, 0px));
}

.compactionContextIcon,
.compactionDisclosureIcon {
  display: inline-flex;
  grid-area: 1 / 1;
  align-items: center;
  justify-content: center;
}

.compactionDisclosureIcon {
  opacity: 0;
}

.compactionButton:not(:disabled):hover .compactionContextIcon,
.compactionButton:not(:disabled):focus-visible .compactionContextIcon {
  opacity: 0;
}

.compactionButton:not(:disabled):hover .compactionDisclosureIcon,
.compactionButton:not(:disabled):focus-visible .compactionDisclosureIcon {
  opacity: 1;
}

.compactionTitle {
  flex: none;
  font-size: var(--dsh-content-font-size-secondary, 13px);
  line-height: calc(24px + var(--dsh-content-font-delta, 0px));
  color: var(--dsw-alias-label-primary-dimmed);
}

.compactionSep {
  flex: none;
  width: 2px;
  height: 2px;
  margin: 0 8px;
  border-radius: 1px;
  background: var(--dsw-alias-label-caption);
}

.compactionSummary {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  color: var(--dsw-alias-label-tertiary);
  font-size: var(--dsh-content-font-size-secondary, 13px);
  line-height: calc(24px + var(--dsh-content-font-delta, 0px));
  text-overflow: ellipsis;
  white-space: nowrap;
}

.compactionBody {
  /* Indent under the title, which starts at leading (16 + delta) + gap 6. */
  padding: 4px 0 4px calc(22px + var(--dsh-content-font-delta, 0px));
  color: var(--dsw-alias-label-tertiary);
  font-size: var(--dsh-content-font-size-secondary, 13px);
  line-height: calc(24px + var(--dsh-content-font-delta, 0px));
}

.retryRow {
  color: var(--dsw-alias-label-tertiary);
  font-size: var(--dsh-content-font-size-secondary, 13px);
  line-height: calc(20px + var(--dsh-content-font-delta-secondary, 0px));
}

.retrySummary {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  padding: 2px 0;
  gap: 7px;
  border-radius: 3px;
  color: inherit;
  cursor: pointer;
  list-style: none;
  user-select: none;
}

.retrySummary::-webkit-details-marker {
  display: none;
}

.retrySummary::after {
  width: 6px;
  height: 6px;
  border-right: 1.5px solid currentcolor;
  border-bottom: 1.5px solid currentcolor;
  content: '';
  opacity: 0.8;
  transform: rotate(-45deg);
  transition: transform 120ms ease;
}

.retrySummary:hover {
  color: var(--dsw-alias-label-secondary);
}

.retrySummary:focus-visible {
  outline: 1.5px solid var(--dsw-alias-button-info-fill);
  outline-offset: 2px;
}

.retryText {
  color: inherit;
}

.retryRow[data-active] .retryText {
  background:
    linear-gradient(
      90deg,
      var(--dsw-alias-label-tertiary) 0%,
      var(--dsw-alias-label-tertiary) 40%,
      var(--dsw-alias-label-secondary) 50%,
      var(--dsw-alias-label-tertiary) 60%,
      var(--dsw-alias-label-tertiary) 100%
    );
  background-position: 100% 50%;
  background-size: 200% 100%;
  background-clip: text;
  color: transparent;
  animation: retry-shimmer 1.6s ease-in-out infinite;
}

.retryRow[open] .retrySummary::after {
  transform: rotate(45deg);
}

.retryDetails {
  display: grid;
  gap: 2px;
  margin-top: 3px;
  padding-left: 14px;
  overflow-wrap: anywhere;
  font-size: var(--dsh-content-font-size-secondary, 13px);
  line-height: calc(18px + var(--dsh-content-font-delta-secondary, 0px));
}

.retryDetailLabel {
  color: var(--dsw-alias-label-secondary);
}

.turnErrorRow {
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: start;
  padding: 2px 0;
  font-size: var(--dsh-content-font-size-secondary, 13px);
  line-height: calc(20px + var(--dsh-content-font-delta-secondary, 0px));
}

.turnErrorDot {
  margin-top: 5px;
}

.turnErrorCopy {
  min-width: 0;
  overflow-wrap: anywhere;
}

.turnErrorTitle {
  margin-right: 6px;
  color: var(--dsw-alias-state-error-primary);
  font-weight: 600;
}

.turnErrorMessage {
  color: var(--dsw-alias-label-secondary);
}

.turnErrorCode {
  color: var(--dsw-alias-label-tertiary);
  font: var(--dsw-font-markdown-code-block-small);
}

.maxTokensTitle {
  margin-right: 6px;
  color: var(--dsw-alias-state-warn-primary);
  font-weight: 600;
}

@keyframes retry-shimmer {
  from {
    background-position: 100% 50%;
  }

  to {
    background-position: 0 50%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .retryRow[data-active] .retryText {
    background: none;
    color: inherit;
    animation: none;
  }
}
