/* Agent details use the same message primitives as the main conversation. */
.work-agents-view { min-height: 0; overflow: hidden; display: grid; grid-template-rows: minmax(0,1fr); }
#work-agent-roster { padding: 10px; }
.child-agents { margin: 0; padding: 6px 4px; background: transparent; box-shadow: none; }
.child-agents-label { padding: 4px 10px 8px; font-size: 12px; font-weight: 400; color: var(--faint); }
.work-panel .child-agent-card { width: 100%; display: grid; grid-template-columns: 36px minmax(0,1fr); align-items: center; gap: 14px; text-align: left; padding: 10px; margin: 0; border-radius: 12px; background: transparent; }
.work-panel .child-agent-card:hover:not(:disabled) { background: color-mix(in srgb, var(--text) 4%, transparent); }
.work-panel .child-agent-card:active:not(:disabled) { scale: .99; }
.child-agent-avatar { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; color: var(--accent); background: var(--raised); font-size: 10px; font-weight: 500; }
.child-agent-copy { min-width: 0; display: grid; gap: 3px; }
.child-agent-name { font-size: 14px; font-weight: 500; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.child-agents .child-agent-task { color: var(--muted); font-size: 12.5px; line-height: 1.45; }
.child-agent-card[data-status='failed'] .child-agent-task { color: color-mix(in srgb, var(--red) 80%, var(--muted)); }
/* Live status: a soft highlight sweeps across the text while the agent works. */
.child-agent-task.is-live { background: linear-gradient(90deg, var(--muted) 0%, var(--muted) 35%, var(--text) 50%, var(--muted) 65%, var(--muted) 100%) 0 0 / 250% 100%; -webkit-background-clip: text; background-clip: text; color: transparent; animation: agent-line-shimmer 2.4s linear infinite; }
@keyframes agent-line-shimmer { from { background-position: 100% 0; } to { background-position: -150% 0; } }
@media (prefers-reduced-motion: reduce) { .child-agent-task.is-live { animation: none; background: none; color: var(--muted); } }
.child-agent-title { display: flex; align-items: center; gap: 8px; min-width: 0; }
.agent-profile { flex-shrink: 0; font-size: 9px; font-weight: 500; letter-spacing: .04em; text-transform: uppercase; color: var(--faint); padding: 1px 5px; border-radius: 3px; background: var(--surface); }
.agent-profile[data-profile='explore'] { color: var(--muted); }
.agent-profile[data-profile='tester'] { color: var(--green); }
.agent-profile[data-profile='reviewer'] { color: var(--amber); }
.agent-profile[data-profile='general'] { color: var(--accent); }
.agent-detail-header .agent-profile { margin-left: 6px; }
.child-agent-title strong { font-size: 12px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.child-agent-status { display: inline-flex; align-items: center; gap: 5px; font-size: 10px; font-weight: 400; white-space: nowrap; color: var(--faint); flex-shrink: 0; }
.child-agent-title .child-agent-status { margin-left: auto; }
.child-agent-status::before { content: ''; width: 5px; height: 5px; border-radius: 50%; background: var(--faint); }
.child-agent-status[data-status='running']::before, .child-agent-status[data-status='waiting_for_model']::before, .child-agent-status[data-status='waiting_for_tool']::before { background: var(--accent); }
.child-agent-status[data-status='succeeded']::before { background: var(--green); }
.child-agent-status[data-status='failed']::before { background: var(--red); }
.child-agent-status[data-status='cancelled']::before { background: var(--amber); }
.child-agent-task { color: var(--faint); font-size: 11px; line-height: 1.5; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.child-agent-arrow { color: var(--faint); font-size: 17px; opacity: 0; transition: opacity 120ms; }
.child-agent-card:is(:hover,:focus-visible) .child-agent-arrow { opacity: 1; }
.agent-detail-view { grid-column: 1; grid-row: 1; min-width: 0; min-height: 0; display: grid; grid-template-rows: auto minmax(0,1fr); }
.agent-detail-header { display: flex; align-items: center; gap: 7px; min-height: 42px; padding: 3px 12px 3px 6px; border-bottom: 1px solid var(--line-subtle); }
.work-panel .agent-back { width: 32px; min-height: 32px; padding: 0; background: transparent; flex-shrink: 0; }
.agent-back img { width: 14px; height: 14px; }
.agent-detail-header h2 { font-size: 12px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.agent-detail-header .child-agent-status { margin-left: auto; }
.agent-instructions { color: var(--faint); font-size: 11px; margin: -10px 0 16px; }
.agent-instructions > summary { cursor: pointer; padding: 7px 0; min-height: 30px; text-align: right; }
.agent-instructions p { padding: 6px 0; white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.75; }
.agent-empty, .agent-notice, .agent-list-notice { color: var(--faint); font-size: 12px; line-height: 1.75; }
.agent-notice { margin-bottom: 16px; }
.agent-retry { color: var(--accent); font-size: 11px; margin-left: 6px; }
.agent-load-more { margin-top: 14px; width: 100%; color: var(--muted); }
@media (pointer: coarse) { .work-panel .agent-back, .agent-instructions > summary { min-height: 40px; } }

/* Bot avatars (window.KairosUI.avatar): a canvas sized by the component; the host only reserves space. */
.bot-avatar-host { display: grid; place-items: center; width: var(--bot-size, 28px); height: var(--bot-size, 28px); border-radius: 0; background: transparent; overflow: visible; flex-shrink: 0; }
.bot-avatar-host canvas { display: block; }
.agent-detail-avatar { margin-right: 10px; }

/* Subagent detail: one calm reading column. Narration is the voice; tool steps stay quiet. */
#agent-detail-view .agent-detail-header { gap: 12px; min-height: 64px; padding: 12px 20px 12px 10px; border-bottom: 0; }
#agent-detail-view .agent-detail-header h2 { font-size: 14px; font-weight: 500; color: var(--text); }
#agent-detail-view .agent-detail-avatar { margin-right: 0; }
#agent-detail-view .agent-profile { display: none; }
#agent-detail-view .agent-detail-header .child-agent-status { font-size: 12px; color: var(--faint); }
#agent-detail-view .agent-detail-header .child-agent-status::before { display: none; }
#agent-detail-view .agent-detail-header .child-agent-status[data-status='failed'] { color: var(--red); }
#agent-detail-view .agent-detail-scroll { padding: 8px max(28px, calc((100% - 680px) / 2)) 64px; }
#agent-detail-view .agent-detail-intro { margin-bottom: 28px; }
#agent-detail-view .agent-detail-intro::before { content: "Task"; display: block; margin-bottom: 6px; color: var(--faint); font-size: 12px; }
#agent-detail-view #agent-detail-task .message-row.user { display: block; margin: 0; }
#agent-detail-view #agent-detail-task .message-content { max-width: none; padding: 0; background: transparent; box-shadow: none; color: var(--text); font-size: 14px; line-height: 1.65; }
#agent-detail-view .agent-instructions { margin: 10px 0 0; }
#agent-detail-view .agent-instructions > summary { text-align: left; color: var(--faint); }
/* Shared timeline voice for the main chat and subagent views: narration as plain text, quiet tool steps. */
:is(#agent-detail-view, #message-list) .agent-working-update { margin: 22px 0 10px; gap: 0; color: var(--text); }
:is(#agent-detail-view, #message-list) .agent-working-update-icon { display: none; }
:is(#agent-detail-view, #message-list) .agent-working-update p { font-size: 13.5px; line-height: 1.7; color: color-mix(in srgb, var(--text) 92%, var(--muted)); }
:is(#agent-detail-view, #message-list) :is(.tool-activity, .agent-event) { margin: 2px 0; }
:is(#agent-detail-view, #message-list) .agent-event { gap: 8px; padding: 2px 0; color: var(--faint); }
:is(#agent-detail-view, #message-list) .agent-event strong { font-size: 12px; color: var(--muted); }
:is(#agent-detail-view, #message-list) .agent-event small { font-size: 11.5px; }
:is(#agent-detail-view, #message-list) .agent-event-icon { height: 20px; }
:is(#agent-detail-view, #message-list) :is(.agent-event-icon, .tool-activity-toggle) .activity-icon { opacity: .5; scale: .85; }
:is(#agent-detail-view, #message-list) .tool-activity-toggle { min-height: 28px; padding: 2px 0; color: var(--faint); font-size: 12px; }
:is(#agent-detail-view, #message-list) .tool-activity-toggle:hover { color: var(--muted); }
/* A message from the main agent to a subagent reads as a message: a clean right-aligned bubble. */
#agent-detail-view .agent-activity .message-row.user { margin: 26px 0 16px; }
#agent-detail-view .agent-result { margin-top: 28px; padding-top: 20px; box-shadow: inset 0 1px 0 var(--line-subtle); }
#agent-detail-view .agent-activity .message-row.assistant { margin-top: 24px; }
