/* Main container */
.tolky__chat-container,
.chat-container {
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.tolky__chat-container *,
.chat-container * {
  --bg-system: rgba(187, 166, 242, 0.15);
  --color-system: #002b3e;

  --bg-user: #6f8af6;
  --color-user: #fff;

  --bg-table-header: rgba(111, 138, 246, 0.2);
  --border-table: rgba(111, 138, 246, 0.4);

  box-sizing: border-box;
  padding: 0;
  margin: 0;
  font-family: inherit;
}

.tolky__chat-container h1,
.tolky__chat-container h2,
.tolky__chat-container h3,
.tolky__chat-container h4,
.tolky__chat-container h5,
.tolky__chat-container h6,
.chat-container h1,
.chat-container h2,
.chat-container h3,
.chat-container h4,
.chat-container h5,
.chat-container h6 {
  font-weight: 500;
  line-height: 110%;
}

.tolky__chat-container strong,
.tolky__chat-container b,
.chat-container strong,
.chat-container b {
  font-weight: 500;
}

.tolky__chat-container em,
.tolky__chat-container .tolky__message em,
.chat-container em,
.chat-container .message em {
  font-style: italic;
}

.tolky__chat-container .tolky__message .date-separator,
.chat-container .date-separator {
  background-color: #cfd8fc;
  padding: 3px 10px 3px 10px;
  border-radius: 40px;
  font-size: 11px;
  align-self: center;
  font-weight: 400;
  color: #163e63;
}

.tolky__chat-container hr,
.chat-container hr {
  border: 0;
  border-bottom: 1px solid;
  border-color: #cccccc;
  margin-top: 10px;
  margin-bottom: 14px;
}

.tolky__chat-container blockquote,
.chat-container blockquote {
  border-left: 4px solid #6f8af6; /* Adiciona uma borda colorida à esquerda */

  padding: 10px 14px 5px 14px; /* Define o preenchimento interno */

  color: #333; /* Define a cor do texto */
  font-style: italic; /* Define o estilo do texto como itálico */
}

/* Message - container */
.tolky__chat-container .tolky__message,
.chat-container .message {
  align-self: start;
  max-width: 93%;
  border-radius: 12px;
  padding: 11px 14px 8px;
  background-color: white;
  color: var(--color-system);
  font-size: 14px;
  line-height: 16.8px;
  word-wrap: break-word;
  display: flex;
  flex-direction: column;
  border: 1px solid #f7fafc; /* gray.50 */
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}

/* Assistant and manager text color */
.chat-container .message.assistant,
.chat-container .message.admin {
  color: #2d3748;
}

/* Ensure same color in tolky namespace container */
.tolky__chat-container .tolky__message.assistant,
.tolky__chat-container .tolky__message.admin {
  color: #2d3748;
}

/* Assistant-specific border color */
.tolky__chat-container .tolky__message.assistant,
.chat-container .message.assistant {
  border-color: #e6eaec;
}

/* Message - user container */
.tolky__chat-container .tolky__message.tolky__user,
.chat-container .message.user {
  align-self: end;
  background-color: #e2e7ff;
  color: #1a4051;
  border: 1px solid #c4cefe;
  box-shadow: 0 2px 3px rgba(0, 0, 0, 0.08);
}

/* Message - markdown tags */
.tolky__chat-container .tolky__message img,
.chat-container .message img {
  width: 100%;
  max-width: 600px;
  border-radius: 12px;
  margin: 0;
}

.tolky__chat-container .tolky__message video,
.chat-container .message video {
  width: 100%;
  max-width: 600px;
  border-radius: 6px;
  margin: 0;
}

/* Video player styled like audio player */
.custom-video-player {
  display: grid;
  grid-template-rows: auto auto;
  gap: 8px;
  padding: 0 0 10px 0; /* remove top, left, and right padding, keep only bottom */
  border-radius: 6px;
  background: #e2e7ff;
}
.message.user .custom-video-player {
  background: #ffffff;
}
.message.assistant .custom-video-player {
  background: #e2e7ff;
}

.custom-video-player .video-controls {
  display: grid;
  grid-template-columns: 32px 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 0 10px;
}

.custom-video-player .play-button {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #506ffd;
  color: white;
  cursor: pointer;
}
.custom-video-player .play-button.playing {
  background: #3857ff;
}

.custom-video-player .video-progress {
  height: 10px;
  width: 100%;
  display: grid;
  align-items: center;
}
.custom-video-player .video-progress-bar {
  background: rgba(80, 111, 253, 0.35);
  height: 4px;
  width: 100%;
  border-radius: 4px;
  overflow: hidden;
}
.custom-video-player .video-progress-fill {
  background: #506ffd;
  height: 100%;
}

.custom-video-player .time-display {
  font-size: 12px;
  font-weight: 400;
  color: #2d3748;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
}

.tolky__chat-container .tolky__message a,
.tolky__chat-container .tolky__message.tolky__user a.tolky-link,
.chat-container .message.user a.tolky-link {
  background-color: rgba(255, 255, 255, 0.3);
}

/* Checkbox color in task lists for user messages */
.tolky__chat-container .tolky__message.tolky__user input[type="checkbox"],
.chat-container .message.user input[type="checkbox"] {
  accent-color: #718096;
}

/* Remove qualquer espaçamento do último parágrafo em mensagens */
.tolky__chat-container .tolky__message p:last-child,
.chat-container .message p:last-child,
.chat-container .message .markdown-body p:last-child,
.tolky__chat-container .tolky__message .markdown-body p:last-child {
  margin-bottom: 0 !important;
  padding-bottom: 0 !important;
}

/* Message time */
.tolky__chat-container .tolky__message .tolky__time,
.chat-container .message .time {
  display: block;
  color: inherit;
  font-size: 10px;
  line-height: 12px;
  opacity: 0.5;
  text-align: right;
}

.chat-container .message.admin {
  --bg: #cfd8fc;
  border-color: #e6eaec;
  padding-right: 25px;
  position: relative;
  background: white;
  border-radius: 12px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}

.chat-container .message.admin .user {
  z-index: 5;

  width: 24px;
  height: 24px;

  display: flex;
  align-items: center;
  justify-content: center;

  position: absolute;
  top: 50%;
  right: 0;
  translate: 50% -50%;

  background: var(--bg);

  border-radius: 50%;
  border: none;
  cursor: pointer;
}

.chat-container .message.admin .user:has(.tooltip) {
  z-index: 6;
}

.chat-container .message.admin .tooltip {
  --bg: #ffffff;

  min-width: 118px;

  display: grid;
  grid-template-rows: auto 2px 1fr;
  justify-items: center;

  position: absolute;
  top: calc(100% + 4px);
}

.chat-container .message.admin .tooltip.right-aligned {
  right: 0px;
  justify-items: end;
}

.chat-container .message.admin .tooltip.at-top {
  top: revert;
  bottom: calc(100% + 4px);
}

.chat-container .message.admin .tooltip.stretch {
  min-width: revert;

  justify-items: end;

  left: var(--left, 0);
  right: var(--right, 0);
}

.chat-container .message.admin .tooltip__arrow {
  grid-row: 1 / 3;
  grid-column: 1;

  color: #ffffff;
}

/* Add border to tooltip arrow matching assistant border color */
.chat-container .message.admin .tooltip__arrow path {
  stroke: #e6eaec;
  stroke-width: 1;
}

.chat-container .message.admin .tooltip.right-aligned .tooltip__arrow,
.chat-container .message.admin .tooltip.stretch .tooltip__arrow {
  margin-right: var(--arrow-margin-right, 0);
}

.chat-container .message.admin .tooltip.at-top .tooltip__arrow {
  rotate: 180deg;

  grid-row: 2 / -1;
  grid-column: 1;
}

.chat-container .message.admin .tooltip.at-top .tooltip__content::before {
  top: unset;
  bottom: -1px; /* handle inverted arrow case */
}

.chat-container .message.admin .tooltip__content {
  grid-row: 2 / -1;
  grid-column: 1;

  padding: 6px 10px;

  border-radius: 4px;

  text-align: center;

  color: #2d3748;
  background: #ffffff;
  border: 1px solid #e6eaec;

  font-size: 14px;
  line-height: 16px;
  position: relative;
  z-index: 1;
  margin-top: -1px; /* overlap arrow bottom stroke */
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}

/* Tooltip label and name styles */
.chat-container .message.admin .tooltip__content .tooltip__label {
  display: block;
  text-transform: uppercase;
  font-size: 11px;
  line-height: 13px;
  font-weight: 500;
  color: #66808b;
}

.chat-container .message.admin .tooltip__content .tooltip__name {
  display: block;
  margin-top: 2px;
  font-size: 13px;
  line-height: 15px;
  color: #2d3748;
}

/* Hide the arrow bottom stroke with a small white cover strip */
.chat-container .message.admin .tooltip__content::before {
  content: "";
  position: absolute;
  top: -1px; /* sits right over the arrow base */
  left: 50%;
  transform: translateX(-50%);
  width: 14px; /* slightly wider than arrow base */
  height: 2px;
  background: #ffffff;
  pointer-events: none;
}

.chat-container .message.admin .tooltip.at-top .tooltip__content {
  grid-row: 1 / 3;
  grid-column: 1;
}

.chat-container .ticket-status {
  --color: #ecc94b;

  display: grid;
  column-gap: 10px;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
}

.chat-container .ticket-status > hr {
  all: unset;

  height: 1px;

  display: block;

  background: var(--color);
}

.chat-container .ticket-status .content {
  min-height: 19px;

  padding: 2px 10px;

  border-radius: 2px;

  background: var(--color);

  display: flex;
  align-items: center;
  justify-content: center;
}

.chat-container .ticket-status .content > span {
  text-align: center;

  color: white;

  font-size: 12px;
  font-weight: 500;

  line-height: 14.4px;
}

.chat-container .ticket {
  align-self: start;
  max-width: 93%;
  border-radius: 12px;
  padding: 11px 14px 8px;
  background-color: white;
  color: #2d3748;
  font-size: 14px;
  line-height: 16.8px;
  word-wrap: break-word;
  display: flex;
  flex-direction: column;
  border: 1px solid #e6eaec;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
  margin-top: 8px;
}

.chat-container .ticket .on-top {
  display: flex;
  column-gap: 4px;
  align-items: center;
  margin-bottom: 8px;
  background-color: #506ffd;
  color: white;
  height: 24px;
  border-radius: 20px;
  margin: -24px -6px 4px 0px;
  padding: 0 12px;
  width: fit-content;
  font-size: 12px;
}

.chat-container .ticket .on-top > span {
  color: white;
  font-size: 11px;
  font-weight: 500;
  line-height: 14.4px;
  gap: 14px;
}

.chat-container .ticket .on-top > span > b {
  font-weight: 700;
}

.chat-container .ticket .on-top .icon {
  flex-shrink: 0;
  color: white;
  margin-top: -1px;
}

.chat-container .ticket .on-top .icon svg {
  color: white;
  fill: white;
}

.chat-container .ticket .on-top .icon svg path {
  stroke: white;
  fill: white;
}

.chat-container .ticket .on-top .sent-by {
  display: flex;
  column-gap: 4px;
  align-items: center;
  margin-right: auto;
  color: white;

  font-weight: 400;
}

/* Protocol text next to the ticket icon */
.chat-container .ticket .on-top .sent-by .protocol {
  color: white;
  font-size: 12px;
}

.chat-container .ticket .on-top .sending-method {
  display: flex;
  column-gap: 4px;
  align-items: center;
  margin-left: auto;
  color: white;
}

.chat-container .ticket .sending-method .icon {
  cursor: pointer;
}

.chat-container .ticket .content {
  font-size: 14px;
  margin-top: 4px;
}

.chat-container .ticket .content > .scrollable-area {
  overflow-x: auto;
  overflow-y: hidden;
}

.chat-container .ticket .content > .scrollable-area > iframe {
  display: block;
  width: 100%;
}

.chat-container .ticket .content.with-score {
  padding-top: 5px;
}

.chat-container .ticket .content.with-score .title {
  color: #002b3e;
  font-size: 12px;
  font-weight: 500;
  line-height: 12px;
}

.chat-container .ticket .content.with-score .score {
  font-size: 18px;
  font-weight: 500;
  line-height: 21.6px;
}

.chat-container .ticket .content.with-score .feedback {
  margin-top: 2px;

  font-size: 14px;
  font-weight: 400;
  line-height: 16.8px;
}

/* StatusBar styles for tickets */
.chat-container .ticket .tolky__status-bar {
  display: flex !important;
  align-items: center !important;
  justify-content: flex-end !important;
  width: 100% !important;
  gap: 2px !important;
  margin-top: 4px !important;
}

.chat-container .ticket .tolky__status-icon {
  min-width: 14px !important;
  height: 14px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
}

.chat-container .ticket .tolky__status-failed {
  color: #f56565 !important;
  font-size: 10px !important;
  position: relative !important;
  font-weight: 500 !important;
}

/* Ensure StatusBar appears at the bottom of ticket content */
.chat-container .ticket .content + .tolky__status-bar {
  margin-top: 8px !important;
}

/* CreationTime styles for tickets */
.chat-container .ticket .tolky__time,
.chat-container .ticket .time {
  display: block !important;
  color: inherit !important;
  font-size: 10px !important;
  line-height: 12px !important;
  opacity: 0.5 !important;
  text-align: right !important;
  margin: 0 !important;
  padding: 0 !important;
}

/* Ensure StatusBar is visible in tickets */
.chat-container .ticket .tolky__status-bar {
  visibility: visible !important;
  opacity: 1 !important;
  display: flex !important;
}

/* StatusIcons specific styles for tickets */
.chat-container .ticket .tolky__status-icon svg {
  width: 14px !important;
  height: 14px !important;
  display: block !important;
}

/* Apply message styles to both messages and tickets */
.chat-container .message a,
.chat-container .ticket a {
  color: #506ffd;
  text-decoration: underline;
}

.chat-container .message a.tolky-link,
.chat-container .ticket a.tolky-link {
  background-color: #506ffd;
  color: #ffffff;
  padding: 1px 8px 2px;
  border-radius: 10px;
  text-decoration: none;
  transition: all 200ms ease-out;
}

.chat-container .message a.tolky-link:hover,
.chat-container .ticket a.tolky-link:hover {
  background-color: #2f4193;
  text-decoration: none;
}

.chat-container .message a:hover,
.chat-container .ticket a:hover {
  color: #2f4193;
  text-decoration: underline;
}

/* Lists in messages and tickets */
.chat-container .message ul,
.chat-container .message ol,
.chat-container .ticket ul,
.chat-container .ticket ol {
  width: 100%;
  padding: 10px 0 10px 20px;
}

/* Force ordered-list numbering to show */
.chat-container .message ol,
.chat-container .ticket ol,
.chat-container .markdown-body ol {
  list-style: decimal !important;
  list-style-position: outside;
}

.chat-container .message ol > li,
.chat-container .ticket ol > li,
.chat-container .markdown-body ol > li {
  display: list-item;
}

.chat-container .message ul,
.chat-container .ticket ul {
  list-style: unset;
}

.chat-container .message li,
.chat-container .ticket li {
  opacity: 1;
  line-height: 120%;
  margin-bottom: 5px;
}

.chat-container .message ul li::marker,
.chat-container .message ol li::marker,
.chat-container .ticket ul li::marker,
.chat-container .ticket ol li::marker {
  color: #a0aec0;
}

/* Checkbox color in task lists */
.chat-container .message input[type="checkbox"],
.chat-container .ticket input[type="checkbox"] {
  accent-color: #718096;
}

/* Tables in messages and tickets */
.chat-container .message table,
.chat-container .ticket table {
  border-collapse: separate;
  border-spacing: 0;
  margin: 12px 0 10px 0px;
  border-radius: 6px;
  overflow: hidden;
}

.chat-container .message table strong,
.chat-container .message table th,
.chat-container .ticket table strong,
.chat-container .ticket table th {
  font-weight: 500;
  color: #4d6a78;
  vertical-align: middle;
}

.chat-container .message table th,
.chat-container .ticket table th {
  background-color: var(--bg-table-header);
  color: var(--color-system);
}

.chat-container .message th:first-child,
.chat-container .ticket th:first-child {
  border-top-left-radius: 6px;
}

.chat-container .message th:last-child,
.chat-container .ticket th:last-child {
  border-top-right-radius: 6px;
}

.chat-container .message tr:last-child td:first-child,
.chat-container .ticket tr:last-child td:first-child {
  border-bottom-left-radius: 6px;
}

.chat-container .message tr:last-child td:last-child,
.chat-container .ticket tr:last-child td:last-child {
  border-bottom-right-radius: 6px;
}

.chat-container .message td,
.chat-container .message th,
.chat-container .ticket td,
.chat-container .ticket th {
  border: 1px solid var(--border-table);
  border-bottom: 0;
  border-right: 0;
  line-height: 120%;
  vertical-align: top;
  padding: 6px 10px;
  background-color: white;
}

.chat-container .message tr th:last-child,
.chat-container .message tr td:last-child,
.chat-container .ticket tr th:last-child,
.chat-container .ticket tr td:last-child {
  border-right: 1px solid var(--border-table);
}

.chat-container .message tr:last-child td,
.chat-container .ticket tr:last-child td {
  border-bottom: 1px solid var(--border-table);
}

.chat-container .message thead,
.chat-container .ticket thead {
  overflow: hidden;
}

/* Code blocks in messages and tickets */
.chat-container .message code,
.chat-container .ticket code {
  font-size: 13px;
  border-radius: 12px;
  margin: 12px 0 16px;
  display: block;
  white-space: wrap;
  word-break: break-all;
}

/* Paragraphs in messages and tickets */
.chat-container .message p,
.chat-container .ticket p {
  line-height: 120%;
  padding-bottom: 0;
  margin-bottom: 8px;
  width: 100%;
}

.chat-container .message p:last-child,
.chat-container .ticket p:last-child {
  margin-bottom: 0;
  padding-bottom: 0;
}

/* Spans in messages and tickets */
.chat-container .message span,
.chat-container .ticket span {
  width: 100%;
  padding-bottom: 0px;
}

.chat-container .message span br,
.chat-container .ticket span br {
  display: none;
}

.message.audio {
  width: 100%;
  min-width: 300px;

  color: var(--color-system);
  padding-top: 14px;
}

.message audio {
  width: 100%;
  border-radius: 100px;
  border: 1px solid rgba(0, 0, 0, 0.1);
  background-color: #9fb1f9;
}

.audio-player {
  width: 100%;
}

.audio-player.user {
  align-self: flex-end;
}

.audio-player.assistant {
  align-self: flex-start;
}

.audio-player .audio-container {
  display: flex;
  flex-direction: column;
  width: 100%;
}

.audio-player .transcription-toggle {
  cursor: pointer;
  user-select: none;
  color: #66808b; /* match tooltip label */
  border: none;
  background: none;
  cursor: pointer;
  margin-top: 5px;
  margin-bottom: -12px;
  display: flex;
  align-items: center;
  font-size: 11px; /* match tooltip label */
  margin-top: 10px;
  font-weight: 500; /* match tooltip label */
  text-transform: uppercase; /* match tooltip label */
  line-height: 13px; /* match tooltip label */
  z-index: 1;
}

.audio-player .transcription {
  border-radius: 8px;
  font-size: 13px;
  line-height: 120%;
  transition: all-height 0.3s ease;
  margin-top: 4px;
  opacity: 0.8;
  padding-top: 12px;
  margin-bottom: -12px;
}

/* WhatsApp-like custom audio player */
.audio-player .custom-audio-player {
  display: grid;
  grid-template-columns: 32px 1fr auto;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  border-radius: 6px;
  background: #e2e7ff; /* unified background */
}

.audio-player.user .custom-audio-player {
  background: #ffffff;
}

.audio-player.assistant .custom-audio-player {
  background: #e2e7ff;
}

.audio-player .custom-audio-player .play-button {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #506ffd;
  color: white;
  cursor: pointer;
}

.audio-player .custom-audio-player .play-button.playing {
  background: #3857ff;
}

.audio-player .custom-audio-player .waveform-container {
  height: 34px;
  display: flex;
  align-items: center;
  gap: 2px;
  width: 100%;
}

.audio-player .custom-audio-player .waveform-bar {
  width: 2px;
  background: rgba(255, 255, 255, 0.4);
  border-radius: 2px;
}

.audio-player.assistant .custom-audio-player .waveform-bar {
  background: rgba(80, 111, 253, 0.35);
}

/* User waveform base color */
.audio-player.user .custom-audio-player .waveform-bar {
  background: #c4cefe;
}

.audio-player .custom-audio-player .waveform-bar.active {
  background: #506ffd; /* progress color as requested */
}

.audio-player .custom-audio-player .time-display {
  font-size: 12px;
  font-weight: 400;
  color: #2d3748;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
}

/* same color for all roles */

/* Document styles */
.tolky__chat-container .tolky__message.video,
.chat-container .message.video {
  padding-top: 14px;
}
.chat-container .message.document {
  padding-bottom: 8px;
}

.chat-container .document-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
  background-color: rgba(111, 138, 246, 0.15);
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 4px;
  border: 1px solid rgba(111, 138, 246, 0.5);
  background-color: rgba(255, 255, 255, 1);
  width: fit-content;
}

