/* ==========================================================================
   Claude Message Renderer
   ========================================================================== */

.claude-message {
    margin-bottom: 1rem;
    border-radius: 8px;
    overflow: hidden;
    background: var(--bg-darker);
    border: 1px solid var(--border);
}

.claude-message .message-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 1rem;
    background: rgba(0, 0, 0, 0.2);
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
}

/* Copy button in message headers */
.copy-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1px solid transparent;
    color: var(--text-muted);
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    cursor: pointer;
    transition: color 0.15s, background 0.15s, border-color 0.15s;
    line-height: 0;
}

.copy-button:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.06);
    border-color: var(--border);
}

.copy-button.copied {
    color: var(--success);
    font-size: 0.85rem;
    line-height: 1;
}

/* Copy button sits inline next to the message badge in all headers,
   left-justified. On assistant headers the usage-badge has its own
   margin-left:auto and naturally pushes itself to the right. */

/* Live-updating "X minutes ago" label */
.time-ago {
    color: var(--text-muted);
    font-size: 0.65rem;
    cursor: help;
    white-space: nowrap;
    opacity: 0.6;
}

.claude-message .message-body {
    padding: 0.5rem 1rem;
}

.claude-message .grouped-message-body {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.grouped-message-part {
    min-width: 0;
}

/* Footer row for unobtrusive metadata (e.g. time-ago) */
.claude-message .message-footer {
    display: flex;
    justify-content: flex-end;
    padding: 0.15rem 1rem 0.35rem;
    line-height: 1;
}

/* Message Type Badges */
.message-type-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.6rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.message-type-badge.system {
    background: rgba(122, 162, 247, 0.2);
    color: var(--accent);
}

.message-type-badge.assistant {
    background: rgba(158, 206, 106, 0.2);
    color: var(--success);
}

.message-type-badge.result {
    background: rgba(158, 206, 106, 0.2);
    color: var(--success);
}

.message-type-badge.result.error {
    background: rgba(247, 118, 142, 0.2);
    color: var(--error);
}

.message-type-badge.user {
    background: rgba(122, 162, 247, 0.2);
    color: var(--accent);
}

.message-type-badge.portal {
    background: rgba(125, 207, 255, 0.2);
    color: #7dcfff;
}

.portal-message {
    border-left: 3px solid #7dcfff;
}

/* Group wrapper for consecutive portal messages (PR 2/4 of #758). Mirrors
   the assistant-group treatment: one outer wrapper around N child message
   blocks so a chatty stretch reads as one visual unit. The inner
   `.portal-message` children drop their own outer border to avoid double
   bordering; the teal accent lives on the wrapper. */
.portal-group {
    border-left: 3px solid #7dcfff;
    background: rgba(125, 207, 255, 0.04);
}

.portal-group-body {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    padding: 0.25rem 0;
}

.portal-group-body .portal-message {
    border-left: none;
    background: transparent;
    margin: 0;
}

.portal-group-body .portal-message .message-header {
    padding-top: 0.25rem;
    padding-bottom: 0.25rem;
}

.user-group {
    border-left: 3px solid #e0af68;
    background: rgba(224, 175, 104, 0.04);
}

.user-group-body {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    padding: 0.25rem 0;
}

.user-group-body .user-message {
    border-left: none;
    background: transparent;
    margin: 0;
}

.user-group-body .user-message .message-header {
    padding-top: 0.25rem;
    padding-bottom: 0.25rem;
}

.codex-group {
    border-left: 3px solid #bb9af7;
    background: rgba(187, 154, 247, 0.04);
}

.codex-group-body {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    padding: 0.25rem 0;
}

.codex-group-body .claude-message {
    border-left: none;
    background: transparent;
    margin: 0;
}

.codex-group-body .claude-message .message-header {
    padding-top: 0.25rem;
    padding-bottom: 0.25rem;
}

/* ----- Codex item lifecycle ---------------------------------------------
 * `.codex-item` is the base class on every per-item card; renderers add
 * `.codex-item-in-progress` for `item.started` / `item.updated` events
 * before `item.completed` lands. Live in-flight items pulse a small dot
 * before the tool/message header and dim the text slightly so the user
 * can tell at a glance which cards are still executing. After completion
 * (dedup in `render_codex_group` replaces the in-flight card with the
 * `item.completed` one), the styling disappears.
 * ----------------------------------------------------------------------- */

@keyframes codex-item-pulse {
    0%, 100% { opacity: 0.45; }
    50% { opacity: 1.0; }
}

.codex-item-in-progress .tool-use-header,
.codex-item-in-progress .message-header {
    position: relative;
}

.codex-item-in-progress .tool-use-header::before,
.codex-item-in-progress .message-header::before {
    content: "\25CF"; /* filled bullet */
    color: #e0af68; /* tokyo-night orange — matches portal "in-flight" cues */
    margin-right: 0.5rem;
    animation: codex-item-pulse 1.5s ease-in-out infinite;
    font-size: 0.7em;
    vertical-align: middle;
}

.codex-item-in-progress .tool-name,
.codex-item-in-progress .assistant-text,
.codex-item-in-progress .thinking-content {
    opacity: 0.82;
}

.codex-item-in-progress .tool-meta {
    color: #e0af68;
    font-style: italic;
}

/* Honour reduced-motion: skip the pulse, keep the dot static. */
@media (prefers-reduced-motion: reduce) {
    .codex-item-in-progress .tool-use-header::before,
    .codex-item-in-progress .message-header::before {
        animation: none;
        opacity: 0.85;
    }
}

.message-type-badge.raw {
    background: rgba(127, 132, 156, 0.2);
    color: var(--text-secondary);
}

/* Message count badge for grouped assistant messages */
.message-count {
    display: inline-flex;
    align-items: center;
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
    background: rgba(158, 206, 106, 0.3);
    color: var(--success);
    margin-left: 0.25rem;
}

/* Condensed run of `thinking_tokens` markers — a single compact chip with a
   `× N` pulse-count odometer, in place of one empty "THINKING_TOKENS" badge
   per marker. Purple to read as "reasoning", distinct from the blue system
   badge. */
.message-type-badge.thinking {
    background: rgba(187, 154, 247, 0.18);
    color: #bb9af7;
}

.thinking-pulse-group {
    padding: 0.2rem 0;
    opacity: 0.85;
}

.thinking-pulse-group .message-count {
    background: rgba(187, 154, 247, 0.22);
    color: #bb9af7;
}

/* Odometer digits: tabular figures so the width doesn't jitter as it rolls. */
.count-up {
    font-variant-numeric: tabular-nums;
    font-feature-settings: "tnum";
}

.init-badge {
    font-size: 0.7rem;
    font-weight: 500;
    padding: 0.1rem 0.4rem;
    background: rgba(127, 132, 156, 0.2);
    color: var(--text-secondary);
    border-radius: 3px;
}

.init-badge.fast {
    background: rgba(224, 175, 104, 0.2);
    color: #e0af68;
}

/* System Message - Init */
.system-message .message-subtype {
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.init-info {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.init-main {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.init-row {
    display: flex;
    align-items: baseline;
    gap: 0.75rem;
}

.init-label {
    color: var(--text-secondary);
    font-size: 0.85rem;
    min-width: 80px;
}

.init-value {
    color: var(--text-primary);
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
}

.init-value.model {
    color: var(--accent);
    font-weight: 500;
}

.init-value.path {
    color: var(--success);
    word-break: break-all;
}

.init-details {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    padding-top: 0.5rem;
    border-top: 1px solid var(--border);
}

.detail-group {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.35rem 0.6rem;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 4px;
    cursor: help;
    transition: background 0.2s;
}

.detail-group:hover {
    background: rgba(122, 162, 247, 0.15);
}

.detail-count {
    font-weight: 600;
    color: var(--accent);
    font-size: 0.9rem;
}

.detail-label {
    color: var(--text-secondary);
    font-size: 0.8rem;
}

/* Assistant Message */
.assistant-message .model-name {
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-style: italic;
    cursor: help;
}

.truncated-badge {
    color: #e0af68;
    font-size: 0.7rem;
    font-weight: 500;
    padding: 0.1rem 0.4rem;
    background: rgba(224, 175, 104, 0.15);
    border-radius: 3px;
    cursor: help;
}

.assistant-message .usage-badge {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    margin-left: auto;
    padding: 0.2rem 0.5rem;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 4px;
    cursor: help;
}

.usage-badge .token-count {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.85rem;
}

.usage-badge .token-label {
    color: var(--text-secondary);
    font-size: 0.75rem;
}

.assistant-text {
    color: var(--text-primary);
    line-height: 1.6;
    white-space: pre-wrap;
    word-wrap: break-word;
}

/* Clickable links in messages */
.message-link {
    color: var(--link-color);
    text-decoration: underline;
    text-decoration-style: dotted;
    text-underline-offset: 2px;
    transition: all 0.15s ease;
}

.message-link:hover {
    color: var(--accent-hover);
    text-decoration-style: solid;
}

.message-link:visited {
    color: var(--link-visited);
}

/* Bold text in messages */
.message-bold {
    font-weight: 600;
    color: var(--text-primary);
}

/* ==========================================================================
   Anthropic API Error Message
   ========================================================================== */

.anthropic-error-message {
    background: rgba(247, 118, 142, 0.08);
    border: 1px solid rgba(247, 118, 142, 0.3);
}

.anthropic-error-message .message-header {
    background: rgba(247, 118, 142, 0.15);
    border-bottom-color: rgba(247, 118, 142, 0.3);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.message-type-badge.anthropic-error {
    background: rgba(247, 118, 142, 0.25);
    color: var(--error);
}

.anthropic-error-message .http-status {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    padding: 0.15rem 0.5rem;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 4px;
}

.anthropic-error-content {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
}

.anthropic-error-content .error-icon {
    font-size: 2rem;
    line-height: 1;
    color: var(--error);
    flex-shrink: 0;
}

.anthropic-error-content .error-details {
    flex: 1;
}

.anthropic-error-content .error-type-display {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--error);
    margin-bottom: 0.25rem;
}

.anthropic-error-content .error-message-text {
    color: var(--text-primary);
    font-size: 0.95rem;
    line-height: 1.5;
}

.anthropic-error-message .error-request-id {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid rgba(247, 118, 142, 0.2);
    font-size: 0.8rem;
}

.anthropic-error-message .request-id-label {
    color: var(--text-secondary);
}

.anthropic-error-message .request-id-value {
    font-family: var(--font-mono);
    color: var(--text-muted);
    font-size: 0.75rem;
    background: rgba(0, 0, 0, 0.2);
    padding: 0.15rem 0.4rem;
    border-radius: 3px;
}

/* ==========================================================================
   Codex-specific Renderers
   ========================================================================== */

.file-changes-list {
    padding: 0.5rem 0;
}

.file-change-entry {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.2rem 0.5rem;
    font-family: var(--font-mono);
    font-size: 0.8rem;
}

.file-change-kind {
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.1rem 0.4rem;
    border-radius: 3px;
    text-transform: uppercase;
    min-width: 4em;
    text-align: center;
}

.file-change-kind.add {
    color: #9ece6a;
    background: rgba(158, 206, 106, 0.15);
}

.file-change-kind.delete {
    color: #f7768e;
    background: rgba(247, 118, 142, 0.15);
}

.file-change-kind.update {
    color: #7aa2f7;
    background: rgba(122, 162, 247, 0.15);
}

.file-change-path {
    color: var(--text-primary);
}

.codex-todo-list {
    padding: 0.5rem 0;
}

.codex-todo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.2rem 0.5rem;
    font-size: 0.85rem;
}

.codex-todo.done .codex-todo-text {
    text-decoration: line-through;
    color: var(--text-secondary);
}

.codex-todo-marker {
    font-size: 1rem;
    flex-shrink: 0;
}

/* ==========================================================================
   Portal features reminder (collapsed-by-default block)
   ========================================================================== */

.portal-reminder {
    margin: 0.35rem 0;
    border: 1px solid rgba(125, 207, 255, 0.3);
    border-radius: 6px;
    background: rgba(125, 207, 255, 0.05);
    overflow: hidden;
}

.portal-reminder-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    background: transparent;
    border: none;
    padding: 0.35rem 0.6rem;
    color: #7dcfff;
    font-size: 0.8rem;
    cursor: pointer;
    text-align: left;
    transition: background 0.15s;
}

.portal-reminder-header:hover {
    background: rgba(125, 207, 255, 0.08);
}

.portal-reminder-header.expanded {
    border-bottom: 1px solid rgba(125, 207, 255, 0.2);
}

.portal-reminder-icon { font-size: 0.9rem; }

.portal-reminder-title {
    flex: 1;
    font-weight: 500;
}

.portal-reminder-toggle {
    color: rgba(125, 207, 255, 0.7);
    font-size: 0.75rem;
}

.portal-reminder-body {
    padding: 0.5rem 0.9rem;
    color: var(--text-secondary);
    font-size: 0.85rem;
    line-height: 1.55;
}

.portal-reminder-body p {
    margin: 0.35rem 0;
}
.portal-reminder-body p:first-child {
    margin-top: 0;
}
.portal-reminder-body p:last-child {
    margin-bottom: 0;
}
.portal-reminder-body code {
    font-size: 0.8em;
}
.portal-reminder-body ul {
    margin: 0.35rem 0;
    padding-left: 1.2rem;
}

/* ==========================================================================
   Thinking Block
   ========================================================================== */

.thinking-block {
    padding: 0.5rem 0.75rem;
    margin: 0.5rem 0;
    border-left: 2px solid var(--border-color);
    opacity: 0.6;
}

.thinking-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    display: block;
    margin-bottom: 0.25rem;
}

.thinking-content {
    font-style: italic;
    color: var(--text-secondary);
    font-size: 0.85rem;
    line-height: 1.5;
    white-space: pre-wrap;
    word-wrap: break-word;
}

/* ==========================================================================
   Result Message — compact stats bar
   ========================================================================== */

.result-message {
    margin-bottom: 0.5rem;
    border: none;
    background: transparent;
}

.result-message .result-stats-bar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.4rem 0.75rem;
    background: rgba(0, 0, 0, 0.15);
    border-radius: 4px;
    font-size: 0.8rem;
}

