/* "Ao vivo" (H23): the grid of live sessions and the screen of one session. Uses the tokens of
   panel.css (docs/design/panel-DESIGN.md): light background, navy and cyan, no fake terminal.
   The only motion is the live dot's pulse, and only with motion allowed. */

/* Grid */
.live-task { display: flex; flex-direction: column; gap: 12px; padding: 16px; border: 1px solid var(--border); border-radius: var(--r-card); background: var(--surface); min-width: 0; }
.live-task-head { display: flex; align-items: baseline; justify-content: space-between; gap: 6px 16px; flex-wrap: wrap; }
.live-task-title { display: flex; align-items: baseline; gap: 8px; min-width: 0; overflow-wrap: anywhere; }
.live-id { font: 500 12px/1.4 var(--font-mono); color: var(--text-3); }
.live-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
button.live-card { display: flex; flex-direction: column; align-items: stretch; justify-content: flex-start; gap: 8px; height: auto; min-width: 0; padding: 12px 14px; border: 1px solid var(--border); border-left: 4px solid var(--border-strong); border-radius: var(--r-card); background: var(--surface); color: var(--text); text-align: left; white-space: normal; font-weight: 400; }
button.live-card:hover { background: var(--surface-2); border-color: var(--border-strong); }
button.live-card.tone-live { border-left-color: var(--detail); }
button.live-card.tone-stale { border-left-color: var(--needs-bar); }
.live-card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.live-card-head strong { font-weight: 600; font-size: 14px; }
.live-card-foot { display: flex; justify-content: flex-end; }
.live-state { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; line-height: 1.4; color: var(--text-2); }
.live-state.on { color: var(--info); }
.live-state.stale { color: var(--needs); }
.live-state.off { color: var(--text-3); }
.live-lines { display: block; padding: 6px 8px; border-radius: 6px; background: var(--surface-2); color: var(--text-2); font: 400 12px/1.55 var(--font-mono); font-variant-numeric: tabular-nums; min-width: 0; }
.live-line { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.live-line.is-error { color: var(--err); }

/* The state dot: cyan while live, amber when the stream stopped, hollow otherwise. */
.live-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; display: inline-block; background: var(--text-3); }
.live-dot.on { background: var(--detail); }
.live-dot.warn { background: var(--needs-bar); }
.live-dot.off { background: none; border: 1px solid var(--text-3); }
@media (prefers-reduced-motion: no-preference) {
  @keyframes live-pulse { 50% { opacity: .3; } }
  .live-dot.on.pulse { animation: live-pulse 1.4s ease-in-out infinite; }
}

/* Session screen */
.live-bar { display: flex; align-items: center; gap: 8px; }
.live-screen-head { display: flex; flex-direction: column; gap: 6px; }
.live-screen-meta { display: flex; align-items: center; gap: 8px 16px; flex-wrap: wrap; }
.live-screen { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 24px; align-items: start; }
.live-main { display: flex; flex-direction: column; gap: 8px; min-width: 0; position: relative; }
.live-timeline { max-height: 70vh; overflow: auto; border: 1px solid var(--border); border-radius: var(--r-card); background: var(--surface); padding: 6px 0; }
.live-timeline:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.live-ev { display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 10px; padding: 6px 14px; font-size: 14px; line-height: 1.45; }
.live-ev + .live-ev { border-top: 1px solid var(--surface-3); }
.live-ev.nested { padding-left: 40px; background: var(--surface-2); }
.live-ev.is-error .live-tool-line { color: var(--err); }
.live-time { font: 400 12px/1.7 var(--font-mono); color: var(--text-3); font-variant-numeric: tabular-nums; }
.live-ev-body { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.live-who { font: 500 11px/1.4 var(--font-mono); letter-spacing: .08em; text-transform: uppercase; color: var(--text-3); }
.live-ev.user .live-who { color: var(--link); }
.live-text { white-space: pre-wrap; overflow-wrap: anywhere; color: var(--text); }
.live-text.muted, .live-quiet { color: var(--text-3); font-size: 13px; }
.live-milestone { font-size: 13px; color: var(--text-2); }
.live-ev.milestone { background: var(--accent-soft); }
.live-marks { font-size: 12px; color: var(--needs); }
.live-timeline details { border: 0; border-radius: 0; background: none; }
.live-timeline summary { cursor: pointer; display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.live-tool-line { font: 400 13px/1.5 var(--font-mono); color: var(--text); overflow-wrap: anywhere; }
.live-outcome { font-size: 12px; font-weight: 500; }
.live-outcome.ok { color: var(--ok); } .live-outcome.err { color: var(--err); } .live-outcome.running { color: var(--info); }
.live-tool-result { padding-top: 6px; display: flex; flex-direction: column; gap: 4px; }
.live-tool-result pre { max-height: 320px; font-size: 12px; }
.live-thinking summary { color: var(--text-3); font-size: 13px; }
.live-gap { display: flex; align-items: center; gap: 10px; padding: 8px 14px; font-size: 12px; color: var(--text-3); }
.live-gap::before, .live-gap::after { content: ""; flex: 1; border-top: 1px dashed var(--border-strong); }
.live-jump { position: absolute; right: 16px; bottom: 12px; box-shadow: var(--shadow-float); }
.live-timeline-status { padding: 4px 0; }

/* Side: commands, slot swap, flush */
.live-side { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.live-side-card { padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; }
details.live-side-card > summary { cursor: pointer; font-weight: 600; font-size: 14px; }
details.live-side-card[open] { gap: 10px; }
details.live-side-card[open] > * + * { margin-top: 10px; }
.live-field { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--text-2); }
.live-field textarea, .live-field input, .live-field select { width: 100%; }
.live-actions { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.live-buttons { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.live-counter { font-variant-numeric: tabular-nums; }
.live-error { font-size: 13px; color: var(--err); }
.live-trail { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.live-trail li { display: flex; flex-direction: column; gap: 4px; padding: 8px 0; border-top: 1px solid var(--surface-3); font-size: 13px; }
.live-trail-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.live-trail-kind { color: var(--text-2); font-variant-numeric: tabular-nums; }
.live-trail-text { white-space: pre-wrap; overflow-wrap: anywhere; color: var(--text); }
.live-queued { color: var(--needs); font-size: 12px; }
.live-reconf { display: flex; flex-direction: column; gap: 10px; }
.live-steps { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 8px; font-size: 13px; color: var(--text-2); }
.live-steps li { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.live-reauth .link { font-size: 13px; }

@media (max-width: 960px) {
  .live-screen { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 760px) {
  .live-cards { grid-template-columns: minmax(0, 1fr); }
  .live-ev { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .live-ev.nested { padding-left: 24px; }
  .live-timeline { max-height: 60vh; }
}
