.message-bubble, .message-text { min-width: 0; }
.message-rich, .agent-activity-text.message-rich { white-space: normal; min-width: 0; }
.message-rich > :first-child { margin-top: 0; }
.message-rich > :last-child { margin-bottom: 0; }
.message-rich p { margin: .5em 0; }
.message-rich h1, .message-rich h2, .message-rich h3 { font-size: 1.14em; line-height: 1.5; margin: 1em 0 .4em; }
.message-rich ul, .message-rich ol { padding-left: 1.5em; margin: .5em 0; }
.message-rich blockquote { border-left: 3px solid #758aa4; margin: .7em 0; padding-left: 1em; }
.message-rich pre { padding: 12px; border: 1px solid #71809655; border-radius: 8px; overflow: auto; white-space: pre; font-size: 13px; max-width: 100%; }
.message-rich code { font-family: ui-monospace, monospace; }
.message-rich :not(pre) > code { padding: .1em .3em; border-radius: 4px; background: #71809622; }
.message-rich a { color: #5499dc; text-decoration: underline; }
.message-table { overflow-x: auto; max-width: 100%; margin: .8em 0; }
.message-table table { border-collapse: collapse; font-size: 14px; width: 100%; }
.message-table th, .message-table td { border-bottom: 1px solid #71809655; padding: 8px 12px; text-align: left; vertical-align: top; min-width: 90px; max-width: 32em; overflow-wrap: anywhere; }
.message-table th { background: #71809618; font-weight: 600; white-space: nowrap; }
.message-table [align="center"] { text-align: center; }
.message-table [align="right"] { text-align: right; font-variant-numeric: tabular-nums; }
.message-diagram { border: 1px solid #71809655; border-radius: 12px; margin: 14px 0; overflow: hidden; }
.diagram-status { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 12px; font-size: 13px; }
.diagram-view { background: #f8fafc; padding: 16px; overflow: auto; max-height: 560px; text-align: center; }
.diagram-view:empty { display: none; }
.diagram-view svg { display: block; max-width: 100%; height: auto; margin: auto; }
/* Isolate diagrams from the application-wide outline icon defaults. */
.diagram-view > svg { stroke: none; stroke-width: 1; }
.diagram-view text { stroke: none; }
.diagram-expand, .diagram-dialog button { font: inherit; color: inherit; background: transparent; border: 1px solid #71809670; border-radius: 6px; padding: 4px 10px; cursor: pointer; }
.diagram-code { padding: 8px 12px; font-size: 13px; }
.diagram-code summary { cursor: pointer; }
.diagram-code pre { max-height: 320px; }
.diagram-dialog { width: min(1200px, 94vw); max-width: 96vw; max-height: 92vh; border: 1px solid #718096; border-radius: 12px; padding: 14px; background: #f8fafc; color: #172b42; }
.diagram-dialog::backdrop { background: #071323b3; }
.diagram-dialog button { margin: 0 10px 10px 0; }
.diagram-dialog .diagram-view { max-height: 75vh; }
.diagram-natural svg { max-width: none; }
@media (max-width: 600px) { .diagram-view { padding: 8px; } .diagram-status { flex-wrap: wrap; } }
