/* appcAGENT: the AI Agent component. Follows the app's look (--primary, --text, --surface, --muted, --line) or the agent's color. */
.ag{--ag:var(--primary,#111);display:flex;flex-direction:column;min-height:0;background:var(--surface,#fff);color:var(--text,#111);overflow:hidden;position:relative}
.ag.is-fill{flex:1 1 auto;height:100%;min-height:420px}
.ag.is-card{border:1px solid var(--line,rgba(0,0,0,.08));border-radius:22px;box-shadow:0 18px 50px -24px rgba(0,0,0,.28)}
.ag [hidden]{display:none!important}
.ag-head{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:14px 16px;border-bottom:1px solid var(--line,rgba(0,0,0,.07));background:color-mix(in srgb,var(--surface,#fff) 92%,var(--ag) 8%);backdrop-filter:blur(10px);flex:0 0 auto}
.ag-who{display:flex;align-items:center;gap:11px;min-width:0}
.ag-tx{display:flex;flex-direction:column;min-width:0}
.ag-tx b{font-weight:700;font-size:15.5px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.ag-sub{font-size:12.5px;color:var(--muted,#6b7280);display:flex;align-items:center;gap:6px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.ag-dot{width:7px;height:7px;border-radius:50%;background:#22c55e;box-shadow:0 0 0 3px rgba(34,197,94,.18);flex:0 0 auto}
.ag-new{border:0;background:transparent;color:var(--muted,#6b7280);width:36px;height:36px;border-radius:12px;display:grid;place-items:center;cursor:pointer}
.ag-new:hover{background:color-mix(in srgb,var(--ag) 10%,transparent);color:var(--ag)}
.ag-new svg{width:18px;height:18px}
.ag-av{width:34px;height:34px;border-radius:50%;flex:0 0 auto;display:grid;place-items:center;overflow:hidden;color:#fff;font-weight:700;font-size:13px;letter-spacing:.02em;
  background:linear-gradient(135deg,var(--ag),color-mix(in srgb,var(--ag) 55%,#000));box-shadow:0 0 0 2px var(--surface,#fff),0 0 0 3.5px color-mix(in srgb,var(--ag) 35%,transparent)}
.ag-av img{width:100%;height:100%;object-fit:cover}
.ag-av.is-big{width:76px;height:76px;font-size:26px;box-shadow:0 0 0 4px var(--surface,#fff),0 0 0 6px color-mix(in srgb,var(--ag) 30%,transparent),0 18px 40px -12px color-mix(in srgb,var(--ag) 60%,transparent)}
.ag-body{flex:1 1 auto;overflow-y:auto;overscroll-behavior:contain;padding:18px 14px 8px;scroll-behavior:smooth}
.ag-empty{display:flex;flex-direction:column;align-items:center;text-align:center;gap:14px;padding:28px 10px 12px;animation:ag-in .5s cubic-bezier(.16,1,.3,1) both}
.ag-hello{font-size:16px;line-height:1.5;max-width:420px}
.ag-hello p{margin:0}
.ag-chips{display:flex;flex-wrap:wrap;justify-content:center;gap:8px;margin-top:4px}
.ag-chip{border:1px solid color-mix(in srgb,var(--ag) 30%,var(--line,rgba(0,0,0,.1)));background:color-mix(in srgb,var(--ag) 7%,var(--surface,#fff));color:var(--text,#111);
  padding:9px 14px;border-radius:999px;font:inherit;font-size:14px;cursor:pointer;transition:transform .15s,background .15s}
.ag-chip:hover{background:color-mix(in srgb,var(--ag) 14%,var(--surface,#fff));transform:translateY(-1px)}
.ag-list{display:flex;flex-direction:column;gap:12px}
.ag-row{display:flex;align-items:flex-end;gap:8px;animation:ag-in .35s cubic-bezier(.16,1,.3,1) both}
.ag-row.is-me{justify-content:flex-end}
.ag-row .ag-av{width:28px;height:28px;font-size:11px}
.ag-b{max-width:min(78%,560px);padding:10px 14px;border-radius:20px;font-size:15px;line-height:1.5;word-wrap:break-word;overflow-wrap:anywhere}
.ag-row.is-me .ag-b{background:var(--ag);color:#fff;border-bottom-right-radius:6px;white-space:pre-wrap}
.ag-row.is-ai .ag-b{background:color-mix(in srgb,var(--text,#111) 6%,var(--surface,#fff));border-bottom-left-radius:6px}
.ag-b p{margin:0 0 .55em}.ag-b p:last-child{margin-bottom:0}
.ag-b ul,.ag-b ol{margin:.2em 0 .55em;padding-left:1.25em}.ag-b li{margin:.15em 0}
.ag-b a{color:inherit;text-decoration:underline;text-underline-offset:2px}
.ag-row.is-ai .ag-b a{color:var(--ag)}
.ag-dots{display:inline-flex;gap:4px;padding:4px 2px}
.ag-dots i{width:7px;height:7px;border-radius:50%;background:color-mix(in srgb,var(--text,#111) 45%,transparent);animation:ag-dot 1.2s infinite ease-in-out}
.ag-dots i:nth-child(2){animation-delay:.15s}.ag-dots i:nth-child(3){animation-delay:.3s}
.ag-note{margin:0 14px 6px;padding:8px 12px;border-radius:12px;font-size:13px;background:color-mix(in srgb,#f59e0b 14%,var(--surface,#fff));color:var(--text,#111)}
.ag-foot{padding:10px 12px calc(12px + env(safe-area-inset-bottom,0px));flex:0 0 auto}
.ag-bar{display:flex;align-items:flex-end;gap:8px;padding:6px 6px 6px 16px;border-radius:26px;border:1px solid var(--line,rgba(0,0,0,.1));background:var(--surface,#fff);
  box-shadow:0 6px 24px -14px rgba(0,0,0,.35);transition:border-color .15s,box-shadow .15s}
.ag-bar:focus-within{border-color:color-mix(in srgb,var(--ag) 55%,transparent);box-shadow:0 0 0 4px color-mix(in srgb,var(--ag) 14%,transparent)}
.ag-in{flex:1 1 auto;border:0;outline:0;resize:none;background:transparent;color:inherit;font:inherit;font-size:16px;line-height:1.45;padding:8px 0;max-height:140px}
.ag-send{width:38px;height:38px;border-radius:50%;border:0;background:var(--ag);color:#fff;display:grid;place-items:center;cursor:pointer;flex:0 0 auto;transition:transform .15s,opacity .15s}
.ag-send:hover{transform:scale(1.06)}.ag-send:disabled{opacity:.45;cursor:default;transform:none}
.ag-send svg{width:18px;height:18px}
/* the team's DM: what the agent made, cards, steps, the working strip */
.ag-links{display:flex;flex-wrap:wrap;gap:8px;margin-top:10px}
.ag-link{display:flex;flex-direction:column;max-width:100%;border-radius:14px;overflow:hidden;border:1px solid var(--line,rgba(0,0,0,.1));background:var(--surface,#fff);color:var(--text,#111)!important;text-decoration:none!important}
.ag-link img{display:block;width:220px;max-width:100%;aspect-ratio:4/3;object-fit:cover;background:color-mix(in srgb,var(--text,#111) 6%,transparent)}
.ag-lk{display:flex;align-items:center;gap:8px;padding:9px 12px;font-size:13.5px;min-width:0}
.ag-lk svg{width:16px;height:16px;flex:0 0 auto;color:var(--ag)}
.ag-lk b{font-weight:600;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:190px}
.ag-link:hover{border-color:color-mix(in srgb,var(--ag) 45%,transparent)}
.ag-choices{display:flex;flex-wrap:wrap;gap:8px;margin-top:10px}
.ag-choice{border:1px solid color-mix(in srgb,var(--ag) 35%,var(--line,rgba(0,0,0,.1)));background:var(--surface,#fff);color:var(--text,#111);font:inherit;font-size:14px;font-weight:600;padding:8px 14px;border-radius:999px;cursor:pointer}
.ag-choice.is-main{background:var(--ag);border-color:var(--ag);color:#fff}
.ag-choice:disabled{opacity:.5;cursor:default}
.ag-chosen{font-size:13px;color:var(--muted,#6b7280)}
.ag-row.is-step .ag-b{background:transparent;border:1px dashed color-mix(in srgb,var(--text,#111) 18%,transparent);font-size:13.5px;color:var(--muted,#6b7280)}
.ag-row.is-fallback .ag-b,.ag-row.is-handoff .ag-b{background:color-mix(in srgb,#f59e0b 12%,var(--surface,#fff))}
.ag-banner{align-self:center;font-size:12.5px;color:var(--muted,#6b7280);padding:2px 10px}
.ag-work{display:flex;align-items:center;gap:10px;margin:0 12px 6px;padding:10px 12px;border-radius:16px;background:color-mix(in srgb,var(--ag) 9%,var(--surface,#fff));border:1px solid color-mix(in srgb,var(--ag) 22%,transparent)}
.ag-work .ag-av{width:30px;height:30px;font-size:11px}
.ag-av.is-busy{animation:ag-pulse 1.6s ease-in-out infinite}
.ag-wtx{flex:1 1 auto;min-width:0;display:flex;flex-direction:column}
.ag-wtx b{font-size:13.5px;font-weight:600;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.ag-wtx span{font-size:12.5px;color:var(--muted,#6b7280);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.ag-stop{border:1px solid var(--line,rgba(0,0,0,.12));background:var(--surface,#fff);color:var(--text,#111);font:inherit;font-size:13px;font-weight:600;padding:7px 12px;border-radius:10px;cursor:pointer;flex:0 0 auto}
.ag-stop:disabled{opacity:.5;cursor:default}
@keyframes ag-pulse{0%,100%{box-shadow:0 0 0 2px var(--surface,#fff),0 0 0 3.5px color-mix(in srgb,var(--ag) 35%,transparent)}50%{box-shadow:0 0 0 2px var(--surface,#fff),0 0 0 7px color-mix(in srgb,var(--ag) 20%,transparent)}}
@keyframes ag-in{from{opacity:0;transform:translateY(8px)}to{opacity:1;transform:none}}
@keyframes ag-dot{0%,80%,100%{transform:translateY(0);opacity:.45}40%{transform:translateY(-4px);opacity:1}}
@media (prefers-reduced-motion:reduce){.ag-row,.ag-empty{animation:none}.ag-dots i{animation:none}}
