/* Recorded agent execution, using the workspace's lilac and violet palette. */
.agent-activity { margin: 24px 0; overflow: hidden; }
.activity-heading { padding: 26px 28px 22px; display: flex; align-items: start; justify-content: space-between; gap: 20px; }
.activity-heading .eyebrow { color: #9174ae; font-size:var(--text-caption); margin-bottom: 9px; }
.activity-heading h2 { font-size: 24px; color: #49325e; font-weight: 550; }
.activity-description { color: #7d7089; font-size:var(--text-ui); margin-top: 8px; max-width: 560px; }
.activity-progress { flex-shrink: 0; padding: 8px 12px; border-radius: 999px; background: #f0e9f7; color: #775398; font-size:var(--text-ui); margin-top: 5px; }
.activity-map { padding: 30px 28px; border-block: 1px solid #e9e1f0; background-color: #f7f3fb; background-image: radial-gradient(#d8cbe6 .8px, transparent .8px); background-size: 18px 18px; }
.activity-stages { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 26px; list-style: none; margin: 0; padding: 0; }
.activity-step { position: relative; min-width: 0; }
.activity-step:not(:last-child)::after { content: '→'; position: absolute; left: calc(100% + 5px); top: 50%; color: #a68bbd; font-size: 18px; transform: translateY(-50%); }
.activity-step:nth-child(4n):not(:last-child)::after { content: '↓'; left: auto; right: 50%; top: calc(100% + 13px); }
.activity-node { text-align: left; display: flex; flex-direction: column; width: 100%; min-height: 145px; padding: 17px; gap: 13px; border: 1px solid #dbcee8; background: #fffdfef5; color: #655275; border-radius: 14px; transition: border-color .2s, box-shadow .2s; }
.activity-node:hover, .activity-node[aria-expanded=true] { border-color: #9872bc; box-shadow: 0 4px 16px #68428b14; }
.activity-node-top { display: flex; align-items: center; gap: 8px; text-transform: uppercase; font-size:var(--text-caption); font-weight: 650; letter-spacing: 1px; }
.activity-symbol { display: grid; place-items: center; width: 25px; height: 25px; border-radius: 8px; background: #f0e9f6; color: #9565bb; font-size: 18px; flex-shrink: 0; }
.activity-node strong { font-size:var(--text-body); line-height: 1.4; font-weight: 550; }
.activity-node-status { display: flex; align-items: center; gap: 7px; font-size:var(--text-caption); margin-top: auto; color: #8b7a99; }
.activity-node-status i { width: 6px; height: 6px; border-radius: 50%; background: #c0b2cb; }
.activity-inspect { margin-left: auto; font-size: 17px; }
.is-agent .activity-node { background: linear-gradient(140deg, #efe6f8, #f8f3fc); border-color: #d0bce4; color: #503566; }
.is-agent .activity-symbol { background: #e6d7f3; color: #7c4da7; }
.activity-step[data-state=completed] .activity-node { border-color: #c6b1da; }
.activity-step[data-state=completed] .activity-node-status { color: #745095; }
.activity-step[data-state=completed] .activity-node-status i { background: #9166b5; }
.activity-step[data-state=working] .activity-node { border-color: #9162bc; box-shadow: 0 0 0 3px #aa82cf1f; }
.activity-step[data-state=working] .activity-node-status { color: #7643a1; }
.activity-step[data-state=working] .activity-node-status i { background: #9462c1; animation: activity-pulse 1.6s ease-in-out infinite; }
.activity-step[data-state=failed] .activity-node { border-color: #d4a5a0; background: #fcf3f2; }
.activity-step[data-state=failed] .activity-node-status { color: #a65f56; }
.activity-step[data-state=failed] .activity-node-status i { background: #b8756b; }
.activity-step[data-state=not-run] .activity-node-status, .activity-step[data-state=not-used] .activity-node-status { color: #8b7a99; }
.activity-outcome { display: flex; align-items: center; gap: 13px; padding: 20px 28px; }
.activity-outcome-symbol { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: #f0e8f7; color: #926bb1; font-size: 18px; flex-shrink: 0; }
.activity-outcome strong { font-size:var(--text-ui); font-weight: 550; color: #634a77; }
.activity-outcome div > span { display: block; font-size:var(--text-ui); color: #8b7a99; margin-top: 4px; }
.activity-mode { margin-left: auto; color: #91839c; font-size:var(--text-caption); white-space: nowrap; }
.assistant-map .activity-stages { grid-template-columns: repeat(3, minmax(0, 1fr)); row-gap: 32px; }
.assistant-map .is-agent { grid-column: 1 / -1; width: min(100%, 300px); justify-self: center; }
.assistant-map .activity-step::after { display: none; }
.assistant-map .is-support::before { content: ''; position: absolute; height: 16px; width: 1px; background: #cbb7de; bottom: 100%; left: 50%; }
.assistant-map .is-agent::after { display: block; content: '↓'; top: calc(100% + 16px); left: 50%; }
.activity-inspector { position: fixed; inset: 0 0 0 auto; margin: 0; padding: 0; width: min(480px, 100%); max-width: 100%; height: 100dvh; max-height: 100dvh; border: 0; border-left: 1px solid #dfd2e9; background: #fcfaff; color: #493653; box-shadow: -16px 0 60px #25153024; }
.activity-inspector[open] { display: flex; flex-direction: column; }
.activity-inspector::backdrop { background: #27163059; }
.activity-inspector > header { display: flex; align-items: center; justify-content: space-between; padding: 18px 25px; border-bottom: 1px solid #e8dfef; flex-shrink: 0; }
.activity-inspector header .eyebrow { font-size:var(--text-caption); color: #9278a5; }
.activity-inspector .icon-button { width: 44px; height: 44px; font-size: 26px; color: #76578f; }
.inspector-body { overflow-y: auto; padding: 28px; }
.inspector-body > .eyebrow { color: #916caf; font-size:var(--text-caption); margin-bottom: 12px; }
.inspector-body h2 { font-size: 28px; font-weight: 500; line-height: 1.2; }
.inspector-description { margin-top: 15px; color: #82738c; font-size:var(--text-ui); }
.inspector-state { display: flex; justify-content: space-between; margin-top: 24px; padding: 12px 14px; border-radius: 10px; background: #f0e8f7; color: #7c549b; font-size:var(--text-ui); }
.inspector-state[data-state=failed] { background: #faece9; color: #a65f56; }
.inspector-message { margin-top: 13px; font-size:var(--text-ui); color: #7b6b87; }
.inspector-records { margin-top: 26px; border-top: 1px solid #e8dfef; padding-top: 22px; }
.inspector-records h3 { font-size:var(--text-body); font-weight: 550; margin-bottom: 12px; }
.inspector-records > p { color: #93849e; font-size:var(--text-ui); }
.activity-inspector summary { padding: 13px 0; font-size:var(--text-ui); cursor: pointer; color: #77558f; }
.activity-inspector pre { max-height: 320px; font-size:var(--text-ui); color: #6c587e; background: #f2ecf7; border-radius: 8px; padding: 14px; }
.inspector-events { list-style: none; padding: 0; margin: 0; }
.inspector-events li { border-left: 2px solid #ded0eb; padding: 0 0 18px 14px; }
.inspector-events li:last-child { padding-bottom: 0; }
.inspector-events span { color: #a18dab; font-size:var(--text-caption); }
.inspector-events p { font-size:var(--text-ui); margin-top: 5px; color: #796887; overflow-wrap: anywhere; }
.inspector-technical { margin-top: 28px; border-top: 1px solid #e8dfef; }
.inspector-technical dl { display: grid; grid-template-columns: 90px 1fr; gap: 12px; font-size:var(--text-ui); }
.inspector-technical dt { color: #97859f; }
.inspector-technical dd { margin: 0; overflow-wrap: anywhere; }
.run-event-log > summary { cursor: pointer; list-style: none; }
.run-event-log > summary::-webkit-details-marker { display: none; }
.run-event-log > summary::after { content: '+'; color: #9878ad; font-size: 20px; }
.run-event-log[open] > summary::after { content: '−'; }
@keyframes activity-pulse { 50% { box-shadow: 0 0 0 5px #9462c126; } }
@media (max-width: 1100px) {
  .activity-stages, .assistant-map .activity-stages { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .activity-step:nth-child(2n):not(:last-child)::after { content: '↓'; left: auto; right: 50%; top: calc(100% + 13px); }
  .assistant-map .activity-step::after { display: none; }
  .assistant-map .is-agent::after { display: block; }
}
@media (max-width: 600px) {
  .activity-heading { padding: 22px 18px; flex-direction: column; gap: 12px; }
  .activity-heading h2 { font-size: 21px; }
  .activity-map { padding: 24px 18px; }
  .activity-stages, .assistant-map .activity-stages { grid-template-columns: 1fr; gap: 24px; }
  .activity-node { min-height: 125px; }
  .activity-step:not(:last-child)::after { content: '↓'; left: 50%; right: auto; top: calc(100% + 12px); }
  .assistant-map .is-agent { width: 100%; }
  .assistant-map .is-support::before { display: none; }
  .activity-outcome { padding: 20px 18px; flex-wrap: wrap; }
  .activity-mode { width: 100%; margin-left: 45px; }
  .inspector-body { padding: 24px; }
}
@media (prefers-reduced-motion: reduce) {
  .activity-node { transition: none; }
  .activity-step[data-state=working] .activity-node-status i { animation: none; }
}
/* A continuous serpentine path keeps every arrow connected to the next step. */
@media (min-width: 1101px) {
  .activity-map:not(.assistant-map) .activity-step:nth-child(5) { grid-area: 2 / 4; }
  .activity-map:not(.assistant-map) .activity-step:nth-child(6) { grid-area: 2 / 3; }
  .activity-map:not(.assistant-map) .activity-step:nth-child(7) { grid-area: 2 / 2; }
  .activity-map:not(.assistant-map) .activity-step:nth-child(8) { grid-area: 2 / 1; }
  .activity-map:not(.assistant-map) .activity-step:nth-child(n+5):not(:last-child)::after { content: '←'; left: auto; right: calc(100% + 5px); }
}
@media (min-width: 601px) and (max-width: 1100px) {
  .activity-map:not(.assistant-map) .activity-step:nth-child(3) { grid-area: 2 / 2; }
  .activity-map:not(.assistant-map) .activity-step:nth-child(4) { grid-area: 2 / 1; }
  .activity-map:not(.assistant-map) .activity-step:nth-child(5) { grid-area: 3 / 1; }
  .activity-map:not(.assistant-map) .activity-step:nth-child(6) { grid-area: 3 / 2; }
  .activity-map:not(.assistant-map) .activity-step:nth-child(7) { grid-area: 4 / 2; }
  .activity-map:not(.assistant-map) .activity-step:nth-child(8) { grid-area: 4 / 1; }
  .activity-map:not(.assistant-map) .activity-step:nth-child(3)::after,
  .activity-map:not(.assistant-map) .activity-step:nth-child(7)::after { content: '←'; left: auto; right: calc(100% + 5px); }
}

@media (min-width: 1101px) {
  .assistant-map .is-agent::after { content: ''; width: 1px; height: 16px; background: #cbb7de; left: 50%; top: 100%; transform: none; }
  .assistant-map .is-support:not(:last-child)::after { display: block; content: ''; position: absolute; top: -16px; left: 50%; width: calc(100% + 26px); height: 1px; background: #cbb7de; transform: none; }
}

@media (min-width: 1101px) {
  .assistant-map .is-support:nth-child(3n + 1)::after { display: none; }
}
