/* ─────────────────────────────────────────────────────────────
   CapraSEO — Agents dashboard refinement (calm / premium pass)

   ADDITIVE + FULLY REVERSIBLE. Loaded LAST on /agents/ (after
   main.css → account.css → health.css → agents.css → chip-select.css)
   and every rule is scoped to body[data-page="agents"], so it restyles
   ONLY the Agents board and never leaks into other pages that share
   .card / .btn / .agent-icon / .ac-health.

   ► Turn OFF:  remove the single <link> to this file in agents/index.html.
   ► Tune it:   edit the --rf-* token block below.

   This pass follows the reference layout the user provided
   (the shared "Agents.dc.html" design — Linear-style dark cards,
   bordered status pills, larger accent icon tiles, mono numerals,
   generous vertical rhythm). Two deliberate deviations from that file:
     • Fonts stay Inter / JetBrains Mono (the reference's Geist would
       require bundling external font files).
     • Accent stays the app token --accent (var(--accent)); the reference's
       #5E6AD2 is near-identical and --accent is shared with the sidebar
       across every page, so per-page changes would desync nav highlights.

   Polish only — no layout, structure, copy, or hierarchy changes.
   ───────────────────────────────────────────────────────────── */

body[data-page="agents"] {
  /* Radius scale (from the reference) */
  /* Kept in step with theme.css's global scale (tightened 2026-07-27).
     This block has higher specificity than theme.css, so leaving it behind
     would make /agents/ the one page still on the old rounder language. */
  --rf-r-card:    14px;   /* agent cards */
  --rf-r-panel:   12px;   /* empty-state panels */
  --rf-r-control:  6px;   /* buttons */
  --rf-r-input:    6px;   /* search + tabs pill */
  --rf-r-chip:     6px;   /* icon tiles */

  /* Vertical rhythm — tightened for the single-board layout (KPI strip +
     toolbar + one table read as one composition, not four islands). */
  --rf-gap: 26px;         /* between stacked sections */

  /* Surfaces: solid, slightly-cool dark cards lifted by shadow, not lines */
  --rf-card-bg: linear-gradient(180deg, #121317 0%, #0D0D11 100%);
  --rf-line: rgba(var(--wash-rgb), 0.06);
  --rf-elev:
    inset 0 1px 0 rgba(var(--wash-rgb), 0.04),
    0 26px 64px -34px rgba(0, 0, 0, 0.95);
  --rf-elev-hover:
    inset 0 1px 0 rgba(var(--wash-rgb), 0.05),
    0 30px 70px -32px rgba(0, 0, 0, 0.98);

  --rf-mono: 'JetBrains Mono', ui-monospace, monospace;

  /* Text ramp (near-monochrome, cool) */
  --rf-title: #F0F0F1;
  --rf-body:  #8B8B92;
  --rf-sub:   #83838B;
}

/* ── Header — bigger title, airier subtitle, more top breathing room ──
   Actions top-align with the title line (like /health/), never centred
   against the whole header block — a centred cluster floats awkwardly
   beside a multi-line subtitle. */
body[data-page="agents"] .stage-top { padding: 40px 48px 20px; align-items: flex-start; }
body[data-page="agents"] .stage-top > div:first-child { flex: 1 1 auto; min-width: 0; }
body[data-page="agents"] .stage-top-right { margin-top: 3px; }
body[data-page="agents"] .stage-title { font-size: 25px; letter-spacing: -0.025em; }
body[data-page="agents"] .stage-subtitle {
  font-size: 15px;
  line-height: 1.6;
  color: var(--rf-body);
  max-width: 640px;
}

/* ── Vertical rhythm + roomier gutters for the scroll column ── */
body[data-page="agents"] .center.center-scroll {
  padding: 0 48px 80px;
  gap: var(--rf-gap);
}
body[data-page="agents"] .agents-done { margin-top: 18px; }

/* Padded regions inside the real (chromed) pick / form cards. The list
   "cards" (#agents-list-card etc.) stay chromeless by their ID rule. */
body[data-page="agents"] .card { border-radius: var(--rf-r-card); }
body[data-page="agents"] .card-head { padding: 22px 26px; }
body[data-page="agents"] .agent-form { padding: 22px 26px 26px; }

/* ── Section headings + count badge ───────────────────────────── */
body[data-page="agents"] .card-head h2 {
  font-size: 19px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--rf-title);
}
body[data-page="agents"] .card-head .card-sub {
  font-size: 13.5px;
  line-height: 1.5;
  color: #7C7C84;
}
body[data-page="agents"] .section-count {
  font-family: var(--rf-mono);
  font-size: 11.5px;
  font-weight: 500;
  color: #9A9AA2;
  background: rgba(var(--wash-rgb), 0.05);
  border: 1px solid rgba(var(--wash-rgb), 0.07);
  border-radius: 7px;
  padding: 2px 8px;
}