.result-message .result-status {
    font-weight: bold;
}

.result-message .result-status.success {
    color: var(--success);
}

.result-message .result-status.error {
    color: var(--error);
}

.result-message .stat-item {
    color: var(--text-secondary);
    cursor: help;
}

.result-message .stat-item.cost {
    color: var(--success);
    font-weight: 500;
}

.result-message .stat-item.tokens {
    color: var(--text-secondary);
}

.result-message .stat-item.turns {
    color: var(--accent);
}

.result-message.error .stat-item.cost {
    color: var(--error);
}

.result-message .stat-item.stop-reason {
    color: #e0af68;
    font-weight: 500;
}

.result-message .stat-item.fast-mode {
    color: var(--accent);
    font-weight: 500;
}

.result-message .stat-item.errors {
    color: var(--error);
    font-weight: 500;
}

.result-message .stat-item.denials {
    color: #e0af68;
    font-weight: 500;
}

.result-message.success {
    border-left: 3px solid var(--success);
}

.result-message.error {
    border-left: 3px solid var(--error);
}

/* ==========================================================================
   Per-turn metrics footer (PR 2 of N)
   Sits directly beneath the result-stats-bar card. One row of muted "chips"
   separated by middle-dot. Wraps on narrow viewports. No icons, no emoji —
   the chip text alone communicates the meaning, and the separator is
   `\u{00b7}` (· MIDDLE DOT).
   ========================================================================== */