.chat-container .document-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.chat-container .document-info svg {
  flex-shrink: 0;
  color: #6f8af6;
}

.chat-container .document-name {
  font-weight: 500;
  word-break: break-word;
  line-height: 120%;
}

.chat-container .message .document-download-button {
  border: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-decoration: none;
  padding: 4px 12px;
  border-radius: 9999px; /* pill */
  font-size: 14px;
  font-weight: 500;
  align-self: flex-start;
  transition: background-color 0.2s ease, transform 0.05s ease;
  height: 28px;
  min-height: 28px;
  background: #506ffd;
  color: #ffffff;
}

.chat-container .message .document-download-button:hover {
  background-color: #2f4193;
  color: #ffffff;
  text-decoration: none;
}

.chat-container .message .document-download-button:active {
  transform: translateY(1px);
}

/* Message info icon styling */
.message-info-container {
  position: absolute;
  left: -28px;
  top: 50%;
  transform: translateY(-50%);
  opacity: 0;
  transition: opacity 0.2s ease;
  z-index: 1;
}

.chat-container .document-download-button svg {
  color: white;
}

.message.user {
  position: relative;
}

.message.user:hover .message-info-container {
  opacity: 1;
}

.message-info-icon {
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #2f4193;
  opacity: 0.5;
  transition: all 300ms ease-out;
}