/* ── The agent card — Linear-style dark surface, depth by shadow ── */
body[data-page="agents"] .agent-card {
  padding: 26px;
  border-radius: var(--rf-r-card);
  background: var(--rf-card-bg);
  border: 1px solid var(--rf-line);
  box-shadow: var(--rf-elev);
}
/* Calm hover: brighten the edge + deepen the shadow, no lift. */
body[data-page="agents"] a.agent-card:hover,
body[data-page="agents"] a.agent-card:focus-visible {
  transform: none;
  border-color: rgba(var(--wash-rgb), 0.14);
  box-shadow: var(--rf-elev-hover);
}
/* Top row: icon tile far-left, status pill far-right (reference layout). */
body[data-page="agents"] .ac-top { justify-content: space-between; }
body[data-page="agents"] .ac-top .ac-health { margin-left: 0; }
/* The hover chevron would collide with the status pill now living top-right;
   the reference has no chevron on these cards, so drop it (keep it on the
   compact completed rows). */
body[data-page="agents"] .agent-card:not(.agent-card--row) .ac-go { display: none; }

/* Card title + doing line. */
body[data-page="agents"] .ac-name {
  margin-top: 20px;
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.3;
  color: var(--rf-title);
}
body[data-page="agents"] .ac-doing {
  margin-top: 7px;
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--rf-sub);
}
/* Progress: slightly taller track, mono fraction. */
body[data-page="agents"] .ac-progress { padding-top: 18px; gap: 14px; }
body[data-page="agents"] .ac-bar { height: 5px; }
body[data-page="agents"] .ac-frac { font-family: var(--rf-mono); font-size: 13px; }

