/* /agents/ — content automation agents. Reuses the shared card / form
   primitives from main.css + health.css; this file only adds the agent
   form layout and the agent-list rows. */

/* The form body and list rows sit directly under .card-head, which is the only
   padded region of a .card — so give them the same horizontal inset (20px) as
   the head, otherwise their content runs flush to the card edges. */
.agent-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 18px 20px 20px;
}
.af-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1 1 0;
}
.af-row {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}
.af-label {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
}
.af-tpl-link {
  font-size: 11.5px;
  font-weight: 500;
  color: var(--positive);
  text-decoration: none;
}
.af-tpl-link:hover { text-decoration: underline; }
/* Bootstrap-style input group: the help button is attached to the right of
   the play picker so the two read as one control. The select is enhanced by
   chip-select (js/chip-select.js) into a .chip-select.form-dd that lands here
   in the select's place; we flatten the adjoining corners to fuse them. */
.af-input-group {
  display: flex;
  align-items: stretch;
}
.af-input-group .chip-select.form-dd {
  flex: 1 1 auto;
  width: auto;
  min-width: 0;
}
.af-input-group .chip-select .chip {
  border-radius: 10px 0 0 10px;
}
.af-help-btn {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  height: 36px;
  padding: 0 12px;
  margin-left: -1px; /* collapse the shared 1px border into one divider */
  background: rgba(var(--well-rgb), var(--well-a22));
  border: 1px solid rgba(var(--wash-rgb), 0.10);
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
  border-top-right-radius: 10px;
  border-bottom-right-radius: 10px;
  color: var(--positive);
  font: 500 12.5px 'Inter', sans-serif;
  white-space: nowrap;
  cursor: pointer;
  transition: border-color 0.16s ease, background 0.16s ease, color 0.16s ease;
}
.af-help-btn:hover {
  border-color: rgba(var(--wash-rgb), 0.20);
  background: rgba(var(--well-rgb), var(--well-a30));
  color: var(--positive);
}

/* "What should it do?" help modal — scoped here because settings.css
   (home of the shared .smodal styles) isn't loaded on /agents/. */
.af-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 24px;
  animation: afModalIn 0.18s ease-out;
}
.af-modal[hidden] { display: none; }
@keyframes afModalIn { from { opacity: 0; } to { opacity: 1; } }
.af-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(var(--dk3-rgb), 0.62);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.af-modal-card {
  position: relative;
  width: min(520px, 100%);
  max-height: 90vh;
  overflow-y: auto;
  padding: 26px 26px 22px;
  background: linear-gradient(180deg, rgba(var(--glass-hi-rgb),0.96), rgba(var(--glass-lo-rgb),0.96));
  border: 1px solid rgba(var(--wash-rgb), 0.08);
  border-radius: 14px;
  box-shadow:
    0 30px 60px -16px rgba(0,0,0,0.7),
    inset 0 1px 0 rgba(var(--wash-rgb), 0.04);
  animation: afModalCardIn 0.22s cubic-bezier(0.22, 1, 0.36, 1);
}
@keyframes afModalCardIn {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.af-modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  background: transparent;
  border: 0;
  border-radius: 8px;
  color: rgba(var(--grey-rgb),0.55);
  cursor: pointer;
  transition: background 150ms cubic-bezier(0.4, 0, 0.2, 1), color 150ms cubic-bezier(0.4, 0, 0.2, 1);
}
.af-modal-close:hover { background: rgba(var(--wash-rgb), 0.05); color: var(--text); }
.af-modal-title {
  margin: 0 0 4px 0;
  font-size: 17px;
  font-weight: 500;
  color: var(--text-hi);
  letter-spacing: -0.01em;
}
.af-modal-sub {
  margin: 0 0 18px 0;
  font-size: 13px;
  line-height: 1.5;
  color: var(--muted);
}
.af-help-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 15px;
}
.af-help-list li {
  display: flex;
  gap: 11px;
  align-items: flex-start;
}
.af-help-list .agent-icon { flex: 0 0 auto; margin-top: 1px; }
.af-help-list strong {
  display: block;
  margin-bottom: 2px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}
.af-help-list p {
  margin: 0;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--muted);
}
.af-help-list em {
  font-style: normal;
  color: var(--lt1);
}
.af-input {
  width: 100%;
  box-sizing: border-box;
  padding: 9px 11px;
  font-size: 13.5px;
  font-family: inherit;
  color: var(--text);
  background: rgba(var(--wash-rgb), 0.03);
  border: 1px solid rgba(var(--wash-rgb), 0.12);
  border-radius: 10px;
}
/* Native <select> renders its popup in the OS theme; force a dark control +
   dark option list (mirrors css/keywords.css .kw-sel select) and draw our own
   chevron so it reads correctly in dark mode across browsers. */
