/* web/pages/agents/agents.css — [AGX1 agents-page-v1] · [AGX3 screenshot-v1]
   Agents page, three columns: Teams (240) · list · detail.
   [AGX3] restyled to Sarthak's reference screenshot (2026-10-12):
     - three surface layers (kit 2.1): team column --list, list and detail
       on --bg, every card/box on --surface
     - line icons (.agx-ico) instead of emoji, 1.7 stroke like the rail
     - detail = title + actions, pills, description, readiness alert, then a
       2x2 grid: Ask it things like · You get back · Safety rules · Sources
     - pills by meaning: lime = done/connected, amber = needs action,
       neutral outline = facts (Built-in), accent tint = team/template
   Scoped under .agx so nothing leaks into the rest of the shell. Tokens
   only; the shimmer reuses brandkit's global bk-shimmer keyframes. */

.agx { display: flex; height: 100%; min-height: 0; overflow: hidden;
  --z: var(--uz, 1);
  font-size: calc(14px * var(--z)); color: var(--tb-text);
  background: var(--bg); }
.agx * { box-sizing: border-box; }
.agx button { font: inherit; cursor: pointer; }
.agx input, .agx textarea, .agx select { font: inherit; color: var(--tb-text); }
.agx h1, .agx h2, .agx h3 { padding-bottom: 0; border-bottom: 0; }   /* renderer.css bare-h2 rule */

