.rich-content {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
  color: #111827;
}

.rich-content.compact {
  gap: 10px;
}

.rich-content.muted {
  color: #475569;
}

.rich-paragraph,
.rich-heading {
  display: block;
  min-width: 0;
  color: inherit;
  font-size: 28px;
  font-weight: 520;
  line-height: 1.62;
  word-break: break-word;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.rich-content.compact .rich-paragraph {
  font-size: 24px;
  line-height: 1.55;
}

.rich-content.muted .rich-paragraph {
  color: #64748b;
}

.rich-heading {
  color: #0f172a;
  font-size: 32px;
  font-weight: 820;
  line-height: 1.35;
}

.rich-heading.level-2 {
  font-size: 30px;
}

.rich-heading.level-3,
.rich-heading.level-4 {
  font-size: 28px;
}

.rich-bold {
  color: #0f172a;
  font-weight: 820;
}

.rich-code-inline {
  display: inline-flex;
  max-width: 100%;
  padding: 0 8px;
  border: 1px solid #dbe3ee;
  border-radius: 6px;
  background: #f8fafc;
  color: #334155;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 23px;
  line-height: 1.35;
  word-break: break-all;
}

.rich-formula-inline {
  display: inline-flex;
  max-width: 100%;
  margin: 0 4px;
  padding: 0 8px;
  border-radius: 6px;
  background: #f8fafc;
  color: #0f172a;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 24px;
  line-height: 1.45;
  word-break: break-all;
}

.rich-formula-rendered {
  display: inline-flex;
  max-width: 100%;
  margin: 0 4px;
  overflow-x: auto;
  vertical-align: middle;
}

.rich-formula-inline.display {
  display: flex;
}

.rich-formula-rendered.display {
  display: flex;
  margin: 10px 0;
}

.rich-formula-block,
.rich-code-block {
  min-width: 0;
  padding: 18px;
  border: 1px solid #dbe3ee;
  border-radius: 8px;
  background: #f8fafc;
  color: #0f172a;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 24px;
  line-height: 1.55;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

.rich-formula-block.rendered {
  font-family: inherit;
  white-space: normal;
}

.rich-formula-block .katex-display {
  margin: 0;
  overflow-x: auto;
  overflow-y: hidden;
}

.rich-formula-block .katex,
.rich-formula-rendered .katex {
  max-width: 100%;
  font-size: 1.08em;
}

.rich-code-language {
  display: block;
  margin-bottom: 10px;
  color: #64748b;
  font-size: 20px;
  font-weight: 800;
  text-transform: uppercase;
}

.rich-code-text {
  display: block;
  color: inherit;
  font-size: inherit;
  line-height: inherit;
}

.rich-image-wrap {
  width: 100%;
  min-width: 0;
  overflow: hidden;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #fff;
}

.rich-image {
  display: block;
  width: 100%;
  max-height: 640px;
  background: #f8fafc;
}

.rich-image-caption {
  display: block;
  padding: 10px 14px 14px;
  color: #64748b;
  font-size: 20px;
  line-height: 1.4;
}

.rich-blocked-image {
  padding: 16px;
  border: 1px dashed #fca5a5;
  border-radius: 8px;
  background: #fff1f2;
  color: #be123c;
  font-size: 22px;
  line-height: 1.4;
  word-break: break-word;
}

.rich-image-pending {
  padding: 18px;
  border: 1px dashed #bfdbfe;
  border-radius: 8px;
  background: #eff6ff;
  color: #1d4ed8;
  font-size: 22px;
  line-height: 1.45;
}

.rich-table {
  display: block;
  width: 100%;
  overflow-x: auto;
  border: 1px solid #dbe3ee;
  border-radius: 8px;
  background: #fff;
}

.rich-table-row {
  display: flex;
  min-width: 680px;
  border-top: 1px solid #e2e8f0;
}

.rich-table-row:first-child {
  border-top: 0;
}

.rich-table-row.header {
  background: #f8fafc;
}

.rich-table-cell {
  flex: 1;
  min-width: 160px;
  padding: 14px 16px;
  border-left: 1px solid #e2e8f0;
  color: #334155;
  font-size: 22px;
  line-height: 1.45;
  word-break: break-word;
}

.rich-table-cell:first-child {
  border-left: 0;
}

.rich-table-row.header .rich-table-cell {
  color: #0f172a;
  font-weight: 820;
}

.rich-table-cell.center {
  text-align: center;
}

.rich-table-cell.right {
  text-align: right;
}

.rich-empty {
  color: #94a3b8;
  font-size: 22px;
  line-height: 1.45;
}