.message-info-icon:hover {
  opacity: 1;
}

/* Popover styling */
.message-info-popover {
  position: absolute;
  top: 0;
  right: 30px;
  width: 580px;
  background-color: white;
  border-radius: 8px;
  z-index: 99999;
  overflow: hidden;
  border: 1px solid #cfd8fc;
}

.message-info-popover-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 15px;
  border-bottom: 1px solid #e6eaec;
  align-items: center;
}

.message-info-popover-header h4 {
  margin: 0;
  font-size: 14px;
  font-weight: 500;
  color: #1a4051;
}

.message-info-popover-header button {
  background: none;
  border: none;
  font-size: 18px;
  cursor: pointer;
  color: #6a737d;
}

.message-info-popover-content {
  padding: 10px 15px;
  max-height: 300px;
}

.chat-container .message-info-item {
  margin-bottom: 6px;
  font-size: 12px;
  line-height: 1.4;
  flex-direction: column;
  display: flex;
  text-transform: uppercase;
}

.message-info-key {
  font-weight: 500;
  color: #1a4051;
  margin-right: 5px;
}

.message-info-value {
  color: #6a737d;
  word-break: break-word;
}

.chat-container .image-caption {
  font-size: 14px;
  line-height: 120%;
  padding-bottom: 8px;
  margin-top: 8px;
}