select.af-input {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  cursor: pointer;
  padding-right: 32px;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='%238a8a92' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'><path d='M6 9l6 6 6-6'/></svg>");
  background-repeat: no-repeat;
  background-position: right 11px center;
}
select.af-input option,
select.af-input optgroup {
  background: var(--ctl-2);
  color: var(--text-1);
}
.af-input:focus {
  outline: none;
  border-color: rgba(129, 140, 248, 0.5);
  box-shadow: 0 0 0 3px var(--accent-faint);
}
.af-textarea { resize: vertical; line-height: 1.5; }
.af-num { width: 84px; flex: 0 0 auto; }

.af-count {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.af-count-unit { font-size: 13px; color: var(--muted); }
.af-radio {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  cursor: pointer;
}
.af-radio-block { margin-top: 8px; }

/* Featured-image block */
.af-image {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 14px;
  border: 1px solid rgba(var(--wash-rgb), 0.08);
  border-radius: 10px;
  background: rgba(var(--wash-rgb), 0.02);
}
.af-toggle {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  cursor: pointer;
}
.af-toggle input { margin-top: 2px; flex: 0 0 auto; }
.af-toggle-text { display: flex; flex-direction: column; gap: 2px; }
.af-toggle-label { font-size: 13px; font-weight: 500; color: var(--text); }
.af-toggle-sub { font-size: 12px; color: var(--muted); }
.af-image-note { width: 100%; flex-basis: 100%; margin: 10px 0 0; font-size: 12px; line-height: 1.5; color: var(--muted); }
.af-image-note strong { color: var(--text); font-weight: 600; }
.af-image-opts { margin: 0; }
.af-image-opts[hidden] { display: none; }

.af-estimate {
  margin: 2px 0 0;
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.5;
}
.af-estimate strong { color: var(--positive); }

/* Publication step status line (under the destination picker). */
.af-publish-status {
  margin: 6px 0 0;
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.5;
}
.af-publish-status.warn { color: var(--gold); }
.af-publish-status a { color: inherit; font-weight: 500; text-decoration: underline; }
.af-publish-status strong { color: var(--text); font-weight: 600; }
/* Small footnote spelling out the domain's draft/live setting + where to
   change it. Sits just under the status line, quieter than it. */
.af-publish-note {
  display: block;
  margin-top: 4px;
  font-size: 11.5px;
  color: var(--muted-2);
  line-height: 1.45;
}

.af-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}
.af-status { font-size: 12.5px; color: var(--muted); }
.af-status.ok { color: var(--positive); }
.af-status.danger { color: var(--danger); }

/* ── agent list ─────────────────────────────────────────────────── */
.agent-empty {
  padding: 18px 20px;
  font-size: 13px;
  color: var(--muted);
}
/* Status pill on the /agent/?id= header (js/agent-detail.js). */
.ag-pill {
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 2px 8px;
  border-radius: 999px;
}
.ag-pill.active { color: var(--accent-bright); background: var(--accent-faint); }
.ag-pill.paused { color: var(--gold); background: rgba(230, 196, 122, 0.12); }
.ag-pill.done { color: var(--muted); background: rgba(148, 163, 184, 0.16); }

/* ── /agent/?id= — the dedicated agent page ─────────────────────── */

/* Header: identity + status + live progress. */
.ad-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 22px 24px;
}
.ad-head > .agent-icon { margin-top: 3px; }
.ad-head > .agent-icon[hidden] { display: none; }
.ad-identity { flex: 1 1 auto; min-width: 0; }
.ad-name {
  margin: 0;
  font-size: 22px;
  font-weight: 600;
  line-height: 1.2;
  word-break: break-word;
}
.ad-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 9px;
}
.ad-progress {
  flex: 0 0 auto;
  text-align: right;
}
.ad-progress-num {
  font-size: 22px;
  font-weight: 600;
  color: var(--positive);
}
.ad-progress-label {
  margin-top: 2px;
  font-size: 11.5px;
  color: var(--muted);
}
.ad-head .ag-error { margin-top: 8px; }

/* "What this agent does": one labeled row per setting, with a plain-language
   note explaining what it means — this is the breathing room the overview lacks. */
