/* agent.css — AI Agents builder · Identity B: "Neural / mission control".
   A luminous control room for autonomous agents — indigo→cyan, soft glows,
   fully-rounded capsules, an orbital empty state and a terminal test bench.
   Token-driven so light + dark + RTL all keep working. */

/* Agents accent (indigo → cyan) — on body so the export drawer + scrim, which
   are direct children of <body> (siblings of .ag-main), inherit it too.
   --ag-accent-2 is also read by canvas.js for the SVG edge stroke. */
.ag-body {
  background: var(--bg); color: var(--fg);
  --ag-accent: #6366f1;       /* indigo */
  --ag-accent-2: #06b6d4;     /* cyan   */
  /* Mission-control glow tokens (used across buttons / nodes / dock). */
  --ag-accent-rgb: 99, 102, 241;
  --ag-accent-2-rgb: 6, 182, 212;
  --ag-glow: 0 0 0 1px rgba(var(--ag-accent-rgb), .22), 0 8px 26px rgba(var(--ag-accent-rgb), .30), 0 2px 8px rgba(var(--ag-accent-2-rgb), .18);
  --ag-glow-strong: 0 0 0 1px rgba(var(--ag-accent-rgb), .35), 0 10px 36px rgba(var(--ag-accent-rgb), .48), 0 3px 14px rgba(var(--ag-accent-2-rgb), .30);
  --ag-ring: rgba(var(--ag-accent-rgb), .20);
  --ag-ring-2: rgba(var(--ag-accent-2-rgb), .22);
  --ag-hairline: linear-gradient(90deg, transparent, rgba(var(--ag-accent-rgb), .9) 18%, rgba(var(--ag-accent-2-rgb), .9) 82%, transparent);
  /* Canvas atmosphere — soft neural vignette + fine dot grid. */
  --ag-grid: rgba(var(--ag-accent-rgb), .16);
  --ag-vignette: radial-gradient(120% 90% at 50% 18%, rgba(var(--ag-accent-rgb), .10), transparent 60%),
                 radial-gradient(80% 70% at 82% 90%, rgba(var(--ag-accent-2-rgb), .08), transparent 62%);
  --ag-canvas-bg: var(--surface-2);
}

/* Dark-mode tuning — a restrained neural / starfield space, never garish. */
body.dark-mode.ag-body {
  --ag-accent: #818cf8;       /* lighter indigo so text/edges stay legible */
  --ag-accent-2: #22d3ee;     /* lighter cyan */
  --ag-accent-rgb: 129, 140, 248;
  --ag-accent-2-rgb: 34, 211, 238;
  --ag-glow: 0 0 0 1px rgba(var(--ag-accent-rgb), .26), 0 10px 30px rgba(var(--ag-accent-rgb), .30), 0 2px 10px rgba(var(--ag-accent-2-rgb), .22);
  --ag-glow-strong: 0 0 0 1px rgba(var(--ag-accent-rgb), .42), 0 14px 44px rgba(var(--ag-accent-rgb), .50), 0 4px 18px rgba(var(--ag-accent-2-rgb), .38);
  --ag-grid: rgba(var(--ag-accent-rgb), .14);
  --ag-vignette: radial-gradient(120% 90% at 50% 16%, rgba(var(--ag-accent-rgb), .16), transparent 60%),
                 radial-gradient(80% 70% at 84% 92%, rgba(var(--ag-accent-2-rgb), .12), transparent 62%);
  --ag-canvas-bg: radial-gradient(140% 120% at 50% 0%, #11151f, #0c0f16 70%);
}

/* The hidden attribute MUST win over the display:flex/block rules below
   (.ag-drawer, .ag-loading, etc.) — without this they ignore [hidden] and the
   export drawer + loading spinner show on a fresh page. */
.ag-body [hidden] { display: none !important; }
.ag-main { max-width: 1180px; margin: 0 auto; padding: 18px 16px 64px; }
.ag-toggle-row { display: flex; justify-content: center; margin: 6px 0 18px; }

/* ── Top bar ─────────────────────────────────────────────────────────────── */
/* Luminous card: a faint indigo→cyan hairline along the top edge + soft lift. */
.ag-topbar {
  position: relative;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 16px; padding: 14px;
  box-shadow: var(--shadow-card), 0 1px 0 rgba(var(--ag-accent-rgb), .04);
  overflow: hidden;
}
.ag-topbar::before {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 2px;
  background: var(--ag-hairline); opacity: .85; pointer-events: none;
}
.ag-topbar-row { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.ag-title {
  flex: 1; min-width: 0; font-size: 18px; font-weight: 700; color: var(--fg);
  font-family: var(--font-display, inherit);
  background: transparent; border: 1px solid transparent; border-radius: 9px;
  padding: 6px 8px; letter-spacing: -.01em;
  transition: border-color var(--dur-fast, .12s) var(--ease), background var(--dur-fast, .12s) var(--ease), box-shadow var(--dur-fast, .12s) var(--ease);
}
.ag-title:hover { border-color: var(--border); }
.ag-title:focus {
  outline: none; border-color: var(--ag-accent); background: var(--surface-2);
  box-shadow: 0 0 0 3px var(--ag-ring);
}
.ag-title:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--ag-ring); }
.ag-topbar-actions { display: flex; gap: 8px; flex: 0 0 auto; }

