body {
  padding-bottom: 3.25rem;
}

.app-main {
  padding-bottom: 0.35rem !important;
}

.app-footer {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1030;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 2.5rem;
  padding: 0.4rem 1rem;
  background: rgba(248, 249, 250, 0.96);
  border-top: 1px solid rgba(0, 0, 0, 0.08);
  color: #6c757d;
  font-size: 0.875rem;
  backdrop-filter: blur(2px);
}

.backup-actions {
  gap: 0.75rem;
}

#chatClearButton {
  min-width: 11rem;
}

@media (max-width: 575.98px) {
  .backup-actions {
    gap: 0.75rem;
  }

  #chatClearButton {
    min-width: 9.5rem;
  }
}

.timeline-day-separator {
  position: sticky;
  top: 0;
  z-index: 1;
  margin: 0.5rem auto;
  padding: 0.25rem 0.75rem;
  width: fit-content;
  border-radius: 999px;
  background: #e9ecef;
  color: #495057;
  font-size: 0.8125rem;
  font-weight: 600;
}

.message-row {
  display: flex;
  margin-bottom: 0.4rem;
}

.message-row-incoming,
.message-row-system {
  justify-content: flex-start;
}

.message-bubble {
  max-width: min(100%, 44rem);
  border-radius: 0.9rem;
  padding: 0.5rem 0.75rem;
  border: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.04);
}

.message-bubble-incoming {
  background: #ffffff;
}

.message-bubble.participant-style-0 {
  background: var(--participant-bg, #dcecff);
  border-color: var(--participant-border, #97c2ff);
  border-left: 4px solid var(--participant-accent, #2f7de1);
}

.message-bubble.participant-style-1 {
  background: var(--participant-bg, #dcecff);
  border-color: var(--participant-border, #97c2ff);
  border-left: 4px solid var(--participant-accent, #2f7de1);
}

.message-bubble.participant-style-2 {
  background: var(--participant-bg, #dcecff);
  border-color: var(--participant-border, #97c2ff);
  border-left: 4px solid var(--participant-accent, #2f7de1);
}

.message-bubble.participant-style-3 {
  background: var(--participant-bg, #dcecff);
  border-color: var(--participant-border, #97c2ff);
  border-left: 4px solid var(--participant-accent, #2f7de1);
}

.message-bubble.participant-style-4 {
  background: var(--participant-bg, #dcecff);
  border-color: var(--participant-border, #97c2ff);
  border-left: 4px solid var(--participant-accent, #2f7de1);
}

.message-bubble.participant-style-5 {
  background: var(--participant-bg, #dcecff);
  border-color: var(--participant-border, #97c2ff);
  border-left: 4px solid var(--participant-accent, #2f7de1);
}

.message-bubble-system {
  background: #f8f9fa;
  border-style: dashed;
}

.message-author {
  margin: 0;
  font-size: 0.8rem;
  font-weight: 600;
  color: #0d6efd;
}

.message-bubble[class*="participant-style-"] .message-author {
  color: var(--participant-accent, #2f7de1);
}

.message-text {
  margin: 0.15rem 0 0;
  white-space: pre-wrap;
  word-break: break-word;
}

.message-meta {
  margin-top: 0.25rem;
  font-size: 0.73rem;
  color: #6c757d;
  text-align: right;
}

.message-bubble-media-compact {
  width: fit-content;
  max-width: min(100%, 17rem);
}

.message-bubble-media-compact .message-text {
  margin-bottom: 0.3rem;
}

.message-link,
.attachment-open-link {
  color: #0d6efd;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.message-link:focus-visible,
.attachment-open-link:focus-visible {
  outline: 2px solid #0d6efd;
  outline-offset: 1px;
}

.attachment-block {
  margin-top: 0.45rem;
  display: grid;
  gap: 0.35rem;
}

.attachment-preview {
  max-width: 100%;
  border-radius: 0.6rem;
  border: 1px solid rgba(0, 0, 0, 0.12);
  background: #fff;
}

.attachment-preview-image,
.attachment-preview-video {
  width: min(100%, 15.5rem);
  max-height: 8.2rem;
  object-fit: contain;
}

.attachment-preview-pdf {
  width: min(100%, 30rem);
  min-height: 17rem;
}

.attachment-preview-audio {
  width: min(100%, 24rem);
}

.attachment-fallback {
  padding: 0.5rem 0.65rem;
  border: 1px dashed rgba(0, 0, 0, 0.2);
  border-radius: 0.55rem;
  background: #f8f9fa;
}

.attachment-file-name,
.attachment-hint {
  margin: 0;
}

#timelineContainer.timeline-virtualized-container {
  max-height: clamp(22rem, calc(100vh - 17.5rem), 68rem);
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  overflow-anchor: none;
}

.timeline-virtual-spacer {
  width: 100%;
  pointer-events: none;
}

.attachment-file-name {
  font-size: 0.82rem;
  font-weight: 600;
}

.attachment-hint {
  margin-top: 0.15rem;
  margin-bottom: 0.25rem;
  font-size: 0.78rem;
  color: #6c757d;
}

@media (max-width: 576px) {
  #timelineContainer {
    gap: 0.4rem !important;
  }

  .message-bubble {
    max-width: 100%;
    padding: 0.45rem 0.65rem;
  }

  .message-meta {
    font-size: 0.69rem;
  }
}