.ad-spec {
  display: flex;
  flex-direction: column;
}
.ad-spec-row {
  display: grid;
  grid-template-columns: 150px 1fr;
  gap: 6px 18px;
  padding: 14px 0;
  border-top: 1px solid rgba(var(--wash-rgb), 0.06);
}
.ad-spec-row:first-child { border-top: none; }
.ad-spec-label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted);
  padding-top: 1px;
}
.ad-spec-value { font-size: 13.5px; color: var(--text); }
.ad-spec-value strong { color: var(--positive); font-weight: 600; }
.ad-spec-note {
  margin-top: 3px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
}
.ad-spec-link {
  margin-left: 8px;
  font-size: 11.5px;
  font-weight: 500;
  color: var(--positive);
  text-decoration: none;
}
.ad-spec-link:hover { text-decoration: underline; }
.ad-spec-quote {
  margin-top: 4px;
  font-size: 13px;
  color: var(--text);
  font-style: italic;
  opacity: 0.92;
}

@media (max-width: 560px) {
  .ad-spec-row { grid-template-columns: 1fr; }
}

/* Recent output: the agent's latest produced pieces, inline. */
.ad-pieces { display: flex; flex-direction: column; }
.ad-piece {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-top: 1px solid rgba(var(--wash-rgb), 0.06);
  text-decoration: none;
  color: var(--text);
}
/* Featured-image thumb (reuses .ct-thumb from settings.css) — smaller here so
   the compact piece rows stay tight. */
.ad-piece .ct-thumb { width: 60px; border-radius: 6px; }
.ad-piece:first-child { border-top: none; }
.ad-piece:hover .ad-piece-title { color: var(--positive); }
.ad-piece-title {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 13.5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: color 150ms ease;
}
.ad-piece-status {
  flex: 0 0 auto;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}
.ad-piece-status.generating { color: var(--gold); }
.ad-piece-status.done { color: var(--positive); }
/* Featured-image-failed marker on a piece row — danger-toned pill, sits before
   the status so a missing image is visible at a glance. */
.ad-piece-imgfail {
  flex: 0 0 auto;
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--danger);
  background: rgba(255, 122, 122, 0.14);
  padding: 2px 8px;
  border-radius: 999px;
}
.ad-pieces-link {
  flex: 0 0 auto;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--positive);
  text-decoration: none;
}
.ad-pieces-link[hidden] { display: none; }
.ad-pieces-link:hover { text-decoration: underline; }

/* "What this agent does" — collapsed by default, smooth height open. The head
   is a full-width toggle button; the body wrapper animates grid-rows 0fr→1fr. */
.ad-doc-head {
  width: 100%;
  text-align: left;
  background: none;
  border: 0;
  font: inherit;
  cursor: pointer;
}
.ad-doc-card:not(.is-open) .card-head { border-bottom: none; }
.ad-doc-chev {
  color: var(--muted-2);
  font-size: 18px;
  line-height: 1;
  flex: 0 0 auto;
  transition: transform 0.2s ease;
}
.ad-doc-card.is-open .ad-doc-chev { transform: rotate(90deg); }
.ad-doc-collapse {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 240ms ease;
}
.ad-doc-card.is-open .ad-doc-collapse { grid-template-rows: 1fr; }
/* The grid child must be padding-free so its clipped min-height is 0 (else
   0fr floors at the card-body padding and the card never fully collapses).
   Padding lives on the inner .card-body. */
.ad-doc-collapse > .ad-doc-collapse-inner { overflow: hidden; min-height: 0; }

/* Controls: the per-agent actions that used to clutter the overview. */
.ad-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.ad-controls .btn.danger {
  margin-left: auto;
  color: var(--danger);
  border-color: rgba(255, 122, 122, 0.35);
}
.ad-controls .btn.danger:hover { border-color: rgba(255, 122, 122, 0.6); }

@media (max-width: 560px) {
  .ad-controls .btn.danger { margin-left: 0; }
}

/* Edit-modal extras: a labelled checkbox + a read-only bundle note + native
   selects with a dark popup (the default white popup hid the light text). */
.af-check { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--muted); margin: 4px 0 12px; cursor: pointer; }
.af-check input { width: 15px; height: 15px; accent-color: var(--accent); }
.vga-readonly { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted-2); margin: 0 0 14px; }
.vga-readonly strong { color: var(--text); font-weight: 600; }
/* (.vga-select styling comes from select.af-input — same chevron + dark popup.) */