/* Video caption spacing */
.chat-container .video-caption {
  font-size: 14px;
  line-height: 120%;
  padding-bottom: 0px; /* gap abaixo da legenda */
  margin-top: 8px; /* gap acima da legenda em relação ao vídeo */
}

/* Make sure images are responsive */
.chat-container .message.image img {
  border-radius: 8px;
}

/* Make user document download button match assistant style */
.chat-container .message.document.user .document-download-button {
  background: #506ffd;
  color: #ffffff;
  border: none;
}

.chat-container .message.document.user .document-download-button svg {
  color: #ffffff;
}

.chat-container .message.document.user .document-download-button:hover {
  background-color: #2f4193;
  color: #ffffff;
}

.chat-container .document-actions {
  display: inline-flex; /* buttons group sizes by its own content */
  flex-direction: row;
  flex-wrap: wrap;
  gap: 10px;
  width: auto; /* caption width will not stretch this area */
  max-width: 100%;
  align-self: flex-start; /* keep aligned to the left of the container */
}

/* Caption under document actions */
.chat-container .document-caption {
  margin-top: 4px;
  font-size: 14px;
  line-height: 1.5;
  color: #2d3748;
}

.chat-container .document-summary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;

  background-color: #ffffff;
  color: #506ffd;
  border: 1px solid #506ffd;
  text-decoration: none;
  padding: 4px 8px;

  border-radius: 9999px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.2s ease, transform 0.05s ease;
  height: 28px;
}

