.message-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0rem;
  width: 100%;
  min-height: 0;
  flex: 1 1 auto;
  position: relative;
}

.message-layout--with-timeline {
  grid-template-columns: minmax(0, 1fr) 64px;
}

.message-layout--with-timeline::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  right: 64px;
  width: 1px;
  background-color: var(--border-muted);
  pointer-events: none;
}

@media (max-width: 720px) {
  .message-layout--with-timeline {
    grid-template-columns: minmax(0, 1fr) 40px;
  }

  .message-layout--with-timeline::after {
    right: 40px;
  }
}

.message-stream-shell {
  min-height: 0;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
 }


 .message-stream-shell .message-stream {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
 }
 
 .message-timeline-sidebar {
  width: 64px;
  min-height: 0;
  display: flex;
  flex-direction: column;
 }


@media (max-width: 720px) {
  .message-timeline-sidebar {
    width: 40px;
  }
}

.message-timeline {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 0.25rem;
  overflow-y: auto;
  border-radius: 8px;
  background-color: var(--surface-base);
  box-shadow: var(--panel-shadow, 0 6px 24px rgba(0, 0, 0, 0.2));
}

.message-timeline::-webkit-scrollbar {
  width: 5px;
}

.message-timeline::-webkit-scrollbar-thumb {
  background-color: var(--border-muted);
  border-radius: 9999px;
}

.message-timeline-segment {
  width: 100%;
  min-height: 1.5rem;
  border-radius: 0;
  border: 1px solid var(--border-base);
  background-color: var(--surface-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-primary);
  transition: transform 0.15s ease, background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.message-timeline-segment.message-timeline-segment-hidden {
  display: none !important;
}

.message-timeline-segment-active {
  border-color: transparent;
  background-color: #0f5b44;
  color: #fff;
  font-weight: 700;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.35);
}

.message-timeline-segment:hover,
.message-timeline-segment:focus-visible {
  background-color: var(--surface-hover);
  color: var(--accent-primary);
  outline: none;
  transform: translateY(-1px);
}

.message-timeline-segment-active,
.message-timeline-segment-active:hover,
.message-timeline-segment-active:focus-visible {
  background-color: #0f5b44;
  color: #fff;
  transform: none;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.35);
}

.message-timeline-segment:focus-visible {
  box-shadow: 0 0 0 2px var(--surface-base), 0 0 0 4px var(--accent-primary);
}

.message-timeline-user {
  border-color: var(--message-user-border);
  background-color: var(--message-user-bg);
}

.message-timeline-assistant {
  border-color: var(--message-assistant-border);
  background-color: var(--message-assistant-bg);
}

.message-timeline-tool {
  border-color: var(--message-tool-border);
  background-color: var(--surface-secondary);
}

.message-timeline-segment-active {
  background-color: #0f5b44 !important;
  border-color: transparent !important;
  color: #fff !important;
  font-weight: 700;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.35);
}

.message-timeline-label {
  pointer-events: none;
}

.message-timeline-label-short {
  display: none;
  line-height: 1;
  align-items: center;
  justify-content: center;
}

.message-timeline-icon {
  width: 1rem;
  height: 1rem;
}

@media (max-width: 720px) {
  .message-timeline-label-full {
    display: none;
  }
  .message-timeline-label-short {
    display: inline-flex;
  }
}

.message-timeline-tooltip {
  position: fixed;
  z-index: 1000;
  pointer-events: none;
}

.message-preview {
  width: 360px;
  max-height: 420px;
  overflow: auto;
  border-radius: 8px;
  border: 1px solid var(--border-base);
  background-color: var(--surface-base);
  box-shadow: var(--panel-shadow, 0 12px 32px rgba(0, 0, 0, 0.25));
  padding: 0.75rem;
}

.message-preview .message-item-base {
  font-size: 0.85rem;
}
