/* Public activity shares the conversation's typography and light/dark theme. */
:root { --feed-font-scale: 1; }
.terminal-feed, .feed-overlay, .feed-inspector {
  --feed-line: var(--line);
  --feed-card: var(--panel);
  --feed-muted: var(--muted);
  --feed-blue: var(--accent);
  --feed-green: var(--success);
  --feed-orange: var(--warning);
  --feed-red: var(--error);
  color: var(--secondary);
  background: var(--bg);
  font: 400 calc(13px * var(--feed-font-scale))/21px var(--font-sans);
}
.terminal-feed {
  position: relative;
  min-width: 0;
  max-width: 100%;
  gap: 0;
  padding: 0;
}
#messages:has(.terminal-feed:not([hidden])) { max-width: none; }
#messages:has(.terminal-feed:not([hidden])) .message-content { max-width: 100%; }
.feed-controls { margin: 0 0 8px; border: 0; }
.terminal-feed .feed-controls-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 24px;
  padding: 0;
  list-style: none;
  color: var(--feed-blue);
}
.feed-eyebrow { font-weight: 600; }
.feed-counter { color: var(--feed-muted); font-size: inherit; }
.feed-controls-body { padding: 8px 0; }
.feed-toolbar, .feed-summary-actions, .feed-match-navigation {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.feed-toolbar { margin-bottom: 8px; }
.terminal-feed .feed-search {
  flex: 1 1 160px;
  min-width: 0;
  width: 100%;
  max-width: 360px;
  min-height: 44px;
  padding: 8px;
  border: 1px solid #767676;
  border-radius: 0;
  background: #fff;
  color: #171717;
  font: inherit;
}
.terminal-feed .feed-search::placeholder { color: var(--feed-muted); }
.feed-filters { flex-shrink: 0; }
.terminal-feed .feed-filters > summary,
.feed-button, .feed-controls-body > button, .feed-match-navigation button {
  min-width: 44px;
  min-height: 44px;
  padding: 8px;
  border: 1px solid transparent;
  border-radius: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  cursor: pointer;
  overflow-wrap: anywhere;
}
.terminal-feed .feed-filters > summary { display: block; border-color: #767676; list-style: none; }
.feed-button:hover, .feed-controls-body > button:hover,
.feed-match-navigation button:hover { background: #f0f0f0; }
.feed-button[aria-pressed=true] { background: #e5edff; color: var(--feed-blue); }
.feed-result-count, .feed-pinned-status { color: var(--feed-muted); margin: 4px 0; }
.feed-summary { padding: 4px 0 4px 14px; margin: 0 0 8px; border-left: 1px solid #707070; }
.feed-summary-body { white-space: pre-wrap; overflow-wrap: anywhere; }
.timeline-group {
  position: relative;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}
.timeline-group::before, .timeline-group::after { content: none; }
.timeline-group-content { padding: 0; border: 0; min-width: 0; }
.terminal-feed .terminal-entry {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  overflow: visible;
}
.terminal-feed .terminal-entry > .timeline-group-header {
  display: grid;
  grid-template-columns: 16px minmax(0, 1fr) auto;
  align-items: start;
  gap: 4px;
  min-height: 28px;
  padding: 3px 28px 3px 0;
  border-radius: 0;
  font: inherit;
  color: inherit;
  cursor: pointer;
  list-style: none;
}
.terminal-feed summary::-webkit-details-marker { display: none; }
.terminal-feed .timeline-group-header:hover { background: #f5f5f5; }
.terminal-feed .activity-text {
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: 0;
  font-weight: 400;
  color: inherit;
  animation: none;
}
.terminal-feed .terminal-entry[open] .activity-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.terminal-feed .activity-icon {
  display: inline-block;
  width: 14px;
  color: var(--feed-muted);
  font: inherit;
  line-height: inherit;
  text-align: left;
  animation: none;
}
.terminal-row[data-state=completed] .activity-icon { color: var(--feed-green); }
.terminal-row[data-category=commands] .activity-icon { color: var(--feed-orange); }
.terminal-row[data-category=research] .activity-icon { color: #006b75; }
.terminal-row[data-category=agents] .activity-icon { color: #800080; }
.terminal-feed .progress-activity .activity-text { color: #800080; }
.terminal-row[data-state=failed] :is(.activity-icon, .activity-text) { color: var(--feed-red); }
.terminal-row:is([data-state=warning], [data-state=retrying], [data-state=queued]) .activity-icon { color: var(--feed-orange); }
.terminal-row[data-state=cancelled] :is(.activity-icon, .activity-text, .timeline-state) { color: var(--feed-muted); }
.terminal-feed .feed-active { pointer-events: none; }
.terminal-feed .thinking-block .activity-icon { color: var(--feed-muted); }
.terminal-feed .activity-time { font: inherit; color: var(--feed-muted); padding-left: 12px; white-space: nowrap; }
.terminal-command-preview {
  grid-column: 2 / -1;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  color: var(--feed-muted);
}
.terminal-entry[open] .terminal-command-preview { display: none; }
.terminal-row[data-state=failed] .terminal-command-preview { color: var(--feed-red); }
.terminal-feed .thinking-content,
.terminal-feed .tool-preview,
.terminal-feed .code-preview {
  max-width: 100%;
  max-height: 320px;
  margin: 0 0 4px 14px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #171717;
  font: inherit;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  overflow: auto;
  overscroll-behavior: contain;
}
.terminal-feed .thinking-content {
  max-height: 280px;
  margin-left: 7px;
  padding-left: 7px;
  border-left: 1px solid #707070;
}
.terminal-feed .summary-expanded .thinking-content { max-height: none; }
.terminal-feed .code-preview { white-space: pre; overflow-wrap: normal; }
.terminal-feed .nested { margin-left: var(--activity-indent, 18px); }
.terminal-feed .code-change-toolbar {
  justify-content: flex-start;
  flex-wrap: wrap;
  gap: 8px;
  margin-left: 14px;
  padding: 0;
  border: 0;
}
.terminal-feed .code-change-note { font: inherit; color: var(--feed-muted); }
.terminal-feed .draft-copy { font: inherit; min-height: 44px; border-radius: 0; background: #fff; color: var(--feed-blue); }
.feed-actions { position: absolute; top: 0; right: 0; }
.terminal-feed .feed-actions > summary {
  display: block;
  min-width: 24px;
  min-height: 16px;
  padding: 0;
  color: var(--feed-muted);
  font: inherit;
  text-align: center;
  list-style: none;
  cursor: pointer;
  opacity: 0;
}
.terminal-row:hover .feed-actions > summary,
.terminal-row:focus-within .feed-actions > summary,
.feed-actions[open] > summary { opacity: 1; }
.feed-overlay {
  position: fixed;
  inset: auto;
  z-index: 100;
  display: grid;
  width: 240px;
  max-width: calc(100vw - 16px);
  margin: 0;
  padding: 4px;
  border: 1px solid #767676;
  border-radius: 0;
  box-shadow: 0 4px 16px #0002;
  overflow: auto;
  overscroll-behavior: contain;
}
.feed-change-summary { margin: 4px 0 0 14px; color: var(--feed-muted); overflow-wrap: anywhere; }
.feed-additions { margin-left: 8px; color: var(--feed-green); }
.feed-deletions { margin-left: 8px; color: var(--feed-red); }
.feed-empty { margin: 4px 0; color: var(--feed-muted); font: inherit; }
.terminal-feed mark { background: #ffed9b; color: #171717; }
.terminal-feed a { color: #006b75; text-decoration: underline; }
.feed-match-navigation { margin: 4px 0 4px 14px; font: inherit; }
.terminal-feed :is(summary, button, input, [tabindex]):focus-visible,
.feed-overlay button:focus-visible, .feed-inspector :focus-visible {
  outline: 2px solid var(--feed-blue);
  outline-offset: 1px;
}
.message:has(.terminal-feed:not([hidden])) > .activity-footer {
  min-height: 24px;
  margin: 0 0 8px;
  padding: 4px 8px;
  background: #fff;
  color: #595959;
  font: 400 .8125rem/1.25 var(--font-code);
}
.message:has(.terminal-feed:not([hidden])) .activity-footer.live { color: #800080; }
.message:has(.terminal-feed:not([hidden])) .activity-title::before {
  content: "□";
  width: 14px;
  margin-right: 0;
  animation: none;
}
.feed-inspector {
  position: fixed;
  inset: 0 0 0 auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: min(560px, 100vw);
  max-width: 100vw;
  height: 100dvh;
  max-height: 100dvh;
  margin: 0;
  padding: 16px;
  border: 1px solid #767676;
  border-radius: 0;
  overflow: auto;
}
.feed-inspector:not([open]) { display: none; }
.feed-inspector::backdrop { background: #0006; }
.feed-inspector h2 { margin: 0; font: 600 1rem/1.4 var(--font-code); overflow-wrap: anywhere; }
.feed-inspector-status { color: var(--feed-muted); }
.feed-inspector-output {
  flex: 1;
  min-height: 44px;
  max-height: none;
  margin: 0;
  padding: 8px;
  background: #fff;
  border-left: 1px solid #707070;
  color: inherit;
  font: inherit;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  overflow: auto;
  overscroll-behavior: contain;
}
.feed-inspector-actions { display: flex; flex-wrap: wrap; gap: 8px; }
@media (pointer: coarse) {
  .terminal-feed .terminal-entry > .timeline-group-header { min-height: 44px; padding: 12px 44px 12px 0; }
  .terminal-feed .feed-actions > summary { min-width: 44px; min-height: 44px; padding: 12px 0; opacity: 1; }
  .terminal-feed .feed-controls-trigger { min-height: 44px; }
  .terminal-feed .activity-time { padding-left: 4px; }
  .feed-inspector { inset: auto 0 0; width: 100%; height: 85dvh; }
}
@media (max-height: 420px) {
  .feed-inspector { inset: 0 0 0 auto; width: min(560px, 100vw); height: 100dvh; padding: 12px; gap: 8px; }
}
.terminal-feed :is(.thinking-content,.tool-preview,.code-preview),.feed-inspector-output{color:var(--secondary);background:transparent}
.terminal-feed .code-preview{font-family:var(--font-code)}
.terminal-feed .feed-search{color:var(--text);background:var(--panel);border-color:var(--control-border);border-radius:4px}
.terminal-feed .timeline-group-header:hover,.feed-button:hover,.feed-controls-body>button:hover,.feed-match-navigation button:hover{background:var(--hover)}
.terminal-feed a,.terminal-row[data-category=research] .activity-icon{color:var(--accent)}
.terminal-row[data-category=agents] .activity-icon,.terminal-feed .progress-activity .activity-text{color:var(--muted)}
.message:has(.terminal-feed:not([hidden]))>.activity-footer{background:transparent;color:var(--muted);font:12px/20px var(--font-sans);padding:4px 0}
.message:has(.terminal-feed:not([hidden])) .activity-footer.live{color:var(--secondary)}
@media (prefers-reduced-motion: reduce) {
  .terminal-feed *, .terminal-feed *::before { animation: none !important; transition: none !important; }
}