.ag-brief { display: flex; flex-direction: column; gap: 10px; }
.ag-idea {
  width: 100%; resize: none; font-family: inherit; font-size: 15px; line-height: 1.55;
  color: var(--fg); background: var(--surface-2); border: 1px solid var(--border-input);
  border-radius: 12px; padding: 12px 14px; min-height: 52px;
  transition: border-color var(--dur-fast, .12s) var(--ease), box-shadow var(--dur-fast, .12s) var(--ease);
}
.ag-idea:focus { outline: none; border-color: var(--ag-accent); box-shadow: 0 0 0 3px var(--ag-ring); }
.ag-brief-controls { display: flex; align-items: center; gap: 12px; justify-content: flex-end; }
.ag-kind { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--fg-muted); }
.ag-kind select {
  font-family: inherit; font-size: 13px; color: var(--fg); background: var(--surface);
  border: 1px solid var(--border-input); border-radius: 8px; padding: 6px 8px;
  transition: border-color var(--dur-fast, .12s) var(--ease), box-shadow var(--dur-fast, .12s) var(--ease);
}
.ag-kind select:focus { outline: none; border-color: var(--ag-accent); box-shadow: 0 0 0 3px var(--ag-ring); }

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.ag-btn {
  display: inline-flex; align-items: center; gap: 7px; font-family: inherit; font-size: 13px;
  font-weight: 600; border-radius: 999px; padding: 9px 16px; cursor: pointer; border: 1px solid transparent;
  transition: background .18s var(--ease), border-color .18s var(--ease), color .18s var(--ease),
              box-shadow .22s var(--ease), opacity .16s, transform .06s var(--ease);
}
.ag-btn:active { transform: translateY(1px); }
.ag-btn:disabled { opacity: .5; cursor: not-allowed; }
.ag-btn:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--ag-ring); }
.ag-btn-ghost { background: var(--surface); border-color: var(--border); color: var(--fg); }
.ag-btn-ghost:hover:not(:disabled) {
  background: var(--surface-2); border-color: rgba(var(--ag-accent-rgb), .35);
  color: var(--ag-accent); box-shadow: 0 0 0 3px rgba(var(--ag-accent-rgb), .07);
}
.ag-btn-ghost:focus-visible { box-shadow: 0 0 0 3px var(--ag-ring); }

/* Signature: glowing gradient CAPSULE — indigo→cyan, soft outer glow that
   intensifies on hover. */