/* ════════════════════════════════════════════════════════════════
   Agents board — card grid, search/filter toolbar, health signals.
   Shared by content cards (js/agents.js) and video cards
   (js/video-agents-page.js): both render `.agent-card`.
   ════════════════════════════════════════════════════════════════ */

/* Search + Content/Video filter toolbar */
.agents-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 14px; margin: 0 0 16px; flex-wrap: wrap;
}
.agents-toolbar[hidden] { display: none; }
.agents-search { position: relative; flex: 1 1 260px; max-width: 420px; display: flex; align-items: center; }
.agents-search svg { position: absolute; left: 12px; width: 15px; height: 15px; color: var(--muted-2); pointer-events: none; }
.agents-search input {
  width: 100%; box-sizing: border-box; height: 38px; padding: 0 12px 0 34px;
  border-radius: 10px; border: 1px solid var(--line); background: rgba(var(--wash-rgb), 0.03);
  color: var(--text); font-family: inherit; font-size: 13px; outline: none;
}
.agents-search input:focus { border-color: rgba(129,140,248,0.5); box-shadow: 0 0 0 3px var(--accent-faint); }
.agents-tabs { display: inline-flex; gap: 2px; padding: 3px; border-radius: 10px; background: rgba(var(--wash-rgb), 0.04); border: 1px solid var(--line); }
.agents-tab { height: 30px; padding: 0 15px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); font-family: inherit; font-size: 12.5px; font-weight: 500; cursor: pointer; transition: background 160ms ease, color 160ms ease; }
.agents-tab:hover { color: var(--text); }
.agents-tab.is-active { background: rgba(99,102,241,0.18); color: var(--accent-bright); }
/* "+ New agent" is the page's one primary action (shared .btn.primary),
   right of the tabs pill and matched to the toolbar's 38px control height. */
.agents-toolbar .btn.primary { height: 38px; }
.agents-noresults { padding: 26px; text-align: center; color: var(--muted-2); font-size: 13px; }
.agents-noresults[hidden] { display: none; }

/* One reading measure for the whole board — full-stage-width sections are why
   two cards used to leave a runway of dead space. */
.agents-toolbar, .agent-pick-card, .agent-form-card,
#agents-list-card, #video-agents-card, #link-agents-card, .agents-noresults {
  width: 100%; max-width: 1160px; margin-left: auto; margin-right: auto;
}

/* Icon tile — the agent's glyph, tinted per agent type. Replaces the emoji
   and the redundant type pill in one element. */
.agent-icon {
  flex: 0 0 auto; width: 34px; height: 34px;
  display: grid; place-items: center;
  border-radius: 10px; border: 1px solid var(--line);
}
.agent-icon.content { color: var(--accent-bright); background: rgba(99,102,241,0.12); }
.agent-icon.video   { color: var(--lt3); background: rgba(217,99,196,0.12); }
.agent-icon.links   { color: #8fe8c2; background: rgba(52,211,153,0.10); }
.agent-icon--sm { width: 26px; height: 26px; border-radius: 8px; }
.agent-icon--sm svg { width: 14px; height: 14px; }
.agent-icon--lg { width: 40px; height: 40px; border-radius: 12px; }
.agent-icon--lg svg { width: 19px; height: 19px; }

/* "What should this agent make?" — the type chooser revealed by + New agent.
   Three big option rows; Content opens the form below, the other two link out
   to where those agents are configured (/ai-videos/, /marketplace/). */
.agent-pick-card[hidden] { display: none; }
.agent-pick-options { display: flex; flex-direction: column; gap: 10px; }
.ap-option {
  display: flex; align-items: center; gap: 16px; width: 100%;
  padding: 16px 18px; border-radius: 12px; box-sizing: border-box;
  border: 1px solid var(--line); background: rgba(var(--wash-rgb), 0.02);
  color: inherit; text-decoration: none; text-align: left;
  font-family: inherit; cursor: pointer;
  transition: border-color 0.15s ease, transform 0.12s ease, background 0.15s ease;
}
.ap-option:hover { transform: translateY(-1px); border-color: rgba(129,140,248,0.45); background: rgba(var(--wash-rgb), 0.04); }
.ap-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.ap-title { font-size: 14px; font-weight: 600; color: var(--text); }
.ap-go { display: inline-flex; color: var(--muted-2); transition: color 160ms ease, transform 160ms ease; }
.ap-option:hover .ap-go { color: var(--accent-bright); transform: translateX(2px); }
.ap-sub { font-size: 12.5px; line-height: 1.45; color: var(--muted); }

/* Card grid */
.agent-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}
.agent-list .agent-empty { grid-column: 1 / -1; padding: 22px; text-align: center; color: var(--muted-2); }

