/* agentmap.css -- the agent grid on the left of the Agents tab (S-0000-0342, DEC-0000-0140).
 * All sizes and colours from core.css' variables, no own hex. Shape: a bar with per-status
 * filter chips (also the counts), then a sticky-header scrollable grid; the conversation of
 * the selected agent is the right half of the tab (e6a.css). */

.agm-panel {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
}

.agm-bar {
  flex: none;
  display: flex;
  align-items: center;
  height: var(--row-h);
  padding: 0 8px;
  border-bottom: 1px solid var(--rule);
  gap: 8px;
}

.agm-counts { display: flex; gap: 4px; overflow-x: auto; }

.agm-count {
  font-size: calc(var(--ui-fs) * 11 / 13);
  color: var(--text-dim);
  padding: 1px 8px;
  border-radius: 10px;
  border: 1px solid transparent;
  cursor: pointer;
  white-space: nowrap;
}
.agm-count:hover { border-color: var(--rule); }
.agm-count.on { background: var(--surface2); color: var(--text); border-color: var(--rule); }
.agm-count-waiting.on { color: var(--attn); }
.agm-count-failed.on  { color: var(--danger-tx); }
.agm-count-done.on    { color: var(--ok); }

.agm-gridwrap {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: auto;
  /* SMOOTH SCROLLING WITH HUNDREDS OF ROWS (S-0000-0342): contain:strict per row
   * (below) plus this scroll container is what keeps a few hundred rows from repainting
   * on every scroll tick -- see agentmap.js' file header for the measurement that says a
   * virtual/windowed scroller is not needed at this codebase's row counts. */
  scrollbar-gutter: stable;
}

.agm-grid {
  min-width: 760px;
  display: flex;
  flex-direction: column;
}

/* ---- rows: one flex row per record, grid-like fixed column widths ---------------------- */

.agm-row {
  display: flex;
  align-items: center;
  min-height: var(--row-h);
  font-size: var(--ui-fs);
}

/* STICKY HEADER (S-0000-0342: "scrollbaar bij honderden rijen"): stays put while the body
 * scrolls underneath it, inside .agm-gridwrap. */
.agm-head {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--surface2);
  border-bottom: 1px solid var(--rule);
  font-size: calc(var(--ui-fs) * 11 / 13);
  color: var(--text-dim);
  font-weight: 600;
}
.agm-h {
  padding: 4px 8px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  user-select: none;
}
.agm-h[role="button"] { cursor: pointer; }
.agm-h[role="button"]:hover { color: var(--text); }
.agm-h:focus { outline: none; color: var(--focus); }
.agm-h-sort { color: var(--text); }
.agm-h-arrow { margin-left: 4px; font-size: calc(var(--ui-fs) * 9 / 13); }

.agm-body-row {
  cursor: pointer;
  padding-right: 4px;
  border-bottom: 1px solid transparent;
  /* CONTAIN: STRICT keeps a few hundred rows from repainting the whole grid on a hover or
   * a re-render, the same fix noted in e4b.js's console (12.1ms -> 2.3ms per that file's
   * own comment) -- an agent map is exactly the case that comment warns about: it is the
   * view meant to stay usable at hundreds of rows. */
  contain: strict;
  height: var(--row-h);
}
.agm-body-row:hover { background: var(--hover); }
.agm-body-row.on { background: var(--accent); color: var(--accent-tx); }
.agm-body-row.agm-root { font-weight: 600; cursor: default; background: var(--surface2); }
.agm-body-row.agm-root:hover { background: var(--surface2); }
.agm-body-row:focus { outline: none; box-shadow: inset 0 0 0 1px var(--focus); }

/* ---- columns: fixed widths so the header stays aligned with the body ------------------- */

.agm-c-status  { flex: none; width: 128px; display: flex; align-items: center; gap: 6px; padding: 0 8px; }
.agm-c-agent   { flex: none; width: 96px; padding: 0 8px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.agm-c-profile { flex: none; width: 110px; padding: 0 8px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-dim); }
.agm-c-ticket  { flex: none; width: 96px; padding: 0 8px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.agm-c-task    { flex: 1 1 auto; min-width: 120px; padding: 0 8px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.agm-c-engine  { flex: none; width: 150px; padding: 0 8px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-dim); font-size: calc(var(--ui-fs) * 11 / 13); }
.agm-c-ms      { flex: none; width: 64px; padding: 0 8px; text-align: right; color: var(--text-dim); font-size: calc(var(--ui-fs) * 11 / 13); }
.agm-c-tok     { flex: none; width: 128px; padding: 0 8px; text-align: right; color: var(--text-dim); font-size: calc(var(--ui-fs) * 11 / 13); }

.agm-body-row.on .agm-c-profile,
.agm-body-row.on .agm-c-engine,
.agm-body-row.on .agm-c-ms,
.agm-body-row.on .agm-c-tok {
  color: var(--accent-tx); opacity: .85;
}

/* ---- the status LED: colour plus a text tooltip, so colour is never the only signal ---- */

.agm-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--text-dim); }
.agm-dot-running { background: var(--ok); animation: agm-pulse 1.4s ease-in-out infinite; }
.agm-dot-waiting { background: var(--attn); }
.agm-dot-recovering { background: var(--attn); animation: agm-pulse 0.8s ease-in-out infinite; }
.agm-dot-failed  { background: var(--danger); }
.agm-dot-done    { background: var(--text-dim); }
.agm-dot-root    { background: var(--text-dim); }

@keyframes agm-pulse {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 var(--ok); }
  50% { opacity: .55; box-shadow: 0 0 0 3px transparent; }
}
@media (prefers-reduced-motion: reduce) {
  .agm-dot-running, .agm-dot-recovering { animation: none; }
}

.agm-status-text { font-size: calc(var(--ui-fs) * 11 / 13); color: var(--text-dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.agm-body-row.on .agm-status-text { color: var(--accent-tx); opacity: .85; }

.agm-label { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.agm-ticket-link { color: var(--link, var(--accent)); text-decoration: none; }
.agm-ticket-link:hover { text-decoration: underline; }
.agm-body-row.on .agm-ticket-link { color: inherit; }

.agm-empty { padding: 8px; color: var(--text-dim); font-size: var(--ui-fs); }

/* S-0000-0422: the rows of the map are text (label, ticket, task) -- selectable; the
 * header cells (.agm-h) stay controls */
.agm-grid .agm-row { -webkit-user-select: text; user-select: text; }