.ag-btn-primary {
  position: relative; color: #fff; border: 0; isolation: isolate;
  background: linear-gradient(135deg, var(--ag-accent), var(--ag-accent-2));
  box-shadow: var(--ag-glow);
}
.ag-btn-primary::before {
  content: ""; position: absolute; inset: 0; border-radius: inherit; z-index: -1;
  background: linear-gradient(135deg, var(--ag-accent), var(--ag-accent-2));
  filter: blur(11px); opacity: .45;
  transition: opacity .22s var(--ease);
}
.ag-btn-primary:hover:not(:disabled) {
  filter: brightness(1.06); box-shadow: var(--ag-glow-strong);
}
.ag-btn-primary:hover:not(:disabled)::before { opacity: .8; }
.ag-btn-primary:disabled { box-shadow: none; }
.ag-btn-primary:disabled::before { opacity: 0; }
.ag-btn-primary:focus-visible { box-shadow: var(--ag-glow-strong), 0 0 0 3px var(--ag-ring); }

.ag-cost-pill {
  font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 999px;
  background: rgba(255, 255, 255, .22); color: #fff;
}
.ag-btn-ghost .ag-cost-pill { background: rgba(var(--ag-accent-rgb), .12); color: var(--ag-accent); }

@media (pointer: coarse), (max-width: 720px) {
  .ag-title,
  .ag-kind select,
  .ag-btn,
  .ag-tool,
  .ag-icon-btn {
    min-height: 40px;
    touch-action: manipulation;
  }
}

/* ── Stage / canvas ──────────────────────────────────────────────────────── */
.ag-stage { display: flex; gap: 14px; margin-top: 14px; align-items: stretch; }
.ag-canvas-wrap { position: relative; flex: 1; min-width: 0; }

/* Mission-control space: a soft radial vignette glow behind the nodes + a fine
   accent dot grid. The vignette lives on ::before so the dot grid (here) stays
   crisp above it; nodes/edges sit above both. */
.ag-canvas {
  position: relative; height: 560px; overflow: hidden; border-radius: 16px;
  border: 1px solid var(--border); background: var(--ag-canvas-bg);
  background-image: radial-gradient(var(--ag-grid) 1px, transparent 1px);
  background-size: 20px 20px; touch-action: none;
  box-shadow: inset 0 0 0 1px rgba(var(--ag-accent-rgb), .05);
}
.ag-canvas::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: var(--ag-vignette); z-index: 0;
}
.ag-edges { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; z-index: 1; }
.ag-nodes { position: absolute; inset: 0; transform-origin: 0 0; z-index: 2; }