.chat-container .document-summary-button:hover {
  background-color: #ffffff; /* keep white on hover */
  color: #2f4193; /* change blue tone on hover */
  border-color: #2f4193;
  text-decoration: none;
}

.chat-container .document-summary-button:active {
  transform: translateY(1px);
}

.chat-container .document-description {
  margin-top: 0px;
  padding: 10px;
  background-color: rgba(111, 138, 246, 0.05);
  border-left: 3px solid #506ffd;

  font-size: 13px;
  line-height: 1.5;
  white-space: pre-line;
  overflow-wrap: break-word;
  max-height: 300px;
  overflow-y: auto;
}

/* Make user document summary button match assistant style */
.chat-container .message.document.user .document-summary-button {
  background-color: #ffffff;
  color: #506ffd;
  border: 1px solid #506ffd;
}

.chat-container .message.document.user .document-summary-button:hover {
  background-color: #ffffff;
  color: #2f4193;
  border-color: #2f4193;
}

.chat-container .message.document.user .document-description {
  border-left-color: #506ffd;
}

.chat-container .message.document.assistant .document-summary-button {
  color: #506ffd;
}

.chat-container .message.document.assistant .document-summary-button span {
  margin-top: -2px;
}

.chat-container .message.document.assistant .document-summary-button:hover {
  color: #2f4193;
}

