/* agents section — section_agents: grant builder + install command (.agb/.aga-)
   on the left, scripted chat (.agc-) on the right. Built on the paper-terminal
   tokens in app.css; nothing here redefines them. */

/* ---------- two-column body: builder + command left, chat right ---------- */

.aga-grid {
  display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
  gap: 20px; align-items: start;
}
.aga-grid > * { min-width: 0; }
.aga-left { display: grid; gap: 14px; }

/* ---------- grant builder (.agb) ---------- */

.agb { padding: 16px 18px; display: grid; gap: 14px; }
.agb-row { display: grid; gap: 8px; }
.agb-label { font: 500 11.5px var(--mono); color: var(--muted); letter-spacing: .03em; }
.agb-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.agb-chip {
  margin: 0; padding: 4px 12px; cursor: pointer;
  font: 500 12px var(--mono); color: var(--muted);
  background: #fff; border: 1px solid var(--border); border-radius: 999px;
}
.agb-chip:hover { background: #fff; border-color: var(--muted); color: var(--fg); }
.agb-chip.agb-on {
  color: var(--accent); border-color: var(--accent);
  background: rgba(23,107,74,.08);
}
.agb-chip.agb-locked {
  display: inline-flex; align-items: center; gap: 6px; cursor: default;
  color: var(--down); border-color: rgba(162,50,50,.35);
  background: rgba(162,50,50,.06);
}
.agb-chip.agb-locked svg { flex: none; }

/* ---------- install-artifact card (mini term window) ---------- */

.aga-card {
  background: #23231F; border: 1px solid #33332D; border-radius: 14px;
  box-shadow: 0 1px 2px rgba(38,38,34,.06), 0 14px 40px rgba(38,38,34,.16);
  overflow: visible;
}
.aga-card-head {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px 8px 16px; background: #2C2C27;
  border-bottom: 1px solid #33332D; border-radius: 13px 13px 0 0;
}
.aga-file { flex: 1; min-width: 0; font: 500 12px var(--mono); color: #8F8D84; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.aga-client-picker { position: relative; flex: none; }
.aga-client-trigger, .aga-client-option {
  display: flex; align-items: center; gap: 7px; font: 500 11.5px var(--mono); color: #B9B7AE;
}
.aga-client-trigger {
  min-width: 135px; padding: 4px 9px; background: #2C2C27; border: 1px solid #4A4942;
  border-radius: 7px; cursor: pointer; text-align: left;
}
.aga-client-trigger:hover, .aga-client-trigger[aria-expanded="true"] { border-color: #6A6962; color: #D9D7CF; }
.aga-client-trigger:focus { outline: none; }
.aga-client-trigger:focus-visible { border-color: #7BC4A0; }
.aga-client-trigger img, .aga-client-option img { width: 13px; height: 13px; object-fit: contain; flex: none; }
.aga-client-trigger img[src$="codex.svg"], .aga-client-option img[src$="codex.svg"] { filter: invert(1); }
.aga-client-trigger img[src$="openclaw.svg"], .aga-client-option img[src$="openclaw.svg"] { width: 14px; height: 14px; margin: -.5px; }
.aga-client-trigger span { flex: 1; }
.aga-client-trigger i { width: 0; height: 0; border-left: 4px solid transparent; border-right: 4px solid transparent; border-top: 5px solid #8F8D84; }
.aga-client-menu {
  position: absolute; z-index: 3; top: calc(100% + 6px); left: 0; min-width: 176px; padding: 4px;
  background: #2C2C27; border: 1px solid #4A4942; border-radius: 8px;
  box-shadow: 0 12px 24px rgba(0,0,0,.28);
}
.aga-client-option { width: 100%; padding: 6px 7px; background: transparent; border: 0; border-radius: 5px; cursor: pointer; text-align: left; }
.aga-client-option:hover, .aga-client-option.aga-client-selected { background: rgba(255,255,255,.07); color: #F1EFE8; }
.aga-copy {
  font: 500 11.5px var(--mono); color: #B9B7AE;
  background: transparent; border: 1px solid #4A4942; border-radius: 7px;
  padding: 4px 12px; cursor: pointer; flex: none;
}
.aga-copy:hover { background: rgba(255,255,255,.04); border-color: #6A6962; color: #D9D7CF; }
.aga-copy.aga-copied { color: #7BC4A0; border-color: #7BC4A0; }
.aga-card .code {
  background: transparent; color: #D9D7CF;
  border: 0; border-radius: 0; padding: 16px; font-size: 12.5px;
  white-space: pre-wrap; overflow-wrap: anywhere;
}
.aga-card .code .aga-b { font-weight: 700; color: #F1EFE8; }
.aga-card .code .aga-flashing { border-radius: 3px; animation: aga-flash .7s ease-out; }
@keyframes aga-flash {
  from { background: rgba(123,196,160,.32); }
  to   { background: transparent; }
}
@media (prefers-reduced-motion: reduce) {
  .aga-card .code .aga-flashing { animation: none; }
}

/* ---------- chat app (.agc) ----------
   A chat-app frame: app bar with the client name and connection status,
   right-aligned user bubble, plain agent turns with a sparkle avatar,
   mono tool pills. */
.agc { min-width: 0; }
.agc-body {
  padding: 4px 2px; display: grid; gap: 14px;
  align-content: start;
  transition: opacity .22s ease;
}
.agc-body.agc-fading { opacity: 0; }
.agc-row { display: flex; gap: 10px; align-items: flex-start; }
.agc-row-u { justify-content: flex-end; }
.agc-bubble {
  max-width: 78%; padding: 9px 16px;
  background: #2F6F9F; color: #fff; border-radius: 18px;
  font-size: 14px; line-height: 1.55;
}
.agc-turn {
  min-width: 0; max-width: 78%; padding: 9px 16px;
  background: #fff; border: 1px solid var(--border); border-radius: 18px;
  font-size: 14px; line-height: 1.55;
}
.agc-tool {
  margin: 0; padding: 5px 12px; display: inline-block; max-width: 84%;
  background: #EFEDE6; border-radius: 10px;
  font: 400 11.5px/1.7 var(--mono); color: var(--fg);
  overflow-wrap: anywhere;
}
.agc-tool::before { content: "⏺"; color: var(--accent); font-size: 8px; margin-right: 8px; vertical-align: 1px; }
.agc-tool .agc-fn { color: var(--accent); font-weight: 500; }
.agc-tool .agc-res { color: var(--muted); }
.agc-tool .agc-res b { color: var(--up); font-weight: 500; }
/* denied calls: red bullet, red verdict */
.agc-tool-deny::before { color: var(--down); }
.agc-tool .agc-res b.agc-no { color: var(--down); }

.agc-foot {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 2px 0;
  font: 400 11px var(--mono); color: var(--muted);
}
.agc-foot span { flex: 1; min-width: 0; }
.agc-replay {
  margin: 0; padding: 4px 12px; cursor: pointer; flex: none;
  font: 500 11.5px var(--mono); color: var(--fg);
  background: #fff; border: 1px solid var(--border); border-radius: 7px;
}
.agc-replay:hover { background: #fff; border-color: var(--accent); color: var(--accent); }

/* agent turn playback: typing dots, then items stagger in */
.agc-typing { display: flex; align-items: center; gap: 4px; padding: 6px 0; }
.agc-typing i {
  width: 6px; height: 6px; border-radius: 50%; background: var(--muted);
  animation: agc-blink 1s ease-in-out infinite;
}
.agc-typing i:nth-child(2) { animation-delay: .15s; }
.agc-typing i:nth-child(3) { animation-delay: .3s; }
@keyframes agc-blink { 0%, 100% { opacity: .25; } 50% { opacity: 1; } }
.agc-anim {
  opacity: 0; transform: translateY(8px);
  transition: opacity .45s ease, transform .45s ease;
}
.agc-anim.agc-in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  .agc-anim { opacity: 1; transform: none; transition: none; }
  .agc-typing i { animation: none; }
}

@media (max-width: 800px) {
  .aga-grid { grid-template-columns: 1fr; }
}