/* Node cards — luminous tiles with a faint accent ring at rest. */
.ag-node {
  position: absolute; width: 240px; background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: 14px; cursor: grab; user-select: none;
  box-shadow: var(--shadow-card), 0 0 0 1px rgba(var(--ag-accent-rgb), .10);
  transition: border-color .16s var(--ease), box-shadow .2s var(--ease), transform .12s var(--ease);
}
.ag-node:hover {
  box-shadow: var(--shadow-card-hover), 0 0 0 1px rgba(var(--ag-accent-rgb), .30), 0 8px 26px rgba(var(--ag-accent-rgb), .22);
  transform: translateY(-1px);
}
.ag-node.is-selected {
  border-color: var(--ag-accent);
  box-shadow: 0 0 0 3px var(--ag-ring), 0 10px 32px rgba(var(--ag-accent-rgb), .34);
}
/* Orchestrator leans CYAN halo; worker leans INDIGO. */
.ag-node.is-orchestrator {
  border-top: 0;
  box-shadow: var(--shadow-card), 0 0 0 1px rgba(var(--ag-accent-2-rgb), .26), 0 8px 26px rgba(var(--ag-accent-2-rgb), .20);
}
.ag-node.is-orchestrator::before {
  content: ""; position: absolute; inset: -1px -1px auto -1px; height: 3px;
  border-radius: 14px 14px 0 0;
  background: linear-gradient(90deg, var(--ag-accent-2), var(--ag-accent));
}
.ag-node.is-orchestrator.is-selected {
  box-shadow: 0 0 0 3px var(--ag-ring-2), 0 12px 34px rgba(var(--ag-accent-2-rgb), .36);
}
.ag-node-head { display: flex; align-items: center; gap: 8px; padding: 11px 12px 6px; }
.ag-node-emoji { font-size: 18px; filter: drop-shadow(0 1px 4px rgba(var(--ag-accent-rgb), .35)); }
.ag-node-name { font-weight: 700; font-size: 14px; color: var(--fg); flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; letter-spacing: -.01em; }
.ag-node-role { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; padding: 2px 7px; border-radius: 999px; font-family: var(--font-mono, ui-monospace, monospace); }
.ag-role-orchestrator { background: rgba(var(--ag-accent-2-rgb), .16); color: var(--ag-accent-2); box-shadow: inset 0 0 0 1px rgba(var(--ag-accent-2-rgb), .3); }
.ag-role-worker { background: rgba(var(--ag-accent-rgb), .16); color: var(--ag-accent); box-shadow: inset 0 0 0 1px rgba(var(--ag-accent-rgb), .3); }
.ag-node-model { padding: 0 12px; font-size: 11px; color: var(--fg-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-family: var(--font-mono, ui-monospace, monospace); }
.ag-node-tools { display: flex; flex-wrap: wrap; gap: 4px; padding: 8px 12px 12px; }
.ag-chip {
  font-size: 10px; font-weight: 600; padding: 2px 7px; border-radius: 999px;
  background: var(--surface-3); color: var(--fg-muted);
  border: 1px solid rgba(var(--ag-accent-rgb), .12);
  font-family: var(--font-mono, ui-monospace, monospace);
}

/* Floating canvas toolbar — luminous dock. */
.ag-canvas-tools {
  position: absolute; left: 12px; bottom: 12px; display: flex; gap: 6px; z-index: 3;
  background: var(--surface); border: 1px solid var(--border); border-radius: 999px;
  padding: 5px; box-shadow: var(--shadow-card), 0 0 0 1px rgba(var(--ag-accent-rgb), .08);
}
.ag-tool {
  font-family: inherit; font-size: 14px; font-weight: 600; color: var(--fg); cursor: pointer;
  background: transparent; border: 0; border-radius: 999px; padding: 6px 10px; min-width: 34px;
  transition: background .14s var(--ease), color .14s var(--ease);
}
.ag-tool:hover { background: rgba(var(--ag-accent-rgb), .10); color: var(--ag-accent); }
.ag-tool:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--ag-ring); }
.ag-tool-test { color: var(--ag-accent); }
.ag-tool-test:hover { background: rgba(var(--ag-accent-rgb), .14); }

/* ── Empty state — orbital constellation motif ───────────────────────────── */
.ag-empty { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 24px; z-index: 3; }

/* The emoji stays centered inside a system of concentric rings + orbiting dots,
   drawn with pseudo-elements. Two orbit rings rotate; small dots ride them. */
.ag-empty-art {
  position: relative; width: 120px; height: 120px; margin-bottom: 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 40px; line-height: 1;
  filter: drop-shadow(0 4px 18px rgba(var(--ag-accent-rgb), .45));
}
/* Inner ring (cyan-leaning) */
.ag-empty-art::before {
  content: ""; position: absolute; inset: 18px; border-radius: 50%;
  border: 1.5px solid rgba(var(--ag-accent-2-rgb), .5);
  box-shadow: 0 0 22px rgba(var(--ag-accent-2-rgb), .25) inset, 0 0 14px rgba(var(--ag-accent-2-rgb), .2);
  animation: ag-orbit 9s linear infinite;
}
/* A dot riding the inner ring */
.ag-empty-art::before { background:
  radial-gradient(circle at 50% 0%, var(--ag-accent-2) 0 3px, transparent 4px) center/100% 100% no-repeat; }