/* Markdown styles for document description */
.chat-container .markdown-body {
  line-height: 1.6;
}

.chat-container .markdown-body h1,
.chat-container .markdown-body h2,
.chat-container .markdown-body h3,
.chat-container .markdown-body h4,
.chat-container .markdown-body h5,
.chat-container .markdown-body h6 {
  margin-top: 16px;
  margin-bottom: 8px;
  font-weight: 600;
  line-height: 1.25;
}

.chat-container .markdown-body h1 {
  font-size: 1.5em;
}

.chat-container .markdown-body h2 {
  font-size: 1.3em;
}

.chat-container .markdown-body h3 {
  font-size: 1.2em;
}

.chat-container .markdown-body p,
.chat-container .markdown-body blockquote,
.chat-container .markdown-body ul,
.chat-container .markdown-body ol,
.chat-container .markdown-body dl,
.chat-container .markdown-body table,
.chat-container .markdown-body pre {
  margin-top: 0;
  margin-bottom: 0px;
  padding-bottom: 0;
}

.chat-container .markdown-body ul,
.chat-container .markdown-body ol {
  padding-left: 20px;
}

.chat-container .markdown-body li {
  margin-bottom: 4px;
}

.chat-container .markdown-body a {
  color: #6f8af6;
  text-decoration: none;
}