.turn-metrics-footer {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    padding: 0.25rem 0.75rem 0.1rem 0.75rem;
    margin-top: 0.25rem;
    font-size: 0.75rem;
    color: var(--text-muted, var(--text-secondary));
    line-height: 1.4;
}

.turn-metric-chip {
    color: var(--text-muted, var(--text-secondary));
    white-space: nowrap;
}

.turn-metric-sep {
    color: var(--text-muted, var(--text-secondary));
    opacity: 0.5;
    user-select: none;
}

/* ==========================================================================
   User Message
   ========================================================================== */

.user-message {
    border-left: 3px solid var(--accent);
}

.user-message.pending {
    opacity: 0.6;
    border-left-style: dashed;
}

.pending-indicator {
    color: var(--accent);
    font-size: 1.2rem;
    line-height: 1;
    animation: pending-pulse 1.5s ease-in-out infinite;
}

@keyframes pending-pulse {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 1; }
}

.user-message .user-text {
    color: var(--text-primary);
    line-height: 1.6;
}

/* ==========================================================================
   Error Message
   ========================================================================== */

.error-message-display {
    border-left: 3px solid var(--error);
}

.error-message-display .error-text {
    color: var(--error);
}

.error-type {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--text-secondary);
    padding: 0.15rem 0.4rem;
    background: rgba(247, 118, 142, 0.15);
    border-radius: 3px;
}