/* ---------- icons ---------- */
.agx .agx-ico { width: 20px; height: 20px; flex: none; fill: none;
  stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.agx .agx-ico .fill { fill: currentColor; stroke: none; }

/* ---------- shared components ---------- */
.agx-btn { display: inline-flex; align-items: center; gap: 8px;
  height: 36px; padding: 0 14px; border-radius: var(--radius-btn);
  font-size: calc(13.5px * var(--z)); font-weight: 600;
  border: 1px solid transparent; background: transparent; color: var(--tb-text);
  white-space: nowrap; transition: background-color 120ms ease-out, border-color 120ms ease-out; }
.agx-btn .agx-ico { width: 19px; height: 19px; }
.agx-btn.sm { height: 32px; padding: 0 12px; }
.agx-btn.primary { background: var(--tb-accent); color: var(--white); }
.agx-btn.primary:hover { background: var(--primary-hover); }
.agx-btn.secondary { border-color: var(--tb-border-strong); }
.agx-btn.secondary:hover { border-color: var(--border-hover); background: var(--surface-2); }
.agx-btn.ghost { color: var(--tb-text-secondary); }
.agx-btn.ghost:hover { color: var(--tb-text); }
.agx-btn.danger { background: var(--tb-danger-fill); color: var(--white); }
.agx-btn:disabled { opacity: .4; cursor: not-allowed; }
.agx-ibtn { width: 36px; height: 36px; flex: none; display: inline-flex; align-items: center;
  justify-content: center; border-radius: var(--radius-btn); border: 1px solid var(--tb-border-strong);
  background: transparent; color: var(--tb-text-secondary); }
.agx-ibtn.sm { width: 32px; height: 32px; }
.agx-ibtn:hover { color: var(--tb-text); border-color: var(--border-hover); background: var(--surface-2); }

.agx-pill { display: inline-flex; align-items: center; gap: 5px; height: 22px;
  padding: 0 9px; border-radius: 999px; font-size: calc(12px * var(--z));
  font-weight: 600; border: 1px solid transparent; white-space: nowrap; flex: none; }
.agx-pill .agx-ico { width: 16px; height: 16px; }
.agx-pill.ready, .agx-pill.mine, .agx-pill.connected
  { color: var(--tb-success-text); background: var(--tb-success-soft); }
.agx-pill.partly, .agx-pill.needed, .agx-pill.warn, .agx-pill.not_ready
  { color: var(--tb-warning-text); background: var(--tb-warning-soft); }
.agx-pill.builtin, .agx-pill.optional, .agx-pill.waiting, .agx-pill.muted
  { color: var(--tb-text-secondary); border-color: var(--tb-border-strong); }
.agx-pill.team, .agx-pill.shared
  { color: var(--tb-accent-text); background: var(--tb-accent-soft); }
/* [agr1-template-v1] restored classic agents/workflows ship as Templates */
.agx-pill.template { color: var(--tb-accent-text); background: var(--tb-accent-soft);
  border-color: var(--tb-accent-border); }

.agx-seclabel { font-size: calc(12px * var(--z)); letter-spacing: .08em;
  text-transform: uppercase; color: var(--tb-text-muted); font-weight: 600;
  margin: 0 0 12px; }

/* ---------- column 1: teams ---------- */
.agx-side { width: 240px; min-width: 240px; background: var(--list);
  border-right: 1px solid var(--tb-border); padding: 16px 14px;
  display: flex; flex-direction: column; gap: 14px; overflow-y: auto;
  scrollbar-width: thin; scrollbar-color: var(--tb-border-strong) transparent; }
.agx-side h2 { margin: 0; font-size: calc(20px * var(--z)); font-weight: 700; line-height: 1.25; }
.agx-side .agx-new { width: 100%; height: 36px; padding: 0 14px; font-size: 13px; font-weight: 600; border-radius: var(--radius-btn, 8px); justify-content: center; }
.agx-side .agx-seclabel { margin: 6px 0 -6px 4px; }
.agx-teams { display: flex; flex-direction: column; gap: 2px; }
.agx-team { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 38px;
  border: 1px solid transparent; background: transparent; color: var(--tb-text-secondary);
  padding: 6px 8px; border-radius: var(--radius-btn); text-align: left;
  font-size: calc(13.5px * var(--z)); font-weight: 500; }
.agx-team:hover { background: var(--surface-2); color: var(--tb-text); }
.agx-team .ic { width: 28px; height: 28px; border-radius: 8px; display: flex; flex: none;
  align-items: center; justify-content: center; background: var(--surface-2);
  color: var(--tb-text-secondary); }
.agx-team .ic .agx-ico { width: 17px; height: 17px; }
.agx-team .t { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.agx-team .n { color: var(--tb-text-muted); font-size: calc(12px * var(--z));
  font-variant-numeric: tabular-nums; }
.agx-team[aria-pressed="true"] { background: var(--selected-fill); color: var(--tb-text);
  border-color: color-mix(in srgb, var(--tb-accent-border) 40%, transparent); }
.agx-team[aria-pressed="true"] .ic { color: var(--tb-accent-text); }

/* [AGX4] thin scrollbars on the three scrolling columns: a 6px rounded
   thumb instead of the browser's thick default bar */
.agx-side::-webkit-scrollbar, .agx-list::-webkit-scrollbar,
.agx-main::-webkit-scrollbar { width: 6px; }
.agx-side::-webkit-scrollbar-thumb, .agx-list::-webkit-scrollbar-thumb,
.agx-main::-webkit-scrollbar-thumb { background: var(--tb-border-strong); border-radius: 999px; }
.agx-side::-webkit-scrollbar-thumb:hover, .agx-list::-webkit-scrollbar-thumb:hover,
.agx-main::-webkit-scrollbar-thumb:hover { background: var(--border-hover); }
.agx-side::-webkit-scrollbar-track, .agx-list::-webkit-scrollbar-track,
.agx-main::-webkit-scrollbar-track { background: transparent; }

/* ---------- column 2: list ---------- */
.agx-list { width: 380px; min-width: 300px; border-right: 1px solid var(--tb-border);
  padding: 16px; overflow-y: auto; background: var(--bg);
  scrollbar-width: thin; scrollbar-color: var(--tb-border-strong) transparent; }
.agx-tools { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; }
.agx-tools .agx-search { flex: 1; min-width: 0; margin-bottom: 0; }
.agx-search { display: flex; align-items: center; gap: 8px; background: var(--tb-surface);
  border: 1px solid var(--tb-border-strong); border-radius: var(--radius-input, 8px); padding: 0 10px;
  height: 36px; margin-bottom: 0; }
.agx-search:focus-within { border-color: var(--tb-accent-border); }
.agx-search .agx-search-ico { width: 16px; height: 16px; flex: none;
  fill: none; stroke: var(--tb-text-muted); stroke-width: 2;
  stroke-linecap: round; stroke-linejoin: round; }
.agx-search input { flex: 1; min-width: 0; border: 0; background: transparent; outline: none; font-size: 13px; }
.agx-search input::placeholder { color: var(--tb-placeholder); }
.agx-group { margin-bottom: 14px; }
/* [AGX4 collapse-v1] group header = fold button (chevron · name · count) */
.agx-group > .h { display: flex; align-items: center; gap: 8px; width: 100%;
  height: 32px; margin: 0 0 8px; padding: 0 6px; border: 0; border-radius: var(--radius-btn);
  background: transparent; color: var(--tb-text-secondary); text-align: left; }
.agx-group > .h:hover { background: var(--surface-2); color: var(--tb-text); }
.agx-group > .h .chev { width: 18px; height: 18px; color: var(--tb-text-muted);
  transition: transform 150ms ease-out; }
.agx-group.shut > .h .chev { transform: rotate(-90deg); }
.agx-group > .h .t { flex: 1; font-size: calc(13px * var(--z)); font-weight: 600; }
.agx-group > .h .n { color: var(--tb-text-muted); font-size: calc(12px * var(--z));
  font-variant-numeric: tabular-nums; }
.agx-group.shut > .rows { display: none; }
.agx-acard { background: var(--tb-surface); border: 1px solid var(--tb-border);
  border-radius: var(--radius-card); padding: 14px 16px; margin-bottom: 10px; cursor: pointer;
  transition: border-color 120ms ease-out; }
.agx-acard:hover { border-color: var(--tb-border-strong); }
.agx-acard.sel { border-color: var(--tb-accent-border);
  background: color-mix(in srgb, var(--tb-accent) 7%, var(--tb-surface)); }
.agx-acard .t { font-size: calc(14.5px * var(--z)); font-weight: 600; margin-bottom: 4px; }
.agx-acard .s { color: var(--tb-text-muted); font-size: calc(13px * var(--z)); line-height: 1.45;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden; margin-bottom: 10px; }
.agx-acard .pills { display: flex; gap: 6px; flex-wrap: wrap; }
.agx-hint { color: var(--tb-text-muted); font-size: calc(13px * var(--z)); }
.agx-link { display: inline-flex; align-items: center; gap: 4px; background: none; border: 0;
  color: var(--tb-accent-text); padding: 0; font-weight: 600; font-size: calc(13px * var(--z)); }
.agx-link .agx-ico { width: 18px; height: 18px; }
.agx-link:hover { color: var(--tb-accent-hover); }

/* skeletons - brandkit's global bk-shimmer, no page-local keyframes */
.agx-skel { border-radius: var(--radius-card); height: 84px; margin-bottom: 10px;
  background: linear-gradient(90deg, var(--tb-surface) 0%, var(--tb-surface-2) 45%, var(--tb-surface) 90%);
  background-size: 200% 100%; animation: bk-shimmer 1.8s linear infinite;
  border: 1px solid var(--tb-border); }
.agx-detail-skel .agx-skel { margin-bottom: 14px; }
.agx-detail-skel .agx-skel.t { height: 34px; width: 55%; }
.agx-detail-skel .agx-skel.m { height: 22px; width: 30%; }
.agx-detail-skel .agx-skel.p { height: 16px; width: 90%; }
.agx-detail-skel .agx-skel.box { height: 160px; }

/* ---------- column 3: detail / agent page ---------- */
.agx-main { flex: 1; min-width: 0; overflow-y: auto; padding: 28px 32px 48px;
  background: var(--bg);
  scrollbar-width: thin; scrollbar-color: var(--tb-border-strong) transparent; }
.agx-crumb { color: var(--tb-text-muted); font-size: calc(13px * var(--z));
  margin-bottom: 18px; }
.agx-crumb b { color: var(--tb-text); font-weight: 600; }
.agx-crumb .agx-link { font-size: inherit; }
.agx-head { display: flex; align-items: flex-start; gap: 16px; margin-bottom: 10px; }
.agx-head h1 { margin: 0; min-width: 0; font-size: calc(26px * var(--z)); font-weight: 700;
  line-height: 1.2; letter-spacing: -.01em; }
.agx-head .sp { flex: 1; }
.agx-head .acts { display: flex; gap: 8px; align-items: center; flex: none; }
/* [prjx3-x-corner-v1] / [NAV1] RETIRED with #viewclose — see Removed-for-redesign.md 1.2
.agx-head { padding-right: 26px; } */
.agx-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  color: var(--tb-text-muted); font-size: calc(13px * var(--z)); margin-bottom: 18px; }
.agx-meta .agx-link { margin-left: 4px; }
.agx-rename-in { font-size: calc(24px * var(--z)); font-weight: 700;
  background: var(--tb-surface); border: 1px solid var(--tb-accent-border);
  border-radius: var(--radius-input); padding: 4px 10px; }
.agx-lead { color: var(--tb-text-secondary); font-size: calc(15px * var(--z));
  line-height: 1.6; max-width: 820px; margin: 0 0 18px; }

.agx-banner { display: flex; align-items: center; gap: 10px;
  border: 1px solid var(--tb-success); background: var(--tb-success-soft);
  color: var(--tb-text); border-radius: var(--radius-card); padding: 12px 16px; margin-bottom: 20px; }
.agx-banner.warn { border-color: var(--tb-warning); background: var(--tb-warning-soft); }
.agx-banner .x { margin-left: auto; background: none; border: 0;
  color: var(--tb-text-muted); font-size: calc(16px * var(--z)); }

.agx-tabs { display: flex; gap: 22px; border-bottom: 1px solid var(--tb-border);
  margin-bottom: 24px; }
.agx-tabs button { background: none; border: 0; color: var(--tb-text-secondary);
  padding: 10px 2px 12px; font-weight: 600; border-bottom: 2px solid transparent;
  display: inline-flex; gap: 8px; align-items: center; }
.agx-tabs button.on { color: var(--tb-text); border-bottom-color: var(--tb-accent-border); }

/* readiness alert (screenshot: amber box, icon + bold level + one line) */
.agx-rd { display: flex; align-items: flex-start; gap: 12px; border-radius: var(--radius-card);
  border: 1px solid var(--tb-border); background: var(--tb-surface);
  padding: 14px 16px; margin-bottom: 16px; }
.agx-rd .agx-rd-ic { flex: none; display: flex; margin-top: 1px; }
.agx-rd .agx-rd-ic .agx-ico { width: 22px; height: 22px; }
.agx-rd .agx-rd-b { min-width: 0; }
.agx-rd .lvl { font-weight: 700; font-size: calc(14px * var(--z)); margin-bottom: 2px; }
.agx-rd .m { color: var(--tb-text-secondary); font-size: calc(13px * var(--z)); line-height: 1.5; }
.agx-rd.partly, .agx-rd.not_ready {
  border-color: color-mix(in srgb, var(--tb-warning) 45%, transparent);
  background: var(--tb-warning-soft); }
.agx-rd.partly .agx-rd-ic, .agx-rd.partly .lvl,
.agx-rd.not_ready .agx-rd-ic, .agx-rd.not_ready .lvl { color: var(--tb-warning-text); }
.agx-rd.ready { border-color: color-mix(in srgb, var(--tb-success) 40%, transparent);
  background: var(--tb-success-soft); }
.agx-rd.ready .agx-rd-ic, .agx-rd.ready .lvl { color: var(--tb-success-text); }

/* the 2x2 detail grid */
.agx-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.agx-grid > .agx-box { margin-bottom: 0; }

.agx-cols { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(280px, 1fr);
  gap: 20px; align-items: start; }
.agx-box { background: var(--tb-surface); border: 1px solid var(--tb-border);
  border-radius: var(--radius-card); padding: 16px 18px; margin-bottom: 16px; min-width: 0; }
.agx-box ul { margin: 0; padding-left: 18px; color: var(--tb-text-secondary); }
.agx-box li { margin: 6px 0; font-size: calc(13.5px * var(--z)); line-height: 1.45; }
.agx-boxhead { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.agx-boxhead .agx-seclabel { margin: 0; }
.agx-asks { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }
.agx-ask { display: block; max-width: 100%; text-align: left; background: var(--tb-surface-2);
  border: 1px solid var(--tb-border); color: var(--tb-text); border-radius: var(--radius-input);
  padding: 7px 12px; margin: 6px 0; font-size: calc(13px * var(--z)); }
.agx-asks .agx-ask { margin: 0; }
.agx-ask:hover { border-color: var(--tb-accent-border); }

.agx-rule { display: flex; align-items: flex-start; gap: 10px; padding: 5px 0; margin: 0;
  color: var(--tb-text-secondary); font-size: calc(13.5px * var(--z)); line-height: 1.45; }
.agx-rule .lk { flex: none; display: flex; margin-top: 2px; color: var(--tb-text-muted); }
.agx-rule .lk .agx-ico { width: 18px; height: 18px; }
.agx-rule .b { flex: 1; min-width: 0; }
.agx-rule .sub { color: var(--tb-text-muted); font-size: calc(12px * var(--z)); }
.agx-rule .agx-pill { flex: none; }

.agx-srcrow { display: flex; align-items: center; gap: 12px;
  border-top: 1px solid var(--tb-border); padding: 10px 0; }
.agx-boxhead + .agx-srcrow, .agx-box > .agx-srcrow:first-child { border-top: 0; }
.agx-srcrow .lg { width: 32px; height: 32px; border-radius: 8px; flex: none;
  background: var(--tb-surface-2); border: 1px solid var(--tb-border);
  display: flex; align-items: center; justify-content: center; font-weight: 700;
  font-size: calc(12px * var(--z)); color: var(--tb-text-secondary); }
.agx-srcrow .lg .agx-ico { width: 19px; height: 19px; }
.agx-srcrow .b { flex: 1; min-width: 0; }
.agx-srcrow .t { font-weight: 600; font-size: calc(13.5px * var(--z));
  display: flex; gap: 8px; align-items: center; }
.agx-srcrow .d { color: var(--tb-text-muted); font-size: calc(12.5px * var(--z)); }
.agx-srcrow .act { flex: none; display: flex; align-items: center; gap: 8px;
  color: var(--tb-text-muted); font-size: calc(13px * var(--z)); }
.agx-srcrow .ok { color: var(--tb-success-text); font-weight: 600; }

.agx-sugg { display: flex; align-items: center; gap: 12px;
  background: var(--tb-surface); border: 1px solid var(--tb-border);
  border-radius: var(--radius-card); padding: 10px 14px; }
.agx-sugg .b { flex: 1; min-width: 0; }
.agx-sugg .add { width: 32px; height: 32px; border-radius: 8px;
  border: 1px solid var(--tb-border-strong); background: transparent;
  color: var(--tb-text); font-size: calc(17px * var(--z)); }

/* setup checklist (overview) */
.agx-check { display: flex; align-items: center; gap: 12px;
  background: var(--tb-surface); border: 1px solid var(--tb-border);
  border-radius: var(--radius-card); padding: 14px 16px; margin-bottom: 10px; }
.agx-check .ic { width: 28px; height: 28px; border-radius: 999px; flex: none;
  display: flex; align-items: center; justify-content: center; font-size: calc(13px * var(--z)); }
.agx-check .ic.done { background: var(--tb-success-soft); color: var(--tb-success-text); }
.agx-check .ic.todo { background: var(--tb-warning-soft); color: var(--tb-warning-text); }
.agx-check .b { flex: 1; }
.agx-check .s { color: var(--tb-text-muted); font-size: calc(13px * var(--z)); }

/* menus, dialogs, toasts (kit 11: panel fill, border-2, large shadow).
   [AGX4] these are appended to <body>, OUTSIDE .agx, so they never got the
   page's --z or font: the "Hide from my list" menu came out in the
   browser's big default button type. They carry the scope themselves. */
.agx-ovl button { font-family: inherit; cursor: pointer; }
.agx-menu { position: absolute; z-index: 60; min-width: 200px;
  background: var(--tb-bg-panel); border: 1px solid var(--tb-border-strong);
  border-radius: 14px; padding: 6px; box-shadow: var(--shadow-pop);
  --z: var(--uz, 1); font-family: var(--font); font-size: calc(14px * var(--z)); line-height: 1.4; }
.agx-menu button { display: flex; width: 100%; text-align: left; gap: 10px;
  background: none; border: 0; color: var(--tb-text); padding: 9px 10px;
  border-radius: var(--radius-btn); font-size: calc(13.5px * var(--z)); font-family: inherit; }
.agx-menu button:hover { background: var(--surface-2); }
.agx-menu .sep { height: 1px; background: var(--tb-border); margin: 6px 4px; }
.agx-menu button.danger { color: var(--tb-danger); }

.agx-ovl { position: fixed; inset: 0; z-index: 70;
  background: color-mix(in srgb, var(--tb-bg) 70%, transparent);
  display: flex; align-items: center; justify-content: center;
  --z: var(--uz, 1); font-family: var(--font); font-size: calc(14px * var(--z)); line-height: 1.4; }
.agx-dlg { width: min(460px, 92vw); background: var(--tb-bg-panel);
  border: 1px solid var(--tb-border-strong); border-radius: 18px; padding: 22px;
  box-shadow: var(--shadow-pop); }
.agx-dlg h3 { margin: 0 0 8px; font-size: calc(18px * var(--z)); font-weight: 700; }
.agx-dlg p { color: var(--tb-text-secondary); margin: 0 0 18px; line-height: 1.5; }
.agx-dlg ul.cons { margin: 0 0 6px; padding-left: 18px; }
.agx-dlg ul.cons li { font-size: 14px; line-height: 1.55;
  color: var(--tb-text-secondary); margin: 4px 0; }
.agx-dlg .acts { display: flex; justify-content: flex-end; gap: 10px; }
.agx-dlg .dic { width: 40px; height: 40px; border-radius: 12px;
  background: var(--tb-danger-soft); color: var(--tb-danger); display: flex;
  align-items: center; justify-content: center; margin-bottom: 12px; }
.agx-dlg .dic .agx-ico { width: 24px; height: 24px; }

.agx-toast {
  position: fixed;
  top: 24px;
  right: 24px;
  left: auto;
  bottom: auto;
  transform: none;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  z-index: 99999;
  border-radius: 12px;
  padding: 11px 18px;
  font-size: 13.5px;
  font-weight: 500;
  max-width: min(440px, calc(100vw - 32px));
  box-shadow: 0 12px 28px -4px rgba(0, 0, 0, 0.38), 0 4px 12px rgba(0, 0, 0, 0.2);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  animation: agx-toast-in 0.25s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  transition: opacity 0.22s ease-out, transform 0.22s ease-out;
  background: color-mix(in srgb, #84cc16 13%, #14171f);
  border: 1px solid color-mix(in srgb, #84cc16 38%, transparent);
  color: #d9f99d;
  pointer-events: auto;
}
@keyframes agx-toast-in {
  from { opacity: 0; transform: translateY(-12px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.agx-toast .agx-ico {
  width: 18px;
  height: 18px;
  flex: none;
  color: #a3e635;
}
.agx-toast-txt {
  line-height: 1.4;
  word-break: break-word;
}
:root[data-theme="light"] .agx-toast {
  background: color-mix(in srgb, #2563eb 8%, #ffffff);
  border: 1px solid #bfdbfe;
  color: #1d4ed8;
  box-shadow: 0 12px 28px -4px rgba(37, 99, 235, 0.15), 0 2px 8px rgba(0, 0, 0, 0.05);
}
:root[data-theme="light"] .agx-toast .agx-ico {
  color: #2563eb;
}
.agx-toast.err {
  background: color-mix(in srgb, #ef4444 14%, #14171f);
  border: 1px solid color-mix(in srgb, #ef4444 40%, transparent);
  color: #fca5a5;
  box-shadow: 0 12px 28px -4px rgba(0, 0, 0, 0.45), 0 0 16px rgba(239, 68, 68, 0.16);
}
.agx-toast.err .agx-ico {
  color: #ef4444;
}
:root[data-theme="light"] .agx-toast.err {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #b91c1c;
  box-shadow: 0 12px 28px -4px rgba(239, 68, 68, 0.15), 0 2px 8px rgba(0, 0, 0, 0.05);
}
:root[data-theme="light"] .agx-toast.err .agx-ico {
  color: #dc2626;
}

/* chat editor (instructions tab + builder) */
.agx-chat { display: flex; flex-direction: column; background: var(--tb-surface);
  border: 1px solid var(--tb-border); border-radius: var(--radius-card); min-height: 420px;
  max-height: calc(100vh - 300px); }
.agx-chat .hd { padding: 14px 16px; border-bottom: 1px solid var(--tb-border); }
.agx-chat .hd b { display: block; }
.agx-chat .hd span { color: var(--tb-text-muted); font-size: calc(12px * var(--z)); }
.agx-chat .log { flex: 1; overflow-y: auto; padding: 14px 16px; }
.agx-chat .msg { margin-bottom: 12px; }
.agx-chat .msg.user { display: flex; justify-content: flex-end; }
.agx-chat .msg.user .bub { background: var(--tb-accent-soft); color: var(--tb-text);
  border-radius: 12px; padding: 9px 13px; max-width: 86%; }
.agx-chat .msg.assistant .md { background: var(--tb-surface-2);
  border: 1px solid var(--tb-border); border-radius: 12px; padding: 10px 13px; }
.agx-chat .cmp { display: flex; gap: 10px; padding: 12px 14px; align-items: flex-end;
  border-top: 1px solid var(--tb-border); }
.agx-chat .cmp textarea { flex: 1; resize: none; background: var(--bg);
  border: 1px solid var(--tb-border-strong); border-radius: var(--radius-input); padding: 10px 12px;
  min-height: 40px; outline: none; }
.agx-chat .cmp textarea:focus { border-color: var(--tb-accent-border); }
.agx-think { color: var(--tb-text-muted); font-style: italic;
  display: inline-flex; align-items: center; gap: 8px; }

.agx-savebar { position: sticky; bottom: 0; display: flex; align-items: center;
  gap: 12px; background: var(--tb-bg-panel); border: 1px solid var(--tb-border);
  border-radius: var(--radius-card); padding: 10px 16px; margin-top: 14px; }
.agx-savebar .dot { width: 8px; height: 8px; border-radius: 999px;
  background: var(--tb-warning); }
.agx-savebar .sp { flex: 1; }

/* empty state (no agents at all) */
.agx-empty { max-width: 860px; margin: 40px auto; text-align: center; }
.agx-empty .glyph { width: 52px; height: 52px; border-radius: 14px; margin: 0 auto 18px;
  background: var(--tb-accent-soft); color: var(--tb-accent-text); display: flex;
  align-items: center; justify-content: center; }
.agx-empty .glyph .agx-ico { width: 26px; height: 26px; }
.agx-empty h1 { font-size: calc(26px * var(--z)); margin: 0 0 8px; }
.agx-empty p { color: var(--tb-text-secondary); font-size: calc(15px * var(--z));
  margin: 0 auto 22px; max-width: 560px; line-height: 1.55; }
.agx-empty .row { display: flex; gap: 10px; background: var(--tb-surface);
  border: 1px solid var(--tb-border); border-radius: 14px; padding: 10px;
  margin-bottom: 26px; }
.agx-empty .row input { flex: 1; background: transparent; border: 0; outline: none;
  padding: 0 10px; font-size: calc(15px * var(--z)); }

/* [BK12 error-v1] error state: glyph + what happened + what to do + action */
.agx-error { max-width: 560px; margin: 28px auto; text-align: left; }
.agx-error .glyph { width: 44px; height: 44px; border-radius: 12px; margin: 0 0 14px;
  background: var(--tb-warning-soft); color: var(--tb-warning); display: flex;
  align-items: center; justify-content: center; }
.agx-error .glyph .agx-ico { width: 24px; height: 24px; }
.agx-error h3 { margin: 0 0 8px; font-size: calc(18px * var(--z)); font-weight: 700; }
.agx-error p { color: var(--tb-text-secondary); font-size: calc(14px * var(--z));
  margin: 0 0 6px; line-height: 1.55; }
.agx-error p.do { color: var(--tb-text); font-weight: 600; margin-bottom: 16px; }
.agx-error .agx-btn { margin-top: 4px; }
.agx-tpls { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 14px; text-align: left; }
.agx-tpl { background: var(--tb-surface); border: 1px solid var(--tb-border);
  border-radius: var(--radius-card); padding: 16px; cursor: pointer; }
.agx-tpl:hover { border-color: var(--tb-accent-border); }
.agx-tpl .ic { width: 32px; height: 32px; border-radius: 9px; background: var(--tb-accent-soft);
  color: var(--tb-accent-text); display: flex; align-items: center; justify-content: center;
  margin-bottom: 10px; }
.agx-tpl .t { font-weight: 600; margin-bottom: 4px; }
.agx-tpl .d { color: var(--tb-text-secondary); font-size: calc(13px * var(--z));
  margin-bottom: 8px; }
.agx-tpl .m { color: var(--tb-text-muted); font-size: calc(12px * var(--z)); }

/* ===== [prjx3 agent-files-v1] knowledge files on the Sources tab */
.agx-filebtns { margin-top: 10px; }

/* ===== [split-drag-v1] draggable pane dividers on the home three-pane.
   [AGX3] transparent hit strip laid over the column's own border (it used
   to draw a second border-right next to it = a doubled line). */
.agx-split { width: 6px; min-width: 6px; margin-left: -6px; padding: 0; border: none;
  background: transparent; cursor: col-resize; align-self: stretch; position: relative; z-index: 2; }
.agx-split:hover { background: var(--tb-accent-soft); }

@media (max-width: 1100px) {
  .agx-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 767px) {
  .agx { flex-direction: column; overflow-y: auto; }
  .agx-side, .agx-list { width: 100% !important; min-width: 0; border-right: 0;
    border-bottom: 1px solid var(--tb-border); }
  .agx-main { padding: 20px 16px; }
  .agx-cols { grid-template-columns: 1fr; }
  .agx-split { display: none; }
}
@media (min-width: 768px) and (max-width: 1023px) {
  .agx { flex-direction: row; overflow: hidden; }
}
@media (prefers-reduced-motion: reduce) {
  .agx-skel { animation: none; }
  .agx-btn, .agx-acard, .agx-group > .h .chev { transition: none; }
}