.chat-container .markdown-body a:hover {
  text-decoration: underline;
}

.chat-container .markdown-body blockquote {
  padding: 0 1em;
  color: #6a737d;
  border-left: 3px solid #dfe2e5;
}

.chat-container .markdown-body table {
  border-spacing: 0;
  border-collapse: collapse;
  display: block;
  width: 100%;
  overflow: auto;
}

.chat-container .markdown-body table th,
.chat-container .markdown-body table td {
  padding: 6px 13px;
  border: 1px solid #dfe2e5;
}

.chat-container .markdown-body table tr {
  background-color: #fff;
  border-top: 1px solid #c6cbd1;
}

.chat-container .markdown-body table tr:nth-child(2n) {
  background-color: #f6f8fa;
}

.chat-container .markdown-body code {
  padding: 0.2em 0.4em;
  margin: 0;
  font-size: 85%;
  background-color: rgba(27, 31, 35, 0.05);
  border-radius: 3px;
}

.chat-container .markdown-body pre {
  word-wrap: normal;
  padding: 16px;
  overflow: auto;
  font-size: 85%;
  line-height: 1.45;
  background-color: #f6f8fa;
  border-radius: 3px;
}

.chat-container .markdown-body pre code {
  display: inline;
  padding: 0;
  margin: 0;
  border: 0;
  overflow: visible;
  line-height: inherit;
  word-wrap: normal;
  background-color: transparent;
}