/* ==========================================================================
   Overload / Busy Message
   ========================================================================== */

.overload-message {
    border-left: 3px solid #e0af68;
    background: rgba(224, 175, 104, 0.08);
}

.message-type-badge.overload {
    background: rgba(224, 175, 104, 0.2);
    color: #e0af68;
}

.overload-content {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
}

.overload-icon {
    font-size: 1.5rem;
    line-height: 1;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.overload-text {
    flex: 1;
}

.overload-title {
    font-weight: 600;
    color: #e0af68;
    margin-bottom: 0.25rem;
}

.overload-description {
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.5;
}

.overload-details {
    margin-top: 0.75rem;
    padding-top: 0.5rem;
    border-top: 1px solid var(--border);
}

.overload-details .request-id {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* ==========================================================================
   Rate Limit Event Message
   ========================================================================== */

.rate-limit-message {
    border-left: 3px solid #e0af68;
    background: rgba(224, 175, 104, 0.05);
}

.message-type-badge.rate-limit {
    background: rgba(224, 175, 104, 0.2);
    color: #e0af68;
}

.utilization-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.4rem;
}

.utilization-bar {
    flex: 1;
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    overflow: hidden;
}

.utilization-fill {
    height: 100%;
    background: #e0af68;
    border-radius: 3px;
    transition: width 0.3s ease;
}

.utilization-bar.warning .utilization-fill {
    background: #e0af68;
}

.utilization-bar.critical .utilization-fill {
    background: #f7768e;
}

.utilization-label {
    font-size: 0.7rem;
    color: var(--text-secondary);
    min-width: 2.5em;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

/* ==========================================================================
   Compaction / Summary Message
   ========================================================================== */

.compaction-message {
    border-left: 3px solid #7aa2f7;
    background: rgba(122, 162, 247, 0.08);
}

.message-type-badge.compaction {
    background: rgba(122, 162, 247, 0.2);
    color: #7aa2f7;
}

.compaction-stat {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-left: 0.5rem;
}

.compaction-content {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
}

.compaction-icon {
    font-size: 1.5rem;
    line-height: 1;
}

.compaction-text {
    flex: 1;
}

.compaction-description {
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.5;
}

.compaction-summary {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.compaction-summary .summary-label {
    font-weight: 600;
    color: #7aa2f7;
    font-size: 0.85rem;
}

.compaction-summary .summary-text {
    color: var(--text);
    font-size: 0.9rem;
    line-height: 1.6;
    white-space: pre-wrap;
    word-wrap: break-word;
    max-height: 300px;
    overflow-y: auto;
}

/* ==========================================================================
   Task / Subagent Message (subagent completion event, not the Task tool
   renderer — the latter lives in tools/task.css).
   ========================================================================== */

.task-message {
    border-left: 3px solid #bb9af7;
    background: rgba(187, 154, 247, 0.08);
}

.task-message.failed {
    border-left-color: var(--error);
    background: rgba(247, 118, 142, 0.08);
}

.message-type-badge.task {
    background: rgba(187, 154, 247, 0.2);
    color: #bb9af7;
}

.message-type-badge.task.failed {
    background: rgba(247, 118, 142, 0.2);
    color: var(--error);
}

.task-type-badge {
    font-size: 0.65rem;
    padding: 0.1rem 0.4rem;
    border-radius: 3px;
    background: rgba(187, 154, 247, 0.15);
    color: #bb9af7;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.task-description-inline {
    color: var(--text-secondary);
    font-size: 0.85rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.task-stat {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-left: 0.5rem;
}

.task-summary {
    color: var(--text);
    font-size: 0.9rem;
    line-height: 1.6;
    white-space: pre-wrap;
    word-wrap: break-word;
    max-height: 200px;
    overflow-y: auto;
}

/* ==========================================================================
   Raw Message — fallback renderer for unrecognized message types.
   ========================================================================== */

.raw-message .raw-json {
    font-family: 'Courier New', monospace;
    font-size: 0.85rem;
    color: var(--text-secondary);
    white-space: pre-wrap;
    word-wrap: break-word;
    margin: 0;
    max-height: 300px;
    overflow-y: auto;
}

.raw-message .raw-message-hint {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin: 0.5rem 0 0;
}

.raw-message .raw-message-hint a {
    color: var(--accent);
    text-decoration: underline;
}

/* Tooltip styling for native title attribute */
.claude-message [title] {
    position: relative;
}

/* ==========================================================================
   Content Block Renderers — server tool use, MCP, code execution, etc.
   ========================================================================== */

.server-tool-use {
    background: rgba(122, 162, 247, 0.08);
    border-left-color: #7aa2f7;
}

.web-search-result {
    background: rgba(122, 162, 247, 0.05);
    border-left-color: #7aa2f7;
}

.mcp-tool-use {
    background: rgba(187, 154, 247, 0.08);
    border-left-color: #bb9af7;
}

.mcp-tool-result {
    background: rgba(187, 154, 247, 0.05);
}

.code-execution-result {
    background: rgba(158, 206, 106, 0.05);
    border-left-color: var(--success);
}

.container-upload {
    background: rgba(224, 175, 104, 0.08);
    border-left-color: #e0af68;
}

.unknown-block {
    background: rgba(127, 132, 156, 0.08);
    border-left-color: var(--text-muted);
}

/* ==========================================================================
   Citations
   ========================================================================== */

.citation-list {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    margin-top: 0.25rem;
}

.citation-link {
    font-size: 0.7rem;
    color: var(--accent);
    text-decoration: none;
    padding: 0.05rem 0.2rem;
    border-radius: 2px;
    background: rgba(122, 162, 247, 0.1);
    transition: background 0.15s;
}

.citation-link:hover {
    background: rgba(122, 162, 247, 0.25);
    text-decoration: underline;
}