/* Outer ring (indigo-leaning) + its dot */
.ag-empty-art::after {
  content: ""; position: absolute; inset: 0; border-radius: 50%;
  border: 1.5px solid rgba(var(--ag-accent-rgb), .42);
  box-shadow: 0 0 30px rgba(var(--ag-accent-rgb), .22);
  background: radial-gradient(circle at 100% 50%, var(--ag-accent) 0 3.5px, transparent 4.5px) center/100% 100% no-repeat;
  animation: ag-orbit-rev 14s linear infinite;
}
@keyframes ag-orbit { to { transform: rotate(360deg); } }
@keyframes ag-orbit-rev { to { transform: rotate(-360deg); } }

.ag-empty h2 { font-size: 20px; font-weight: 700; margin: 0 0 6px; color: var(--fg); font-family: var(--font-display, inherit); letter-spacing: -.02em; }
.ag-empty p { max-width: 440px; color: var(--fg-muted); font-size: 14px; line-height: 1.6; margin: 0 0 16px; }
.ag-examples { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; max-width: 600px; }
.ag-example {
  font-size: 12.5px; color: var(--fg); background: var(--surface);
  border: 1px solid var(--border); border-radius: 999px; padding: 7px 13px; cursor: pointer;
  transition: border-color .16s var(--ease), color .16s var(--ease), box-shadow .2s var(--ease), background .16s var(--ease);
}
.ag-example:hover {
  border-color: rgba(var(--ag-accent-rgb), .55); color: var(--ag-accent);
  background: rgba(var(--ag-accent-rgb), .06);
  box-shadow: 0 0 0 3px rgba(var(--ag-accent-rgb), .10), 0 6px 18px rgba(var(--ag-accent-rgb), .18);
}
.ag-example:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--ag-ring); }

/* Loading — orbital spinner consistent with the motif. */
.ag-loading { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; gap: 10px; background: var(--ag-canvas-bg); color: var(--fg-muted); font-size: 14px; z-index: 4; }
.ag-loading::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: var(--ag-vignette);
}
.ag-spin {
  width: 18px; height: 18px; border-radius: 50%;
  border: 2.5px solid rgba(var(--ag-accent-rgb), .22); border-top-color: var(--ag-accent);
  box-shadow: 0 0 10px rgba(var(--ag-accent-rgb), .35);
  animation: ag-spin .7s linear infinite; position: relative; z-index: 1;
}
#ag-loading-text { position: relative; z-index: 1; }
@keyframes ag-spin { to { transform: rotate(360deg); } }

.ag-stage[data-state="empty"] .ag-canvas-tools,
.ag-stage[data-state="loading"] .ag-canvas-tools { display: none; }
.ag-stage:not([data-state="empty"]) .ag-empty { display: none; }