/* Estilos ajustados para o markdown no resumo do documento */
.chat-container .document-description.markdown-body {
  line-height: 1.4; /* Reduzido de 1.6 */
}

.chat-container .markdown-body p,
.chat-container .markdown-body blockquote,
.chat-container .markdown-body ul,
.chat-container .markdown-body ol,
.chat-container .markdown-body dl,
.chat-container .markdown-body table,
.chat-container .markdown-body pre {
  margin-top: 0;
  margin-bottom: 8px; /* Reduzido de 12px ou outro valor que possa estar causando o problema */
}

.chat-container .markdown-body h1,
.chat-container .markdown-body h2,
.chat-container .markdown-body h3,
.chat-container .markdown-body h4,
.chat-container .markdown-body h5,
.chat-container .markdown-body h6 {
  margin-top: 12px; /* Reduzido de 16px */
  margin-bottom: 6px; /* Reduzido de 8px */
}

/* Remove espaços extras entre parágrafos */
.chat-container .markdown-body p + p {
  margin-top: -4px;
}

/* ... end of document styles */

.chat-container .message .reply-preview {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 6px 8px;
  margin-bottom: 6px;
  font-size: 12px;
  line-height: 1.3;
  border-left: 3px solid #506ffd;
  background-color: rgba(80, 111, 253, 0.06);
  cursor: pointer;
}

.chat-container .message.user .reply-preview {
  background-color: rgba(80, 111, 253, 0.12);
  border-left-color: #506ffd;
}

.chat-container .message.assistant .reply-preview {
  background-color: #f3f4f6;
  border-left-color: #cbd5e0;
}

.chat-container .message .reply-preview-label {
  text-transform: uppercase;
  font-size: 10px;
  font-weight: 500;
  color: #718096;
}

.chat-container .message .reply-preview-text {
  color: #2d3748;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Message actions (three dots) */
.chat-container .message .message-header {
  position: relative;
  padding-right: 22px; /* espaço para não cobrir o texto */
}

.chat-container .message .message-menu-container {
  position: absolute;
  top: 0;
  right: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.chat-container .message .message-menu-trigger {
  all: unset;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  color: #a0aec0;
}

.chat-container .message .message-menu-trigger:hover {
  color: #4a5568;
}

.chat-container .message .message-menu {
  position: absolute;
  top: 22px;
  right: 0;
  background: #ffffff;
  border-radius: 6px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.12);
  border: 1px solid #e2e8f0;
  z-index: 10;
  padding: 4px 0;
  min-width: 150px;
}

.chat-container .message .message-menu-item {
  all: unset;
  display: block;
  width: 100%;
  padding: 6px 12px;
  font-size: 13px;
  color: #2d3748;
  cursor: pointer;
}

.chat-container .message .message-menu-item:hover {
  background-color: #f7fafc;
}

.tolky__status-bar {
  display: flex;
  align-items: center;
  justify-content: end;
  width: 100%;
  gap: 2px;
}

.tolky__status-icon {
  min-width: 14px;
  height: 14px;
}

.tolky__status-failed {
  color: #f56565;
  font-size: 10px;
  position: relative;
}

.tolky__status-failed[title]:hover::after {
  content: attr(title);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  background-color: #2d3748;
  color: white;
  padding: 6px 8px;
  border-radius: 4px;
  font-size: 12px;
  white-space: nowrap;
  z-index: 1000;
  margin-bottom: 5px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.tolky__status-failed[title]:hover::before {
  content: "";
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 4px solid transparent;
  border-top-color: #2d3748;
  margin-bottom: 1px;
  z-index: 1000;
}

/* Remove espaçamento do último parágrafo em mensagens - regra mais específica */
.tolky__chat-container .tolky__message p:last-of-type,
.chat-container .message p:last-of-type,
.tolky__chat-container .tolky__message > div p:last-of-type,
.chat-container .message > div p:last-of-type,
.tolky__chat-container .tolky__message p:last-child,
.chat-container .message p:last-child {
  margin-bottom: 0 !important;
  padding-bottom: 0 !important;
}

/* Regra adicional para garantir que funcione com ReactMarkdown */
.tolky__chat-container .tolky__message *:last-child p:last-of-type,
.chat-container .message *:last-child p:last-of-type {
  margin-bottom: 0 !important;
  padding-bottom: 0 !important;
}