/* Empty-type explainer — a quiet panel shown in place of the cards when a
   section has no agents yet, so a new user learns what each type does.
   NOT an .agent-card (agents-filter.js counts those). */
.agent-intro {
  grid-column: 1 / -1;
  display: flex; align-items: center; gap: 16px;
  padding: 18px 20px; border-radius: 12px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(var(--wash-rgb), 0.022), rgba(var(--wash-rgb), 0.008));
}
.agent-intro .ai-text { flex: 1; min-width: 0; font-size: 12.5px; line-height: 1.5; color: var(--muted); }
.agent-intro .ai-text strong { color: var(--text); font-weight: 600; }
.agent-intro .btn { flex-shrink: 0; }
/* Phones: the icon | text | button row would crush the text into a
   one-word tower — stack it: icon+text read as a block, CTA full-width. */
@media (max-width: 560px) {
  .agent-intro { flex-wrap: wrap; }
  .agent-intro .ai-text { flex: 1 1 calc(100% - 62px); }
  .agent-intro .btn { flex: 1 1 100%; justify-content: center; }
}

/* The card itself (content = <a>, video/link = <div>). Type is carried by the
   icon tile, health by the status dot — no pills. */
.agent-card {
  position: relative;
  display: flex; flex-direction: column;
  padding: 20px 20px 18px; border-radius: 14px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(var(--wash-rgb), 0.022), rgba(var(--wash-rgb), 0.008));
  text-decoration: none; color: inherit;
  transition: border-color 160ms ease, transform 160ms ease, background 160ms ease, box-shadow 160ms ease;
}
a.agent-card { cursor: pointer; }
a.agent-card:hover, a.agent-card:focus-visible {
  transform: translateY(-1px);
  border-color: rgba(var(--wash-rgb), 0.14);
  box-shadow: 0 8px 24px -16px rgba(0,0,0,0.8);
}

.ac-top { display: flex; align-items: center; gap: 10px; }
.ac-top .ac-health { margin-left: 2px; }
/* Status: a small living dot + quiet label. Pulses while producing. */
.ac-health { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 600; white-space: nowrap; }
.ac-health .ac-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; box-shadow: 0 0 5px currentColor; }
.ac-health.good      { color: #7fe3aa; }
.ac-health.attention { color: #ffcf8f; }
.ac-health.paused    { color: var(--muted-2); }
.ac-health.done      { color: var(--muted-2); }
.ac-health.starting  { color: var(--accent-bright); }
.ac-health.paused .ac-dot, .ac-health.done .ac-dot { box-shadow: none; }
.ac-health.good .ac-dot, .ac-health.starting .ac-dot { animation: agents-pulse 2.4s ease-in-out infinite; }
@keyframes agents-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }

.ac-name { margin-top: 14px; font-size: 15px; font-weight: 600; color: var(--text); line-height: 1.35; }
.ac-doing { margin-top: 5px; font-size: 12.5px; color: var(--muted); line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
/* One slim progress row pinned to the card bottom so mixed cards align. */
.ac-progress { margin-top: auto; padding-top: 18px; display: flex; align-items: center; gap: 10px; }
.ac-bar { flex: 1 1 auto; height: 4px; border-radius: 999px; background: rgba(var(--wash-rgb), 0.07); overflow: hidden; }
.ac-bar span { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--accent), var(--accent-bright)); }
.ac-frac { flex: 0 0 auto; font-size: 12px; color: var(--muted-2); font-variant-numeric: tabular-nums; white-space: nowrap; }
.ac-frac strong { color: var(--text); font-weight: 600; }
/* Hover affordance: a chevron that fades in top-right (the whole card is the link). */
.ac-go {
  position: absolute; top: 18px; right: 16px;
  display: inline-flex; color: var(--accent-bright);
  opacity: 0; transform: translateX(-4px);
  transition: opacity 160ms ease, transform 160ms ease;
}
a.agent-card:hover .ac-go, a.agent-card:focus-visible .ac-go { opacity: 1; transform: translateX(0); }
.ag-error { margin-top: 12px; font-size: 11.5px; line-height: 1.4; color: var(--danger); }

/* Completed agents — collapsed below the running ones so the overview stays
   focused on what's live. The grid is hidden until the wrapper is expanded
   (is-open = user toggle, search-open = a search matched a finished agent). */