/* ── Inspector ───────────────────────────────────────────────────────────── */
.ag-inspector {
  position: relative;
  flex: 0 0 320px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 16px; padding: 14px;
  box-shadow: var(--shadow-card), 0 0 0 1px rgba(var(--ag-accent-rgb), .06);
  max-height: 560px; overflow-y: auto; overflow-x: hidden;
}
.ag-inspector::before {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 2px; border-radius: 16px 16px 0 0;
  background: var(--ag-hairline); opacity: .7; pointer-events: none;
}
.ag-insp-title { font-size: 13px; font-weight: 700; color: var(--fg); margin: 0 0 10px; display: flex; align-items: center; justify-content: space-between; letter-spacing: -.01em; }
.ag-field { margin-bottom: 12px; }
.ag-field label { display: block; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--fg-muted); margin-bottom: 5px; font-family: var(--font-mono, ui-monospace, monospace); }
.ag-field input, .ag-field textarea, .ag-field select {
  width: 100%; font-family: inherit; font-size: 13px; color: var(--fg); background: var(--surface-2);
  border: 1px solid var(--border-input); border-radius: 9px; padding: 8px 10px; resize: vertical;
  transition: border-color .14s var(--ease), box-shadow .14s var(--ease);
}
.ag-field textarea { min-height: 90px; line-height: 1.5; }
.ag-field input:focus, .ag-field textarea:focus, .ag-field select:focus { outline: none; border-color: var(--ag-accent); box-shadow: 0 0 0 3px var(--ag-ring); }
.ag-tool-row { display: flex; gap: 6px; flex-wrap: wrap; }
.ag-tool-pill {
  font-size: 12px; padding: 5px 10px; border-radius: 999px; border: 1px solid var(--border);
  background: var(--surface); color: var(--fg-muted); cursor: pointer;
  transition: border-color .14s var(--ease), color .14s var(--ease), background .14s var(--ease), box-shadow .18s var(--ease);
}
.ag-tool-pill:hover { border-color: rgba(var(--ag-accent-rgb), .4); color: var(--ag-accent); }
.ag-tool-pill:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--ag-ring); }
.ag-tool-pill.is-on {
  border-color: var(--ag-accent); color: var(--ag-accent); background: rgba(var(--ag-accent-rgb), .10);
  box-shadow: 0 0 0 3px rgba(var(--ag-accent-rgb), .08);
}
.ag-insp-del { color: #dc2626; background: transparent; border: 1px solid var(--border); border-radius: 999px; padding: 7px 12px; font-size: 12px; font-weight: 600; cursor: pointer; width: 100%; margin-top: 4px; transition: background .14s var(--ease), border-color .14s var(--ease); }
.ag-insp-del:hover { background: rgba(220, 38, 38, .08); border-color: rgba(220, 38, 38, .4); }
.ag-insp-del:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(220, 38, 38, .25); }