/* ── Status: a bordered neutral pill, colour lives only in the dot ── */
body[data-page="agents"] .ac-health {
  gap: 7px;
  padding: 4px 10px 4px 8px;
  border-radius: 999px;
  background: rgba(var(--wash-rgb), 0.04);
  border: 1px solid rgba(var(--wash-rgb), 0.08);
  color: #AEAEB4;
  font-size: 12px;
}
body[data-page="agents"] .ac-health .ac-dot { box-shadow: none; }
body[data-page="agents"] .ac-health.good .ac-dot      { background: #5C9C7B; }
body[data-page="agents"] .ac-health.attention .ac-dot { background: #B0924E; }
body[data-page="agents"] .ac-health.starting .ac-dot  { background: var(--accent-bright); }
body[data-page="agents"] .ac-health.paused .ac-dot,
body[data-page="agents"] .ac-health.done .ac-dot      { background: #65656C; }

/* Colour-tinted pills to match the shared mock: a live agent's whole pill
   takes its status hue, not just the dot. Kept desaturated for dark per the
   dark-theme rules; Paused/Done stay on the neutral base above, exactly like
   the mock. Overrides the neutral bg/border/color set on .ac-health. */
body[data-page="agents"] .ac-health.good {
  color: #8ac6a6;
  background: rgba(92, 156, 123, 0.12);
  border-color: rgba(92, 156, 123, 0.30);
}
body[data-page="agents"] .ac-health.attention {
  color: #cfb47c;
  background: rgba(176, 146, 78, 0.12);
  border-color: rgba(176, 146, 78, 0.30);
}
body[data-page="agents"] .ac-health.starting {
  color: var(--accent-bright);
  background: var(--accent-faint);
  border-color: rgba(var(--accent-rgb), 0.30);
}

/* ── Icon tile — larger, accent-tinted for content agents ───────── */
body[data-page="agents"] .agent-icon {
  width: 42px; height: 42px;
  border-radius: var(--rf-r-chip);
  border-color: var(--rf-line);
}
body[data-page="agents"] .agent-icon svg { width: 19px; height: 19px; }
body[data-page="agents"] .agent-icon.content {
  background: rgba(var(--accent-rgb), 0.14);
  border-color: rgba(var(--accent-rgb), 0.24);
}

/* ── Completed rows stay flat + quiet (history, not live tiles) ──── */
body[data-page="agents"] .agent-card--row {
  padding: 12px 16px;
  border-radius: var(--rf-r-control);
  background: rgba(var(--wash-rgb), 0.02);
  border-color: var(--rf-line);
  box-shadow: none;
}
body[data-page="agents"] .agent-card--row .ac-name { font-size: 14.5px; margin-top: 0; }

/* ── Empty-state panels (video / link) — soft, spacious ─────────── */
body[data-page="agents"] .agent-intro {
  gap: 22px;
  padding: 26px 28px;
  border-radius: var(--rf-r-panel);
  border-color: rgba(var(--wash-rgb), 0.07);
}
body[data-page="agents"] .agent-intro .agent-icon { width: 46px; height: 46px; border-radius: 14px; }
body[data-page="agents"] .agent-intro .agent-icon svg { width: 20px; height: 20px; }
body[data-page="agents"] .agent-intro .ai-text { font-size: 13.5px; line-height: 1.6; }

/* ── Controls: search, tabs pill, primary CTA ──────────────────── */
/* The toolbar is the table card's own header bar: tabs left, a quiet
   compact search right, one hairline separating it from the column head.
   Everything sits directly on the card surface — the tabs pill keeps its
   own inset track, the search drops its box until focused. */
body[data-page="agents"] .agents-table .agents-toolbar {
  margin: 0;
  padding: 12px 14px;
  gap: 16px;
  border-bottom: 1px solid var(--rf-line);
}
body[data-page="agents"] .agents-search { max-width: 250px; flex: 0 1 250px; }
body[data-page="agents"] .agents-search input {
  height: 34px;
  border-radius: var(--rf-r-input);
  font-size: 13px;
  background: rgba(var(--wash-rgb), 0.02);
  border-color: rgba(var(--wash-rgb), 0.05);
}
body[data-page="agents"] .agents-search input:hover { border-color: rgba(var(--wash-rgb), 0.10); }
body[data-page="agents"] .agents-search input:focus { border-color: rgba(var(--accent-rgb), 0.5); }

body[data-page="agents"] .agents-tabs {
  padding: 3px;
  border-radius: var(--rf-r-input);
  background: rgba(var(--wash-rgb), 0.03);
  border-color: rgba(var(--wash-rgb), 0.05);
}
body[data-page="agents"] .agents-tab {
  height: 28px;
  padding: 0 14px;
  border: 1px solid transparent;   /* reserve the active border so tabs don't shift */
  border-radius: 8px;
  font-size: 12.5px;
}
body[data-page="agents"] .agents-tab.is-active {
  background: linear-gradient(180deg, rgba(var(--accent-rgb), 0.30), rgba(var(--accent-rgb), 0.15));
  border-color: rgba(var(--accent-rgb), 0.34);
  color: var(--lt2);
  box-shadow: inset 0 1px 0 rgba(var(--wash-rgb), 0.08);
}

body[data-page="agents"] .btn { border-radius: var(--rf-r-control); }

/* ── Header actions + autopilot badge ──────────────────────────────
   The three creation actions live in .stage-top-right (base layout from
   health.css; stage-condense collapses them to icon buttons for free). */
body[data-page="agents"] .stage-top-right { flex: none; }
body[data-page="agents"] .stage-top-right .btn { white-space: nowrap; }
/* The 15px subtitle can wrap to 2 lines beside the actions — main.css's
   3em condense reserve would clip a third; give it room (and restate the
   condensed collapse, which this rule outranks). */
body[data-page="agents"] .stage-top.condense-ready .stage-subtitle { max-height: 5.2em; }
body[data-page="agents"] .stage-top.condense-ready.is-condensed .stage-subtitle { max-height: 0; }

/* Same collapse-to-icon discipline as /health/'s header tools: below
   1180px the two secondary actions shed their labels into 28px round icon
   buttons (font-size:0 keeps the text for screen readers and the data-tip
   tooltip); the primary "New agent" keeps its label until phone width.
   On scroll, stage-condense's own .is-condensed rules take over — same
   26px circles as every other page. */
@media (max-width: 1180px) {
  body[data-page="agents"] .stage-top-right .btn:not(.primary) {
    font-size: 0; gap: 0; padding: 0; min-width: 0;
    width: 28px; height: 28px; border-radius: 50%;
    justify-content: center; flex: none;
  }
  body[data-page="agents"] .stage-top-right .btn:not(.primary) svg { width: 14px; height: 14px; }
}
@media (max-width: 640px) {
  body[data-page="agents"] .stage-top-right .btn.primary {
    font-size: 0; gap: 0; padding: 0; min-width: 0;
    width: 28px; height: 28px; border-radius: 50%;
    justify-content: center; flex: none;
  }
  body[data-page="agents"] .stage-top-right .btn.primary svg { width: 14px; height: 14px; }
}

/* (The "Autopilot active" title badge was removed 2026-08-15 — running-agent
   state lives in the sidebar's nav count and the RUNNING KPI cell; the
   setup guide re-opens from the header gear icon or the SETUP cell.) */

/* ── KPI strip — five flat cells on one card surface ───────────────
   Typography borrowed from health.css's .kpi-label/.kpi-value language
   (mono uppercase eyebrow + big numeral); the surface is one bordered
   card with hairline separators, not five floating cards. Cell hairlines
   are box-shadows so they survive the responsive re-wrap (the container's
   overflow clips the outer edges). */
body[data-page="agents"] .agents-kpis {
  background: var(--rf-card-bg);
  border: 1px solid var(--rf-line);
  border-radius: var(--rf-r-card);
  box-shadow: var(--rf-elev);
  overflow: hidden;
  /* The section is the size container; the grid lives on the inner .kpi-row
     (a container query can't restyle the container element itself). */
  container: agents-kpis / inline-size;
}
body[data-page="agents"] .agents-kpis[hidden] { display: none; }
body[data-page="agents"] .agents-kpis .kpi-row {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
}
body[data-page="agents"] .agents-kpis .kpi-cell {
  min-width: 0;
  padding: 18px 22px 16px;
  box-shadow: -1px 0 0 var(--rf-line), 0 -1px 0 var(--rf-line);
}
body[data-page="agents"] .agents-kpis .kpi-label {
  font-family: var(--rf-mono);
  font-size: 9.5px;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted-2);
}
body[data-page="agents"] .agents-kpis .kpi-value {
  margin-top: 9px;
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--rf-title);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
body[data-page="agents"] .agents-kpis .kpi-value small {
  font-size: 12.5px;
  font-weight: 500;
  letter-spacing: 0;
  color: var(--rf-sub);
}
body[data-page="agents"] .agents-kpis .kpi-sub {
  margin-top: 3px;
  font-size: 11.5px;
  color: var(--rf-sub);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
body[data-page="agents"] .agents-kpis .kpi-cell--setup {
  cursor: pointer;
  transition: background 160ms ease;
}
body[data-page="agents"] .agents-kpis .kpi-cell--setup:hover { background: rgba(var(--wash-rgb), 0.03); }
@container agents-kpis (max-width: 719px) {
  body[data-page="agents"] .agents-kpis .kpi-cell { padding: 14px 18px 12px; }
}
@container agents-kpis (max-width: 899px) {
  body[data-page="agents"] .agents-kpis .kpi-row { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@container agents-kpis (max-width: 619px) {
  body[data-page="agents"] .agents-kpis .kpi-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Form inputs pick up the same softer radius. */
body[data-page="agents"] .af-input { border-radius: var(--rf-r-control); }

/* ── The agents table — one board, all three kinds ─────────────────
   The three renderers (agents.js / video-agents-page.js /
   link-agents-page.js) keep their own .agent-list containers, stacked
   inside one .agents-table card under a single column-header row.
   Alignment across containers is guaranteed by the shared --agrid
   template (all columns fixed except the name's 1fr).
   The board is a size container so the columns respond to the actual
   center width (the askbar rail squeezes it independently of the
   viewport). Grid templates live on descendants (.agents-table-head /
   .agent-row), never on the container itself. */
body[data-page="agents"] .agents-board {
  container: agents-board / inline-size;
}
/* The column template lives on DESCENDANTS of the container (.agents-table
   and .agents-done) — a container query cannot restyle the container
   element itself, so setting --agrid on .agents-board would make the
   responsive overrides below silently no-ops. */
body[data-page="agents"] .agents-table,
body[data-page="agents"] .agents-done {
  /* Agent | Status | Next run | Tokens | actions — the Progress and Trend
     columns were dropped 2026-08-18 (mostly em dashes across the mixed
     board; progress rides the meta line now). The name column has a real
     floor so rows overflow into a horizontal scroll instead of crushing
     names to one letter. */
  --agrid: minmax(180px, 1fr) 132px 100px 90px 112px;
}
body[data-page="agents"] .agents-table {
  background: var(--rf-card-bg);
  border: 1px solid var(--rf-line);
  border-radius: var(--rf-r-card);
  box-shadow: var(--rf-elev);
  /* Scroll, never clip: when the columns' floor exceeds the board width the
     rows scroll sideways inside the card (the toolbar pins via sticky). */
  overflow-x: auto;
  overflow-y: hidden;
}
body[data-page="agents"] .agents-table .agents-toolbar { position: sticky; left: 0; }
body[data-page="agents"] .agents-table-head,
body[data-page="agents"] .agent-row {
  display: grid;
  grid-template-columns: var(--agrid);
  align-items: center;
  column-gap: 14px;
  padding: 0 22px;
}
body[data-page="agents"] .agents-table-head {
  height: 40px;
  font-family: var(--rf-mono);
  font-size: 9.5px;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted-2);
}
body[data-page="agents"] .agents-table-head span:last-child { text-align: right; }
body[data-page="agents"] .agents-table-head .ath-tokens { text-align: right; }
body[data-page="agents"] .agents-table.is-empty .agents-table-head { display: none; }
/* The lists become plain stacks — the card grid is gone on this page. */
body[data-page="agents"] .agents-table .agent-list { display: block; }
body[data-page="agents"] .agent-list[hidden] { display: none; }
body[data-page="agents"] .agents-table .agent-empty { padding: 26px; text-align: center; color: var(--muted-2); }

/* A row. Every row draws its own top hairline: under the head, between
   rows, and between the stacked containers — the card's own edge closes
   the bottom, so no last-child bookkeeping across hidden containers. */
body[data-page="agents"] .agent-row {
  position: relative;
  min-height: 68px;
  padding-top: 13px;
  padding-bottom: 13px;
  border-top: 1px solid var(--rf-line);
  color: inherit;
  text-decoration: none;
  transition: background 140ms ease;
}
body[data-page="agents"] a.agent-row:hover,
body[data-page="agents"] a.agent-row:focus-visible {
  background: rgba(var(--wash-rgb), 0.025);
}
body[data-page="agents"] .ar-main { display: flex; align-items: center; gap: 14px; min-width: 0; }
body[data-page="agents"] .agent-row .agent-icon { width: 36px; height: 36px; }
body[data-page="agents"] .agent-row .agent-icon svg { width: 17px; height: 17px; }
body[data-page="agents"] .ar-text { min-width: 0; }
body[data-page="agents"] .ar-name {
  display: block;
  font-size: 14.5px;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.35;
  color: var(--rf-title);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
body[data-page="agents"] .ar-meta {
  display: block;
  margin-top: 3px;
  font-size: 12.5px;
  line-height: 1.45;
  color: var(--rf-sub);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
body[data-page="agents"] .ar-meta .ar-err { color: var(--danger); }
/* The consented data-spend fact keeps its gold — it must stay scannable
   (the user agreed to it; it reads as a fact, not a warning). */
body[data-page="agents"] .ar-meta .ar-buys { color: var(--gold); }
body[data-page="agents"] .ar-status { min-width: 0; }
body[data-page="agents"] .ar-progress { display: flex; align-items: center; gap: 12px; min-width: 0; }
body[data-page="agents"] .ar-progress .ac-bar { flex: 1 1 auto; height: 4px; }
body[data-page="agents"] .ar-progress .ac-frac { font-family: var(--rf-mono); font-size: 12px; }
body[data-page="agents"] .ar-next { font-size: 13px; color: var(--rf-body); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
body[data-page="agents"] .ar-tokens {
  font-family: var(--rf-mono);
  font-size: 12.5px;
  text-align: right;
  color: var(--rf-body);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
body[data-page="agents"] .ar-end { display: flex; align-items: center; justify-content: flex-end; min-width: 0; }
/* Content rows: the whole row is the link; the chevron fades in on hover. */
body[data-page="agents"] .agent-row .ac-go {
  position: static;
  display: inline-flex;
  color: var(--accent-bright);
  opacity: 0;
  transform: translateX(-4px);
  transition: opacity 160ms ease, transform 160ms ease;
}
body[data-page="agents"] a.agent-row:hover .ac-go,
body[data-page="agents"] a.agent-row:focus-visible .ac-go { opacity: 1; transform: translateX(0); }
/* Video/link rows: Edit / Pause / Delete slide in over the row's right
   side on hover (they don't fit a fixed column). Solid backing so the
   figures underneath never bleed through the buttons. */
body[data-page="agents"] .agent-row .ar-actions {
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 6px 6px 34px;
  background: linear-gradient(to right, rgba(15, 15, 19, 0) 0, #0F0F13 28px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 140ms ease;
}
body[data-page="agents"] .agent-row:hover .ar-actions,
body[data-page="agents"] .agent-row:focus-within .ar-actions {
  opacity: 1;
  pointer-events: auto;
}
@media (hover: none) {
  body[data-page="agents"] .agent-row .ar-actions {
    position: static;
    transform: none;
    opacity: 1;
    pointer-events: auto;
    background: none;
    padding: 0;
  }
}

/* Ghost rows — agent kinds not set up yet: quiet, dashed data, one green
   setup link. Never a big intro panel. */
body[data-page="agents"] .agent-row--ghost .ar-name { color: var(--muted); font-weight: 500; }
body[data-page="agents"] .agent-row--ghost .agent-icon { opacity: 0.55; }
body[data-page="agents"] .agent-row--ghost .ar-meta { color: var(--muted-2); }
body[data-page="agents"] .ar-dash { color: var(--muted-3, #4c4e62); font-size: 13px; }
body[data-page="agents"] .ar-progress.ar-dash,
body[data-page="agents"] .ar-next.ar-dash { display: block; }
body[data-page="agents"] .ar-tokens.ar-dash { text-align: right; }
body[data-page="agents"] .ar-setup-link {
  display: inline-flex;
  align-items: center;
  border: 0;
  padding: 0;
  background: none;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  color: var(--accent-text, var(--accent-bright));
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
}
body[data-page="agents"] .ar-setup-link:hover { text-decoration: underline; }
body[data-page="agents"] .ar-setup-link:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

/* The Completed group is content-typed — the Video/Link tabs hide it
   (class owned by agents-filter.js; `hidden` stays owned by agents.js). */
body[data-page="agents"] .agents-done.filtered-out { display: none; }

/* Completed agents live below the table as quiet history rows. */
body[data-page="agents"] .agents-done-list .agent-row {
  border: 1px solid var(--rf-line);
  border-radius: 10px;
  background: rgba(var(--wash-rgb), 0.02);
  margin-top: 8px;
  min-height: 52px;
  padding-top: 8px;
  padding-bottom: 8px;
}

/* Column collapse as the board narrows (askbar open, small windows).
   Hidden cells and their head labels must drop together with the
   template change — grid auto-placement fills tracks in DOM order. */
@container agents-board (max-width: 719px) {
  /* Next run is the first to go — name, status and cost survive longer. */
  body[data-page="agents"] .agents-table,
  body[data-page="agents"] .agents-done { --agrid: minmax(180px, 1fr) 132px 90px 112px; }
  body[data-page="agents"] .agents-table-head span:nth-child(3),
  body[data-page="agents"] .agent-row .ar-next { display: none; }
}
@container agents-board (max-width: 559px) {
  body[data-page="agents"] .agents-table,
  body[data-page="agents"] .agents-done { --agrid: minmax(0, 1fr) auto; }
  body[data-page="agents"] .agents-table-head,
  body[data-page="agents"] .agent-row .ar-next,
  body[data-page="agents"] .agent-row .ar-tokens,
  body[data-page="agents"] .agent-row .ac-go { display: none; }
  /* Anything left in the end cell (setup link, touch actions) gets its
     own line under the name/status pair. */
  body[data-page="agents"] .agent-row .ar-end { grid-column: 1 / -1; justify-content: flex-start; padding-left: 50px; }
  body[data-page="agents"] .agent-row .ar-end:empty,
  body[data-page="agents"] a.agent-row .ar-end { display: none; }
}

/* ── Film grain (DESIGN.md §7) ──────────────────────────────────────
   A fixed, non-interactive noise layer at ~2.5% so the dark gradients read
   as textured, not flat/banded. Static (not animated) to stay calm. Scoped
   to /agents/ and reversible with the rest of this file. z-index sits well
   below the edit modal (z-index:100) and pointer-events:none, so it never
   blocks a click or muddies the modal. */
body[data-page="agents"]::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 4;
  pointer-events: none;
  opacity: 0.025;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ── Mobile: the tabs pill can't fit four segments at phone width ──
   Full-width, horizontally scrollable segmented control — labels never
   wrap, the pill never clips mid-letter, scrollbar hidden. The creation
   actions live in the page header (.stage-top-right) at every width. */
@media (max-width: 640px) {
  body[data-page="agents"] .agents-search { max-width: none; flex: 1 1 100%; }
  body[data-page="agents"] .agents-tabs {
    display: flex;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  body[data-page="agents"] .agents-tabs::-webkit-scrollbar { display: none; }
  body[data-page="agents"] .agents-tab {
    white-space: nowrap;
    flex: 0 0 auto;
    padding: 0 12px;
  }
}

/* (The Trend sparkline column was dropped 2026-08-18 with the board
   tightening pass — its data still reaches #ai-context for the askbar.) */

/* Attention dot on a social agent's row: N posts wait for the owner on
   /social-media/ (the strips that used to render under the row moved
   there). Gold = "needs you", matching the attention health hue. */
body[data-page="agents"] .ar-attn {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: rgba(176, 146, 78, 0.16);
  border: 1px solid rgba(176, 146, 78, 0.35);
  color: #cfb47c;
  font-size: 11px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  transition: background 140ms ease, border-color 140ms ease;
}
body[data-page="agents"] .ar-attn:hover {
  background: rgba(176, 146, 78, 0.26);
  border-color: rgba(176, 146, 78, 0.55);
}
body[data-page="agents"] .ar-attn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
