/* Agent streams (Agent Streams S1): the owner's page (/@person/agents/<id>) and the embed (/embed/agent/<id>).
   Theme tokens only, so both follow the person's chosen look. */
.agent-page { max-width: 1180px; margin: 0 auto; padding: 20px 16px 56px; }
.agent-head { display: flex; flex-direction: column; gap: 4px; margin-bottom: 16px; }
.agent-label { align-self: flex-start; padding: 2px 10px; border: 1px solid var(--accent, #7c5cff); border-radius: 999px; color: var(--accent, #7c5cff); font-size: 0.75rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; }
.agent-title { margin: 0; font-size: clamp(1.4rem, 1.1rem + 1.2vw, 2rem); font-weight: 800; letter-spacing: -0.02em; overflow-wrap: anywhere; }
.agent-task { margin: 0; color: var(--text-secondary); font-size: 0.92rem; overflow-wrap: anywhere; }
.agent-task a { color: var(--accent); }
.agent-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 18px; }
@media (min-width: 900px) { .agent-layout { grid-template-columns: minmax(0, 1fr) 300px; align-items: start; } }
.agent-main { min-width: 0; }
.agent-stage { position: relative; aspect-ratio: 16 / 9; width: 100%; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: #0b0d10; }
.agent-stage video, .agent-stage img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #0b0d10; }
.agent-stage video { display: block; }
.agent-stage img[hidden], .agent-stage video[hidden] { display: none; }
/* The overlay always says whose stream this is, in the player's corner (the design's rule). */
.agent-player-label { position: absolute; top: 10px; left: 10px; z-index: 5; background: rgba(7, 8, 10, 0.82); border-color: rgba(255, 255, 255, 0.26); color: #cfc7ff; }
.agent-state { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; padding: 16px; color: #e8eaed; font-size: 0.95rem; text-align: center; background: rgba(11, 13, 16, 0.72); z-index: 2; }
.agent-state[hidden] { display: none; }
.agent-curtain { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: #07080a; color: #cfd3d8; font-size: clamp(1rem, 0.9rem + 0.6vw, 1.3rem); font-weight: 600; letter-spacing: 0.02em; z-index: 4; }
.agent-curtain[hidden] { display: none; }
.agent-status-line { margin: 10px 0 0; color: var(--text-secondary); font-size: 0.88rem; }
.agent-status-line.is-live { color: var(--live-red-text, var(--live-red, #e0245e)); font-weight: 700; }
.agent-side { padding: 16px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-card); display: flex; flex-direction: column; gap: 12px; }
.agent-side[hidden] { display: none; }
.agent-side-title { margin: 0; font-size: 0.95rem; font-weight: 700; }
.agent-field { display: flex; flex-direction: column; gap: 6px; }
.agent-field-label { font-size: 0.8rem; color: var(--text-muted); }
.agent-note { margin: 0; color: var(--text-muted); font-size: 0.78rem; }
.agent-select { width: 100%; padding: 9px 10px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-secondary); color: var(--text-primary); font: inherit; }
.agent-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.agent-actions .btn { flex: 1 1 auto; }
.agent-actions .btn[hidden] { display: none; }
.agent-hint { margin: 0; color: var(--text-muted); font-size: 0.8rem; overflow-wrap: anywhere; }
.agent-confirm { display: flex; flex-direction: column; gap: 8px; padding: 10px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-secondary); }
.agent-confirm[hidden] { display: none; }
.agent-confirm-text { margin: 0; font-size: 0.85rem; color: var(--text-primary); }

/* The embed: the player is the page. The picture is contained in its own 16:9 tile, centred; the tile is the only
   thing painted, so there are no wide empty sides — the host page shows through around it. The label sits on the
   picture's corner, the viewer count in the other, the curtain over both. */
.agent-embed { margin: 0; background: transparent; color: #e8eaed; font: 13px system-ui, -apple-system, "Segoe UI", sans-serif; }
.agent-embed[hidden] { display: none; }
.agent-embed-frame { display: flex; flex-direction: column; height: 100vh; min-height: 120px; }
.agent-embed-stage { position: relative; flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; }
.agent-embed-media { position: relative; width: min(100%, calc(100vh * 16 / 9)); aspect-ratio: 16 / 9; background: #0b0d10; border-radius: 10px; overflow: hidden; }
.agent-embed-media video, .agent-embed-media img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #0b0d10; }
.agent-embed-media img[hidden], .agent-embed-media video[hidden] { display: none; }
.agent-embed-label { position: absolute; top: 8px; left: 8px; z-index: 5; padding: 1px 8px; font-size: 0.64rem; color: #cfc7ff; border-color: rgba(255, 255, 255, 0.26); background: rgba(7, 8, 10, 0.82); }
.agent-embed-title { position: absolute; top: 10px; left: 78px; right: 8px; z-index: 2; font-weight: 600; font-size: 0.78rem; color: #eef1f5; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8); }
.agent-embed-viewers { position: absolute; right: 8px; bottom: 8px; z-index: 3; padding: 1px 7px; border-radius: 999px; background: rgba(7, 8, 10, 0.78); color: #aeb4bb; font-size: 0.68rem; white-space: nowrap; }
.agent-embed-viewers[hidden] { display: none; }
.agent-embed .agent-embed-state { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: #cfd3d8; background: rgba(11, 13, 16, 0.7); text-align: center; padding: 12px; z-index: 2; }
.agent-embed .agent-embed-state[hidden] { display: none; }
.agent-embed .agent-embed-curtain { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: #07080a; color: #cfd3d8; font-weight: 600; z-index: 4; }
.agent-embed .agent-embed-curtain[hidden] { display: none; }

/* ── The overlay (S2): the band the player draws from the steps feed, never burned into the video ───────────────── */
.agent-overlay { position: absolute; left: 0; right: 0; bottom: 0; z-index: 6; display: flex; flex-direction: column; gap: 2px; padding: 8px 12px 9px; color: #f1f3f5; background: linear-gradient(to top, rgba(5, 6, 8, 0.94), rgba(5, 6, 8, 0.78) 70%, rgba(5, 6, 8, 0)); font-size: 0.82rem; line-height: 1.35; text-shadow: 0 1px 2px rgba(0, 0, 0, 0.7); }
.agent-overlay[hidden] { display: none; }
.agent-overlay-body { display: flex; flex-direction: column; gap: 3px; min-width: 0; padding-right: 26px; }
.agent-overlay-task { margin: 0; font-weight: 700; font-size: 0.8rem; color: #d9dde2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.agent-overlay-step { margin: 0; display: flex; align-items: center; gap: 7px; min-width: 0; }
.agent-overlay-step-title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.agent-overlay-dot { flex: 0 0 auto; width: 8px; height: 8px; border-radius: 50%; background: #6b7280; box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.12); }
.agent-overlay-dot.is-started { background: #3b82f6; animation: agent-overlay-pulse 1.6s ease-in-out infinite; }
.agent-overlay-dot.is-passed { background: #22c55e; }
.agent-overlay-dot.is-failed { background: #ef4444; }
.agent-overlay-dot.is-skipped { background: #94a3b8; }
@keyframes agent-overlay-pulse { 50% { opacity: 0.45; } }
@media (prefers-reduced-motion: reduce) { .agent-overlay-dot.is-started { animation: none; } }
.agent-overlay-ticks { display: flex; gap: 3px; align-items: center; margin-top: 3px; min-height: 10px; }
.agent-overlay-ticks[hidden] { display: none; }
.agent-overlay-tick { width: 12px; height: 8px; padding: 0; border: 0; border-radius: 2px; background: #4b5563; cursor: pointer; opacity: 0.85; }
.agent-overlay-tick.is-started { background: #3b82f6; }
.agent-overlay-tick.is-passed { background: #22c55e; }
.agent-overlay-tick.is-failed { background: #ef4444; }
.agent-overlay-tick.is-skipped { background: #94a3b8; }
.agent-overlay-tick:hover, .agent-overlay-tick.is-open { opacity: 1; transform: scaleY(1.35); }
.agent-overlay-foot { margin: 1px 0 0; display: flex; flex-wrap: wrap; gap: 4px 12px; color: #c3c8ce; font-size: 0.74rem; }
/* S4: the caption under the step: the line the agent is saying right now. */
.agent-overlay-caption { margin: 0; color: #f3f4f6; font-size: 0.8rem; font-style: italic; line-height: 1.25; }
.agent-overlay-caption[hidden] { display: none; }
/* S4: the voice label in the overlay's foot: which voice is speaking, and in which personality. */
.agent-overlay-voice { color: #cfc7ff; font-weight: 600; }
.agent-overlay-queue { margin: 2px 0 0; font-size: .82rem; color: #e8e2ff; }
.agent-overlay-queue[hidden] { display: none; }
.agent-overlay-queue-list { margin: 6px 0 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 4px; }
.agent-overlay-queue-list[hidden] { display: none; }
.agent-overlay-queue-row { display: flex; align-items: baseline; gap: 8px; font-size: .82rem; }
.agent-overlay-queue-place { color: #cfc7ff; font-weight: 600; }
.agent-overlay-queue-text { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.agent-overlay-queue-votes { color: var(--text-secondary, #96a7c2); white-space: nowrap; }
.agent-overlay-voice[hidden] { display: none; }
.agent-overlay-caption::before { content: '\201C'; }
.agent-overlay-caption::after { content: '\201D'; }
.agent-overlay-foot span[hidden] { display: none; }
.agent-overlay-tests { color: #e5e7eb; }
.agent-overlay-fold { position: absolute; right: 6px; bottom: 8px; width: 26px; height: 26px; padding: 0; border: 1px solid rgba(255, 255, 255, 0.22); border-radius: 7px; background: rgba(10, 12, 16, 0.8); color: #e5e7eb; cursor: pointer; font-size: 0.7rem; }
.agent-overlay.is-folded { padding-top: 6px; }
.agent-overlay.is-folded .agent-overlay-task,
.agent-overlay.is-folded .agent-overlay-ticks,
.agent-overlay.is-folded .agent-overlay-foot { display: none; }
.agent-overlay.is-folded .agent-overlay-body { padding-right: 32px; }
.agent-overlay-sheet { position: absolute; left: 8px; right: 8px; bottom: 42px; max-height: 50vh; overflow: auto; padding: 8px 10px; border: 1px solid rgba(255, 255, 255, 0.2); border-radius: 10px; background: rgba(8, 10, 14, 0.97); }
.agent-overlay-sheet[hidden] { display: none; }
.agent-overlay-sheet-list { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 6px; }
.agent-overlay-sheet-row { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; padding-left: 8px; border-left: 3px solid #6b7280; }
.agent-overlay-sheet-row.is-started { border-left-color: #3b82f6; }
.agent-overlay-sheet-row.is-passed { border-left-color: #22c55e; }
.agent-overlay-sheet-row.is-failed { border-left-color: #ef4444; }
.agent-overlay-sheet-title { font-weight: 600; }
.agent-overlay-sheet-status { color: #9aa1a9; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.05em; }
.agent-overlay-sheet-detail { grid-column: 1 / -1; color: #aeb4bb; font-size: 0.76rem; }
/* Phone: the band is one line; tapping it opens the sheet (the design's rule). */
@media (max-width: 640px) {
    .agent-overlay { padding: 6px 8px; font-size: 0.76rem; }
    .agent-overlay-task, .agent-overlay-ticks, .agent-overlay-foot { display: none; }
    .agent-overlay-caption { font-size: 0.76rem; }
    .agent-overlay-body { padding-right: 30px; }
}

/* ── Chapters and highlights under the player (S2) ─────────────────────────────────────────────── */
.agent-chapters { margin: 16px 0 0; padding: 14px 16px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-card); }
.agent-chapters[hidden] { display: none; }
.agent-chapters-title { margin: 0 0 4px; font-size: 0.95rem; font-weight: 700; }
.agent-chapters-hint { margin: 0 0 10px; color: var(--text-muted); font-size: 0.8rem; }
.agent-chapter-list { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 2px; max-height: 320px; overflow: auto; }
.agent-chapter { display: flex; align-items: baseline; gap: 10px; padding: 6px 4px; border-radius: 6px; }
.agent-chapter:hover { background: var(--bg-secondary); }
.agent-chapter-time { flex: 0 0 auto; color: var(--accent); font-variant-numeric: tabular-nums; font-size: 0.8rem; font-weight: 700; }
.agent-chapter-title { min-width: 0; overflow-wrap: anywhere; font-size: 0.86rem; }
.agent-highlights { margin: 12px 0 0; }
.agent-highlights-title { margin: 0 0 6px; font-size: 0.85rem; font-weight: 700; }
.agent-highlight { display: flex; align-items: center; gap: 8px; padding: 4px 0; }
.agent-highlight-title { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; font-size: 0.84rem; }
.agent-highlight-status { font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; }
.agent-highlight-status.is-failed { color: #ef4444; }
.agent-highlight-status.is-passed { color: #22c55e; }
.agent-clip-btn { flex: 0 0 auto; }
.agent-recording { margin: 10px 0 0; font-size: 0.84rem; }
.agent-recording a { color: var(--accent); }

/* ── Cards (the Agents tab and the "Agents live" row) ─────────────────────────────────────────── */
.agent-card { display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-card); overflow: hidden; color: var(--text-primary); text-decoration: none; }
.agent-card:hover { border-color: var(--border-light); }
.agent-card-media { position: relative; aspect-ratio: 16 / 9; background: #0b0d10; }
.agent-card-media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.agent-card-media .agent-card-noimg { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: #7c848d; font-size: 0.78rem; }
.agent-card-media .agent-label { position: absolute; top: 8px; left: 8px; background: rgba(7, 8, 10, 0.82); color: #cfc7ff; }
.agent-card-live { position: absolute; top: 8px; right: 8px; padding: 1px 8px; border-radius: 999px; background: var(--live-red, #e0245e); color: #fff; font-size: 0.66rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.05em; }
.agent-card-body { display: flex; flex-direction: column; gap: 4px; padding: 10px 12px 12px; }
.agent-card-title { margin: 0; font-size: 0.92rem; font-weight: 700; overflow-wrap: anywhere; }
.agent-card-task { margin: 0; color: var(--text-muted); font-size: 0.78rem; overflow-wrap: anywhere; }
.agent-card-meta { margin: 0; color: var(--text-secondary); font-size: 0.76rem; display: flex; flex-wrap: wrap; gap: 2px 8px; }
.agent-card-meta .is-failed { color: #ef4444; }
.agent-card-meta .is-passed { color: #22c55e; }
.agent-card-link { margin-top: 2px; font-size: 0.78rem; color: var(--accent); }
.agent-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.agent-more { margin-top: 12px; }
.agent-empty { margin: 0; color: var(--text-muted); font-size: 0.88rem; }

/* The "Agents live" row on Live's home: its own row, after people's streams, never mixed into them. */
.home-agents { margin-top: 28px; }
.home-agents[hidden] { display: none; }
.home-agents-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.home-agents-title { margin: 0; font-size: 1.05rem; font-weight: 800; }
.home-agents-note { color: var(--text-muted); font-size: 0.78rem; }
.home-agents .agent-cards { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }

/* S5: the moderators' bar and the paused line (Agent Streams S5). */
.agent-controls { margin: 0 0 12px; padding: 10px 12px; border: 1px solid var(--border, rgba(255,255,255,.12)); border-radius: 12px;
    background: var(--bg-card, rgba(18,24,38,.72)); }
.agent-controls-title { margin: 0 0 8px; font-size: .8rem; letter-spacing: .06em; text-transform: uppercase; color: var(--text-secondary, #96a7c2); }
.agent-controls-row { display: flex; flex-wrap: wrap; gap: 8px; }
.agent-controls-row .btn { min-height: 44px; }
.agent-controls-log { margin-top: 8px; }
.agent-controls-log summary { cursor: pointer; color: var(--text-secondary, #96a7c2); font-size: .85rem; }
.agent-controls-log-list { margin: 6px 0 0; padding-left: 18px; font-size: .85rem; color: var(--text-secondary, #96a7c2); }
.agent-overlay-paused { margin: 2px 0 0; font-size: .8rem; font-weight: 600; color: var(--warning-text, #fbbf24); }
@media (max-width: 480px) { .agent-controls-row .btn { flex: 1 1 calc(50% - 8px); } }


/* ── S7: the robot camera as a second scene, and the scheduled cards ──────────────────────────── */
.agent-scenes { display: flex; gap: 6px; margin: 10px 0 0; }
.agent-scene { padding: 6px 12px; border-radius: 999px; border: 1px solid var(--ov-border, #2a3140); background: var(--ov-surface, #121722); color: var(--ov-text, #e6e9ef); font: inherit; cursor: pointer; }
.agent-scene.is-on { background: var(--ov-accent, #6ea8fe); color: #06101f; border-color: transparent; }
.agent-robot { position: relative; aspect-ratio: 16 / 9; border-radius: 14px; overflow: hidden; background: #000; margin-top: 10px; }
.agent-robot iframe { width: 100%; height: 100%; border: 0; display: block; }
.agent-schedules { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; margin: 0 0 16px; }
.agent-schedules-title { margin: 18px 0 10px; font-size: 1rem; }
.agent-schedule-card { display: flex; flex-direction: column; gap: 5px; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--ov-border, #2a3140); background: var(--ov-surface, #121722); color: inherit; text-decoration: none; }
.agent-schedule-card:hover { border-color: var(--ov-accent, #6ea8fe); }
.agent-schedule-when { font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; opacity: .8; }
.agent-schedule-title { font-size: .98rem; line-height: 1.25; }
.agent-schedule-task, .agent-schedule-meta { font-size: .82rem; opacity: .8; }
@media (max-width: 640px) { .agent-scene { min-height: 44px; } }
