.rich-response {
  color: var(--text-primary);
  overflow-wrap: anywhere;
  word-break: break-word;
}

.rich-response h1,
.rich-response h2,
.rich-response h3,
.rich-response h4,
.rich-response h5,
.rich-response h6,
.message-body .rich-heading {
  margin: 20px 0 8px;
  font-family: var(--font-voice);
  font-weight: 500;
  letter-spacing: -.01em;
  line-height: 1.25;
}

.rich-response h1 { font-size: 28px; }
.rich-response h2 { font-size: 23px; }
.rich-response h3 { font-size: 19px; }
.rich-response h4,
.rich-response h5,
.rich-response h6 { font-size: 16px; }

.rich-response p + p { margin-top: 14px; }

.rich-response ul,
.rich-response ol {
  margin: 12px 0;
  padding-left: 22px;
}

.rich-response li + li { margin-top: 4px; }

.rich-response blockquote {
  margin: 12px 0;
  padding: 4px 0 4px 14px;
  border-left: 2px solid var(--border-subtle, #e6e4df);
  color: var(--text-secondary, #5c5a57);
}

.rich-response hr {
  margin: 18px 0;
  border: 0;
  border-top: 1px solid var(--border-subtle, #e6e4df);
}

.rich-response a {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.rich-code {
  margin: 14px 0;
  overflow: auto;
  border: 1px solid var(--border-subtle, #e6e4df);
  border-radius: 12px;
  background: var(--surface-2, #f3f2ee);
  max-width: 100%;
}

.rich-code-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border-subtle, #e6e4df);
  font-size: 12px;
  color: var(--text-secondary, #5c5a57);
}

.rich-code pre {
  margin: 0;
  padding: 12px;
  overflow: auto;
  max-height: 360px;
}

.rich-code code,
.rich-response code {
  font-family: var(--font-mono);
  font-size: .84em;
}

.rich-response :not(pre) > code {
  padding: 1px 4px;
  border-radius: var(--radius-xs, 4px);
  background: var(--surface-2, #f3f2ee);
}

.rich-table-wrap {
  overflow: auto;
  max-width: 100%;
  margin: 14px 0;
}

.rich-table {
  width: 100%;
  min-width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.rich-table th,
.rich-table td {
  padding: 9px 12px;
  min-width: 6rem;
  max-width: 36rem;
  overflow-wrap: anywhere;
  border: 0;
  border-bottom: 1px solid var(--border-subtle, #e6e4df);
  text-align: left;
  vertical-align: top;
}

.rich-table th {
  background: var(--surface-2, #f3f2ee);
  font-weight: 600;
}

.rich-citation {
  font-size: 11px;
  color: var(--text-secondary, #5c5a57);
}

.rich-truncated {
  margin: 8px 10px;
  color: var(--text-secondary, #5c5a57);
  font-size: 12px;
}

.rich-task-list {
  list-style: none;
  padding-left: 4px;
}

.rich-task-list input {
  margin-right: 8px;
}

@media (prefers-reduced-motion: reduce) {
  .rich-response .stream-caret { animation: none; }
}