/* ── Test bench dock — terminal / console ────────────────────────────────── */
.ag-dock {
  position: relative; margin-top: 14px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 16px; box-shadow: var(--shadow-card), 0 0 0 1px rgba(var(--ag-accent-rgb), .07);
  overflow: hidden;
}
.ag-dock::before {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 2px;
  background: var(--ag-hairline); opacity: .8; pointer-events: none;
}
.ag-dock-head { display: flex; align-items: center; justify-content: space-between; padding: 11px 14px; border-bottom: 1px solid var(--border); }
/* "live" pulsing dot sits before the title. */
.ag-dock-title { display: inline-flex; align-items: center; font-size: 13px; font-weight: 700; color: var(--fg); letter-spacing: -.01em; }
.ag-dock-title::before {
  content: ""; width: 8px; height: 8px; border-radius: 50%; margin-right: 8px; flex: 0 0 auto;
  background: var(--ag-accent-2);
  box-shadow: 0 0 0 3px rgba(var(--ag-accent-2-rgb), .22), 0 0 10px rgba(var(--ag-accent-2-rgb), .6);
  animation: ag-pulse 1.8s ease-in-out infinite;
}
@keyframes ag-pulse {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 3px rgba(var(--ag-accent-2-rgb), .22), 0 0 10px rgba(var(--ag-accent-2-rgb), .6); }
  50% { opacity: .55; box-shadow: 0 0 0 6px rgba(var(--ag-accent-2-rgb), .06), 0 0 14px rgba(var(--ag-accent-2-rgb), .35); }
}
.ag-dock-sub { font-size: 11px; font-weight: 500; color: var(--fg-muted); margin-left: 6px; font-family: var(--font-mono, ui-monospace, monospace); }
.ag-dock-trace {
  max-height: 320px; overflow-y: auto; padding: 12px 14px; display: flex; flex-direction: column; gap: 8px;
  background:
    linear-gradient(180deg, rgba(var(--ag-accent-rgb), .03), transparent 120px),
    var(--surface-2);
}
.ag-msg { font-size: 13px; line-height: 1.55; }
.ag-msg-user {
  align-self: flex-end; color: #fff; padding: 8px 12px; border-radius: 14px 14px 4px 14px; max-width: 80%;
  background: linear-gradient(135deg, var(--ag-accent), var(--ag-accent-2));
  box-shadow: 0 4px 14px rgba(var(--ag-accent-rgb), .28);
}
.ag-evt { font-size: 12.5px; line-height: 1.5; border-radius: 10px; padding: 8px 11px; border: 1px solid var(--border); background: var(--surface); font-family: var(--font-mono, ui-monospace, monospace); }
.ag-evt-who { font-weight: 700; color: var(--ag-accent); font-size: 11px; letter-spacing: .02em; }
.ag-evt-think { color: var(--fg-muted); font-style: italic; font-family: inherit; }
/* Tool calls — cyan console rows. */
.ag-evt-tool { background: rgba(var(--ag-accent-2-rgb), .08); border-color: rgba(var(--ag-accent-2-rgb), .28); }
.ag-evt-tool .ag-evt-who { color: var(--ag-accent-2); }
/* Handoff — keep its amber semantic, console-tinted. */
.ag-evt-handoff { background: rgba(245, 158, 11, .10); border-color: rgba(245, 158, 11, .32); color: #b45309; font-weight: 600; }
/* Final — glowing indigo card. */
.ag-evt-final { background: var(--surface); border-color: var(--ag-accent); color: var(--fg); font-family: inherit; box-shadow: 0 0 0 1px rgba(var(--ag-accent-rgb), .18), 0 6px 18px rgba(var(--ag-accent-rgb), .14); }
.ag-evt-final .ag-evt-who { color: var(--ag-accent); }
.ag-evt code { font-family: var(--font-mono, 'Geist Mono', ui-monospace, monospace); font-size: 11.5px; color: var(--ag-accent-2); }
.ag-dock-input { display: flex; gap: 8px; padding: 11px 14px; border-top: 1px solid var(--border); }
.ag-dock-input input { flex: 1; font-family: var(--font-mono, ui-monospace, monospace); font-size: 13px; color: var(--fg); background: var(--surface-2); border: 1px solid var(--border-input); border-radius: 999px; padding: 9px 14px; transition: border-color .14s var(--ease), box-shadow .14s var(--ease); }
.ag-dock-input input:focus { outline: none; border-color: var(--ag-accent); box-shadow: 0 0 0 3px var(--ag-ring); }

/* ── Export drawer ───────────────────────────────────────────────────────── */
.ag-drawer-scrim { position: fixed; inset: 0; background: rgba(8, 11, 20, .5); backdrop-filter: blur(2px); z-index: 60; }
.ag-drawer {
  position: fixed; top: 0; right: 0; height: 100vh; width: min(560px, 94vw); z-index: 61;
  background: var(--surface); border-left: 1px solid var(--border); box-shadow: var(--shadow-pop);
  display: flex; flex-direction: column; animation: ag-slide-in .22s var(--ease);
}
.ag-drawer::before {
  content: ""; position: absolute; inset: 0 auto 0 0; width: 2px;
  background: linear-gradient(180deg, var(--ag-accent), var(--ag-accent-2));
  opacity: .8; pointer-events: none;
}
@keyframes ag-slide-in { from { transform: translateX(100%); } to { transform: translateX(0); } }
.ag-drawer-head { display: flex; align-items: center; justify-content: space-between; padding: 16px; border-bottom: 1px solid var(--border); }
.ag-drawer-head h3 { margin: 0; font-size: 16px; font-weight: 700; color: var(--fg); font-family: var(--font-display, inherit); letter-spacing: -.02em; }
.ag-drawer-platforms { display: flex; flex-wrap: wrap; gap: 7px; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.ag-plat {
  font-size: 12.5px; font-weight: 600; padding: 6px 11px; border-radius: 999px; border: 1px solid var(--border);
  background: var(--surface); color: var(--fg); cursor: pointer; display: inline-flex; align-items: center; gap: 6px;
  transition: border-color .14s var(--ease), box-shadow .2s var(--ease), color .14s var(--ease);
}
.ag-plat:hover { border-color: rgba(var(--ag-accent-rgb), .5); box-shadow: 0 0 0 3px rgba(var(--ag-accent-rgb), .08); }
.ag-plat:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--ag-ring); }
.ag-plat.is-on {
  background: linear-gradient(135deg, var(--ag-accent), var(--ag-accent-2)); color: #fff; border-color: transparent;
  box-shadow: 0 4px 14px rgba(var(--ag-accent-rgb), .30);
}
.ag-plat-tier { font-size: 9px; font-weight: 800; padding: 1px 5px; border-radius: 999px; background: var(--surface-3); color: var(--fg-muted); font-family: var(--font-mono, ui-monospace, monospace); }
.ag-plat.is-on .ag-plat-tier { background: rgba(255, 255, 255, .25); color: #fff; }
.ag-drawer-body { flex: 1; overflow-y: auto; padding: 16px; }
.ag-drawer-warn { font-size: 12.5px; line-height: 1.55; color: #b45309; background: rgba(245, 158, 11, .1); border: 1px solid rgba(245, 158, 11, .3); border-radius: 10px; padding: 10px 12px; margin-bottom: 12px; }
.ag-drawer-warn ul { margin: 6px 0 0; padding-left: 18px; }
.ag-drawer-code {
  font-family: var(--font-mono, 'Geist Mono', ui-monospace, monospace); font-size: 12px; line-height: 1.55; color: var(--fg);
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 12px;
  max-height: 44vh; overflow: auto; white-space: pre; margin: 0;
  box-shadow: inset 0 0 0 1px rgba(var(--ag-accent-rgb), .05);
}
.ag-drawer-actions { display: flex; gap: 8px; margin: 12px 0; }
.ag-drawer-guide { font-size: 12.5px; color: var(--fg-muted); line-height: 1.6; }
.ag-drawer-guide h4 { font-size: 12px; color: var(--fg); margin: 0 0 6px; }
.ag-drawer-guide ol { margin: 0; padding-left: 18px; }

.ag-icon-btn { background: transparent; border: 0; color: var(--fg-muted); cursor: pointer; font-size: 16px; padding: 6px; border-radius: 999px; transition: background .14s var(--ease), color .14s var(--ease); }
.ag-icon-btn:hover { background: rgba(var(--ag-accent-rgb), .10); color: var(--ag-accent); }
.ag-icon-btn:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--ag-ring); }

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 860px) {
  .ag-stage { flex-direction: column; }
  .ag-inspector { flex-basis: auto; max-height: none; }
  .ag-canvas { height: 440px; }
  .ag-topbar-row { flex-wrap: wrap; }
}

/* ── RTL ──────────────────────────────────────────────────────────────────── */
html[dir="rtl"] .ag-dock-title::before { margin-right: 0; margin-left: 8px; }
html[dir="rtl"] .ag-dock-sub { margin-left: 0; margin-right: 6px; }
html[dir="rtl"] .ag-msg-user { border-radius: 14px 14px 14px 4px; }
html[dir="rtl"] .ag-drawer { left: 0; right: auto; border-left: 0; border-right: 1px solid var(--border); animation: ag-slide-in-rtl .22s var(--ease); }
html[dir="rtl"] .ag-drawer::before { inset: 0 0 0 auto; right: 0; left: auto; }
@keyframes ag-slide-in-rtl { from { transform: translateX(-100%); } to { transform: translateX(0); } }

/* ── Reduced motion — keep everything legible & static ───────────────────── */
@media (prefers-reduced-motion: reduce) {
  .ag-empty-art::before,
  .ag-empty-art::after,
  .ag-spin,
  .ag-dock-title::before { animation: none !important; }
  /* Static rings: drop the orbit-dot gradients so the rings read as clean circles. */
  .ag-empty-art::before { background: none; }
  .ag-empty-art::after { background: none; }
  .ag-btn-primary::before { transition: none; }
}