.agents-done { margin-top: 26px; }
.agents-done[hidden] { display: none; }
.agents-done-toggle {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 2px; border: 0; background: none; cursor: pointer;
  color: var(--muted); font-family: inherit; font-size: 13px; font-weight: 600;
  letter-spacing: 0.01em; transition: color 0.15s ease;
}
.agents-done-toggle:hover { color: var(--text); }
.agents-done-count { color: var(--muted-2); font-weight: 500; }
.agents-done-chev {
  display: inline-block; font-size: 15px; line-height: 1; color: var(--muted-2);
  transition: transform 0.15s ease;
}
.agents-done.is-open .agents-done-chev { transform: rotate(90deg); }
#agent-list-done { display: none; margin-top: 12px; grid-template-columns: 1fr; gap: 8px; }
.agents-done.is-open #agent-list-done,
.agents-done.search-open #agent-list-done { display: grid; }

/* Finished agents are history — one compact row each, not a full card. */
.agent-card--row {
  flex-direction: row; align-items: center; gap: 12px;
  padding: 10px 14px; border-radius: 10px;
}
.agent-card--row .ac-name { margin-top: 0; font-size: 13.5px; flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ac-row-meta { flex: 1 1 auto; min-width: 0; font-size: 12.5px; color: var(--muted-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ac-row-check { flex: 0 0 auto; display: inline-flex; color: var(--muted-2); }
.agent-card--row .ac-go { position: static; margin-left: 2px; transform: none; }
a.agent-card--row:hover, a.agent-card--row:focus-visible { transform: none; box-shadow: none; background: rgba(var(--wash-rgb), 0.035); }
a.agent-card--row:hover .ac-go, a.agent-card--row:focus-visible .ac-go { transform: none; }

/* Video-card extras (it's a div with inline actions, not a link) */
.vga-card .vga-fmt { margin-top: 12px; font-size: 11.5px; color: var(--muted-2); }
.vga-card .vga-next { margin-top: 4px; font-size: 11.5px; color: var(--muted); }
.vga-card.health-paused .vga-next, .vga-card.health-attention .vga-next { color: var(--gold); }
.vga-card .vga-actions { display: flex; gap: 6px; margin-top: 18px; }
.vga-card .vga-actions .btn { height: 30px; padding: 0 12px; font-size: 12px; }
.vga-card .vga-actions .btn.danger { color: var(--danger); border-color: rgba(255,122,122,0.3); }
.vga-card .vga-actions .btn.danger:hover { color: #fff; background: var(--danger); border-color: transparent; }

/* Link-card extras (a div with inline actions, like the video card) */
.lka-card .lka-actions { display: flex; gap: 6px; margin-top: 18px; }
.lka-card .lka-actions .btn { height: 30px; padding: 0 12px; font-size: 12px; text-decoration: none; }
.lka-card .lka-actions .btn.danger { color: var(--danger); border-color: rgba(255,122,122,0.3); }
.lka-card .lka-actions .btn.danger:hover { color: #fff; background: var(--danger); border-color: transparent; }

/* Section headers carry a small total-count badge (set by each renderer). */
.section-count {
  margin-left: 8px; font-size: 11px; font-weight: 600; color: var(--muted);
  background: rgba(var(--wash-rgb), 0.06); border: 1px solid var(--line);
  padding: 1px 8px; border-radius: 999px; vertical-align: 2px;
}
.section-count[hidden] { display: none; }

/* Drop the outer panel around the agent LISTS — a card full of cards reads
   as too much chrome. Keep just the heading + the card grid; the create-form
   card (#agent-form-card) stays a panel. The .center-scroll gap is the
   section rhythm — no extra margin. */
#agents-list-card, #video-agents-card, #link-agents-card {
  background: none; border: none; border-radius: 0;
  box-shadow: none; backdrop-filter: none; -webkit-backdrop-filter: none;
  overflow: visible; padding: 0; margin-bottom: 0;
}
#agents-list-card .card-head, #video-agents-card .card-head, #link-agents-card .card-head {
  padding: 0 2px 2px; border-bottom: none; margin-bottom: 10px;
}

@media (prefers-reduced-motion: reduce) {
  .ac-health .ac-dot { animation: none; }
  .agent-card, .ac-go, .ap-option, .ap-go, .agents-done-chev { transition: none; }
  a.agent-card:hover, a.agent-card:focus-visible, .ap-option:hover { transform: none; }
}
