/* ==========================================================================
   Admin Console — design tokens + base styles.
   Themes via [data-theme="dark"|"light"] on the artboard root.
   ========================================================================== */

.ac-root {
  /* Type */
  --font-sans: 'Geist', ui-sans-serif, system-ui, sans-serif;
  --font-mono: 'Geist Mono', ui-monospace, 'JetBrains Mono', monospace;
  --fs-xs: 11px;
  --fs-sm: 12px;
  --fs-md: 13px;
  --fs-lg: 14px;
  --fs-xl: 16px;
  --fs-2xl: 20px;
  --lh: 1.45;

  /* Accent (shared across themes) */
  --accent: #7c5cff;
  --accent-fg: #ffffff;
  --accent-soft: rgba(124, 92, 255, 0.14);
  --accent-line: rgba(124, 92, 255, 0.32);

  /* Status */
  --st-green: #3ecf8e;
  --st-amber: #f5a524;
  --st-red:   #ff5d5d;
  --st-gray:  #8a8f98;

  /* Source badges */
  --src-builtin-bg: rgba(255,255,255,0.06);
  --src-builtin-fg: #b4b8c0;
  --src-plugin-bg:  rgba(80, 145, 255, 0.14);
  --src-plugin-fg:  #6fa8ff;
  --src-custom-bg:  rgba(124, 92, 255, 0.16);
  --src-custom-fg:  #b59cff;

  /* Density */
  --row-h: 32px;
  --hd-h: 30px;

  font-family: var(--font-sans);
  font-size: var(--fs-md);
  line-height: var(--lh);
  color: var(--fg);
  background: var(--bg);
  font-feature-settings: 'cv11', 'ss01';
  -webkit-font-smoothing: antialiased;
}

/* ---------- Dark theme ---------- */
.ac-root[data-theme="dark"] {
  --bg:           #0b0d10;
  --bg-2:         #111418;
  --bg-3:         #161a20;
  --bg-hover:     rgba(255,255,255,0.04);
  --bg-active:    rgba(255,255,255,0.06);
  --panel:        #0e1115;
  --sidebar-bg:   #0a0c0f;
  --topbar-bg:    rgba(11,13,16,0.85);
  --drawer-bg:    #0e1116;
  --modal-bg:     #14181d;

  --fg:           #e6e8ec;
  --fg-strong:    #f6f7f8;
  --fg-dim:       #9aa0a8;
  --fg-faint:     #6b7079;

  --border:       rgba(255,255,255,0.07);
  --border-strong:rgba(255,255,255,0.12);
  --border-input: rgba(255,255,255,0.10);

  --scrim:        rgba(0,0,0,0.55);
  --shadow-drawer: -20px 0 40px rgba(0,0,0,0.45);
  --shadow-pop: 0 12px 32px rgba(0,0,0,0.5), 0 0 0 1px rgba(255,255,255,0.06);

  --src-builtin-bg: rgba(255,255,255,0.06);
  --src-builtin-fg: #b4b8c0;
}

/* ---------- Light theme ---------- */
.ac-root[data-theme="light"] {
  --bg:           #fbfbfa;
  --bg-2:         #f4f4f3;
  --bg-3:         #ededec;
  --bg-hover:     rgba(0,0,0,0.035);
  --bg-active:    rgba(0,0,0,0.055);
  --panel:        #ffffff;
  --sidebar-bg:   #f7f7f6;
  --topbar-bg:    rgba(251,251,250,0.85);
  --drawer-bg:    #ffffff;
  --modal-bg:     #ffffff;

  --fg:           #1a1d21;
  --fg-strong:    #0a0c0f;
  --fg-dim:       #5a6068;
  --fg-faint:     #8a8f98;

  --border:       rgba(0,0,0,0.075);
  --border-strong:rgba(0,0,0,0.12);
  --border-input: rgba(0,0,0,0.12);

  --scrim:        rgba(20,22,26,0.18);
  --shadow-drawer: -16px 0 40px rgba(20,22,26,0.10);
  --shadow-pop: 0 12px 32px rgba(20,22,26,0.12), 0 0 0 1px rgba(0,0,0,0.06);

  --st-green: #15a571;
  --st-amber: #d18800;
  --st-red:   #d63b3b;
  --st-gray:  #7a8089;

  --src-builtin-bg: rgba(0,0,0,0.05);
  --src-builtin-fg: #4a4f57;
  --src-plugin-bg:  rgba(40, 100, 220, 0.10);
  --src-plugin-fg:  #2a5fb8;
  --src-custom-bg:  rgba(102, 70, 230, 0.10);
  --src-custom-fg:  #5b3fb5;
}

/* ---------- Resets within the artboard only ---------- */
.ac-root *, .ac-root *::before, .ac-root *::after { box-sizing: border-box; }
:where(.ac-root) button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
.ac-root input, .ac-root textarea, .ac-root select { font: inherit; color: inherit; }
.ac-root a { color: inherit; text-decoration: none; }
.ac-root ::selection { background: var(--accent-soft); }

/* ---------- App shell ---------- */
.ac-app { display: flex; width: 100%; height: 100%; background: var(--bg); color: var(--fg); position: relative; overflow: hidden; }

/* Sidebar */
.ac-sidebar {
  width: 220px; flex: 0 0 220px;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  transition: width .18s cubic-bezier(.2,.7,.3,1), flex-basis .18s cubic-bezier(.2,.7,.3,1);
}
.ac-sidebar.collapsed { width: 56px; flex-basis: 56px; }
.ac-logo {
  height: 48px; display: flex; align-items: center; gap: 10px;
  padding: 0 14px; border-bottom: 1px solid var(--border);
  color: var(--fg-strong); font-weight: 600; letter-spacing: -0.01em;
}
.ac-logo-mark {
  width: 22px; height: 22px; border-radius: 6px; flex: 0 0 22px;
  background: linear-gradient(135deg, var(--accent), #5a3fe8);
  display: grid; place-items: center; color: #fff; font-family: var(--font-mono); font-size: 11px; font-weight: 700;
}
.ac-nav { padding: 8px; display: flex; flex-direction: column; gap: 1px; flex: 1; overflow: hidden; }
.ac-nav-section { padding: 10px 8px 4px; font-size: var(--fs-xs); color: var(--fg-faint); text-transform: uppercase; letter-spacing: 0.06em; }
.ac-nav-item {
  display: flex; align-items: center; gap: 10px;
  height: 30px; padding: 0 8px; border-radius: 6px;
  color: var(--fg-dim); font-size: var(--fs-md);
  cursor: pointer; white-space: nowrap; overflow: hidden;
  transition: background .12s, color .12s;
}
.ac-nav-item:hover { background: var(--bg-hover); color: var(--fg); }
.ac-nav-item.active { background: var(--bg-active); color: var(--fg-strong); }
.ac-nav-item.active .ac-nav-icon { color: var(--accent); }
.ac-nav-icon { display: flex; flex: 0 0 16px; color: var(--fg-faint); }
.ac-nav-item.active .ac-nav-icon, .ac-nav-item:hover .ac-nav-icon { color: inherit; }
.ac-nav-count { margin-left: auto; font-family: var(--font-mono); font-size: var(--fs-xs); color: var(--fg-faint); }
.ac-sidebar.collapsed .ac-nav-label, .ac-sidebar.collapsed .ac-nav-count, .ac-sidebar.collapsed .ac-logo-text, .ac-sidebar.collapsed .ac-sidebar-footer { display: none; }
.ac-sidebar.collapsed .ac-nav-item { justify-content: center; padding: 0; }

.ac-sidebar-footer {
  padding: 10px 12px; border-top: 1px solid var(--border);
  font-size: var(--fs-xs); color: var(--fg-faint);
  display: flex; align-items: center; gap: 8px;
}
.ac-env-pill {
  font-family: var(--font-mono); font-size: 10px; font-weight: 600;
  padding: 2px 6px; border-radius: 4px;
  background: var(--accent-soft); color: var(--accent);
  text-transform: uppercase; letter-spacing: 0.04em;
}
.ac-env-pill.dev { background: rgba(62,207,142,0.12); color: var(--st-green); }
.ac-env-pill.stg { background: rgba(245,165,36,0.14); color: var(--st-amber); }
.ac-env-pill.prd { background: rgba(255,93,93,0.12); color: var(--st-red); }

/* Main column */
.ac-main { flex: 1; display: flex; flex-direction: column; min-width: 0; }

/* Topbar */
.ac-topbar {
  position: relative; z-index: 40;
  height: 48px; flex: 0 0 48px;
  display: flex; align-items: center; gap: 12px;
  padding: 0 16px; border-bottom: 1px solid var(--border);
  background: var(--topbar-bg); backdrop-filter: blur(8px);
}
.ac-breadcrumb { display: flex; align-items: center; gap: 6px; color: var(--fg-dim); font-size: var(--fs-md); }
.ac-breadcrumb b { color: var(--fg-strong); font-weight: 500; }
.ac-breadcrumb .sep { color: var(--fg-faint); }
.ac-kbar {
  display: flex; align-items: center; gap: 8px;
  height: 28px; padding: 0 10px; min-width: 280px;
  border: 1px solid var(--border-input); border-radius: 6px;
  background: var(--bg-2); color: var(--fg-dim); font-size: var(--fs-sm);
  cursor: pointer; transition: background .12s, border-color .12s;
}
.ac-kbar:hover { background: var(--bg-3); border-color: var(--border-strong); }
.ac-kbar .kbd { margin-left: auto; display: flex; align-items: center; gap: 2px; }
.ac-kbd {
  font-family: var(--font-mono); font-size: 10px; font-weight: 500;
  background: var(--bg-3); color: var(--fg-dim);
  padding: 1px 5px; border-radius: 3px; border: 1px solid var(--border);
  min-width: 16px; text-align: center;
}
.ac-topbar-right { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.ac-icon-btn {
  width: 28px; height: 28px; display: grid; place-items: center;
  border-radius: 6px; color: var(--fg-dim);
  transition: background .12s, color .12s;
}
.ac-icon-btn:hover { background: var(--bg-hover); color: var(--fg); }
.ac-icon-btn.active { background: var(--bg-active); color: var(--fg-strong); }

.ac-avatar {
  width: 24px; height: 24px; border-radius: 50%;
  background: linear-gradient(135deg, #5a3fe8, #7c5cff);
  display: grid; place-items: center; color: #fff;
  font-size: 10px; font-weight: 600; font-family: var(--font-mono);
}

/* Page area */
.ac-page { flex: 1; overflow: auto; position: relative; }
.ac-page-h {
  display: flex; align-items: center; gap: 14px;
  padding: 18px 20px 14px;
}
.ac-page-h h1 { font-size: var(--fs-2xl); font-weight: 600; letter-spacing: -0.015em; color: var(--fg-strong); margin: 0; }
.ac-page-h .sub { color: var(--fg-dim); font-size: var(--fs-md); }
.ac-page-h-right { margin-left: auto; display: flex; gap: 8px; align-items: center; }

/* Buttons */
.ac-btn {
  display: inline-flex; align-items: center; gap: 6px;
  height: 28px; padding: 0 10px;
  border-radius: 6px; border: 1px solid var(--border-input);
  background: var(--bg-2); color: var(--fg);
  font-size: var(--fs-sm); font-weight: 500;
  transition: background .12s, border-color .12s, color .12s;
}
.ac-btn:hover { background: var(--bg-3); border-color: var(--border-strong); }
.ac-btn.primary {
  background: linear-gradient(180deg, #8a6dff 0%, var(--accent) 100%);
  color: var(--accent-fg); border-color: transparent;
  box-shadow: 0 1px 2px rgba(0,0,0,0.3), 0 4px 12px -3px var(--accent-line);
}
.ac-btn.primary:hover { background: linear-gradient(180deg, #7d5dff 0%, #6c4cef 100%); box-shadow: 0 1px 2px rgba(0,0,0,0.3), 0 6px 16px -3px var(--accent-line); }
.ac-btn.primary:active { transform: translateY(0.5px); box-shadow: 0 1px 2px rgba(0,0,0,0.3); }
.ac-btn.primary:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--accent-soft), 0 0 0 1px var(--accent); }
.ac-btn.primary .icon { color: var(--accent-fg); opacity: 0.92; }
.ac-btn.ghost { background: transparent; border-color: transparent; color: var(--fg-dim); }
.ac-btn.ghost:hover { background: var(--bg-hover); color: var(--fg); }
.ac-btn.danger { color: var(--st-red); border-color: var(--st-red); }
.ac-btn.danger:hover { background: rgba(255,93,93,0.08); }
.ac-btn[disabled] { opacity: 0.5; pointer-events: none; }
.ac-btn .icon { color: var(--fg-faint); }
.ac-btn.primary .icon { color: var(--accent-fg); }

/* Toolbar above tables */
.ac-toolbar {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 20px; border-bottom: 1px solid var(--border);
  background: var(--bg);
}
.ac-search {
  display: flex; align-items: center; gap: 6px;
  height: 26px; padding: 0 8px; min-width: 220px;
  border: 1px solid var(--border-input); border-radius: 6px; background: var(--bg-2);
}
.ac-search input { border: 0; outline: 0; background: transparent; flex: 1; font-size: var(--fs-sm); }
.ac-search input::placeholder { color: var(--fg-faint); }
.ac-search:focus-within { border-color: var(--accent-line); box-shadow: 0 0 0 3px var(--accent-soft); }
.ac-search:focus-within > span { color: var(--accent); }
.ac-chip {
  display: inline-flex; align-items: center; gap: 6px;
  height: 24px; padding: 0 8px;
  border-radius: 5px; border: 1px solid var(--border);
  font-size: var(--fs-sm); color: var(--fg-dim);
  background: transparent; cursor: pointer;
}
.ac-chip:hover { background: var(--bg-hover); color: var(--fg); }
.ac-chip.on { background: var(--accent-soft); color: var(--accent); border-color: var(--accent-line); }
.ac-density-toggle { display: inline-flex; border: 1px solid var(--border); border-radius: 5px; overflow: hidden; }
.ac-density-toggle button { padding: 0 8px; height: 24px; font-size: var(--fs-xs); color: var(--fg-dim); }
.ac-density-toggle button.on { background: var(--bg-active); color: var(--fg-strong); }
.ac-toolbar-spacer { flex: 1; min-width: 12px; }
.ac-view-controls { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.ac-agents-toolbar {
  min-height: 42px;
  gap: 10px;
  flex-wrap: wrap;
}
.ac-agents-toolbar .ac-search {
  width: clamp(260px, 30vw, 420px);
  min-width: 260px;
}
.ac-source-filter {
  flex: 0 0 auto;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.03);
}
.ac-source-filter .ac-chip {
  min-width: 58px;
  justify-content: center;
  font-weight: 500;
}
.ac-source-filter .ac-chip.on {
  background: var(--bg-active);
  color: var(--fg-strong);
  box-shadow: inset 0 0 0 1px var(--accent-line);
}

/* ---------- Tools screen polish ---------- */
.ac-tools-screen { display: flex; flex-direction: column; min-height: 100%; }

/* Segmented filter group (shared: Tools, Logs) */
.ac-segment {
  display: inline-flex; align-items: center; gap: 3px;
  padding: 3px; border-radius: 8px;
  background: var(--bg-2); border: 1px solid var(--border);
}
.ac-segment .ac-chip { border: 0; background: transparent; height: 24px; padding: 0 11px; border-radius: 5px; }
.ac-segment .ac-chip:hover { background: var(--bg-hover); }
.ac-segment .ac-chip.on {
  background: var(--accent); color: var(--accent-fg);
  box-shadow: 0 1px 2px rgba(0,0,0,0.25); border: 0;
}
/* Level-colored toggles (Logs) */
.ac-segment .ac-chip.ac-seg-warn.on  { background: var(--st-amber); color: #1a1300; }
.ac-segment .ac-chip.ac-seg-error.on { background: var(--st-red);   color: #2a0000; }

/* Live status pill (Logs) */
.ac-status-live {
  display: inline-flex; align-items: center; gap: 7px;
  height: 22px; padding: 0 10px 0 8px; border-radius: 999px;
  background: var(--bg-2); border: 1px solid var(--border);
  font-size: var(--fs-xs); color: var(--fg-dim);
}
.ac-status-live .ac-live-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--st-green); flex: 0 0 7px;
  box-shadow: 0 0 0 0 rgba(62,207,142,0.5);
  animation: ac-pulse 1.8s ease-out infinite;
}
.ac-status-live.err { color: var(--st-red); border-color: rgba(255,93,93,0.32); }
.ac-status-live.err .ac-live-dot { background: var(--st-red); animation: none; }
@keyframes ac-pulse {
  0%   { box-shadow: 0 0 0 0 rgba(62,207,142,0.5); }
  70%  { box-shadow: 0 0 0 5px rgba(62,207,142,0); }
  100% { box-shadow: 0 0 0 0 rgba(62,207,142,0); }
}

/* Result count pill */
.ac-count {
  margin-left: auto;
  display: inline-flex; align-items: center; gap: 2px;
  height: 22px; padding: 0 9px; border-radius: 999px;
  background: var(--bg-2); border: 1px solid var(--border);
  font-size: var(--fs-xs); font-family: var(--font-mono);
  color: var(--fg-dim); font-variant-numeric: tabular-nums;
}
.ac-count-sep { color: var(--fg-faint); margin: 0 1px; }

/* Carded table */
.ac-table-card {
  margin: 14px 20px 20px;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  background: var(--panel);
}
.ac-table-card .ac-table thead th {
  background: var(--bg-2);
  height: 34px;
}
.ac-table-card .ac-table tbody tr:last-child { border-bottom: 0; }
.ac-table-card .ac-table tbody td { padding: 0 14px; }
.ac-table-card .ac-table thead th:first-child,
.ac-table-card .ac-table tbody td:first-child { padding-left: 16px; }

/* Accent indicator on hover / selected */
.ac-tools-table tbody tr { box-shadow: inset 2px 0 0 transparent; transition: background .1s, box-shadow .1s; }
.ac-tools-table tbody tr:hover { box-shadow: inset 2px 0 0 var(--accent-line); }
.ac-tools-table tbody tr.selected { box-shadow: inset 2px 0 0 var(--accent); }

/* Tool name as a code token */
.ac-tool-name {
  display: inline-flex; align-items: center;
  padding: 2px 7px; border-radius: 5px;
  font-family: var(--font-mono); font-size: var(--fs-xs); font-weight: 500;
  color: var(--fg-strong);
  background: var(--bg-2); border: 1px solid var(--border);
}
.ac-tools-table tbody tr:hover .ac-tool-name { border-color: var(--border-strong); }
.ac-tool-desc { max-width: 460px; overflow: hidden; text-overflow: ellipsis; }

.ac-no-match td { text-align: center; color: var(--fg-faint); padding: 28px 0 !important; font-size: var(--fs-sm); }

/* Tables */
.ac-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: var(--fs-sm); }
.ac-table thead th {
  position: sticky; top: 0; z-index: 2;
  background: var(--bg);
  height: var(--hd-h);
  text-align: left; padding: 0 12px;
  color: var(--fg-faint); font-weight: 500; font-size: var(--fs-xs);
  letter-spacing: 0.04em; text-transform: uppercase;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  user-select: none;
}
.ac-table thead th.sortable { cursor: pointer; }
.ac-table thead th.sortable:hover { color: var(--fg); }
.ac-table thead th .sort-ind { margin-left: 4px; opacity: 0.5; }
.ac-table thead th.sorted { color: var(--fg-strong); }
.ac-table thead th.sorted .sort-ind { opacity: 1; color: var(--accent); }
.ac-table tbody tr {
  height: var(--row-h);
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background .1s;
}
.ac-table tbody tr:hover { background: var(--bg-hover); }
.ac-table tbody tr.selected { background: var(--accent-soft); }
.ac-table tbody td { padding: 0 12px; vertical-align: middle; color: var(--fg); white-space: nowrap; }
.ac-table tbody td.num { font-family: var(--font-mono); font-variant-numeric: tabular-nums; color: var(--fg-dim); }
.ac-table tbody td.dim { color: var(--fg-dim); }
.ac-table tbody td.mono { font-family: var(--font-mono); font-size: var(--fs-xs); }
.ac-table tbody td.actions { width: 32px; text-align: right; }
/* Category group header rows in the Tools table (delegate.* et al.). */
.ac-table tbody tr.ac-group-row { cursor: default; }
.ac-table tbody tr.ac-group-row:hover { background: transparent; }
.ac-table tbody tr.ac-group-row td {
  padding: 9px 16px 5px;
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  font-weight: 600;
  color: var(--fg-dim);
  background: var(--bg-hover);
  border-bottom: 1px solid var(--border);
}
.ac-group-count {
  margin-left: 8px;
  color: var(--fg-faint);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}
.ac-deleg-arrow { color: var(--fg-faint); font-family: var(--font-mono); margin-right: 6px; text-transform: none; letter-spacing: 0; }
/* Expandable delegate.<agent> rows: nest the sub-agent's tools underneath. */
.ac-table tbody tr.ac-deleg-row { cursor: pointer; }
.ac-table tbody tr.ac-deleg-row.open td { background: var(--bg-hover); }
.ac-deleg-caret { display: inline-block; width: 12px; color: var(--fg-faint); font-size: 10px; margin-right: 4px; }
.ac-deleg-toolcount {
  margin-left: 8px; padding: 1px 6px; border-radius: 5px;
  background: var(--bg-hover); color: var(--fg-faint);
  font-size: var(--fs-xs); font-variant-numeric: tabular-nums;
}
.ac-table tbody tr.ac-subtool-row:hover td { background: var(--bg-hover); }
.ac-subtool-name { padding-left: 28px; color: var(--fg-dim); font-family: var(--font-mono); font-size: var(--fs-xs); }

/* Density */
.ac-root.comfortable { --row-h: 40px; --hd-h: 36px; }

/* Source badge */
.ac-badge {
  display: inline-flex; align-items: center;
  height: 18px; padding: 0 6px;
  border-radius: 4px; font-size: 10px; font-weight: 500;
  letter-spacing: 0.02em; text-transform: lowercase;
  font-family: var(--font-mono);
}
.ac-badge.built-in { background: var(--src-builtin-bg); color: var(--src-builtin-fg); }
.ac-badge.plugin   { background: var(--src-plugin-bg);  color: var(--src-plugin-fg); }
.ac-badge.custom   { background: var(--src-custom-bg);  color: var(--src-custom-fg); }
.ac-badge.cat {
  background: var(--bg-2); color: var(--fg-dim);
  text-transform: none; letter-spacing: 0;
  font-family: var(--font-sans);
}

/* Status dot */
.ac-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; flex: 0 0 8px; }
.ac-dot.healthy  { background: var(--st-green); box-shadow: 0 0 0 3px rgba(62,207,142,0.14); }
.ac-dot.warning  { background: var(--st-amber); box-shadow: 0 0 0 3px rgba(245,165,36,0.14); }
.ac-dot.error    { background: var(--st-red);   box-shadow: 0 0 0 3px rgba(255,93,93,0.14); }
.ac-dot.disabled { background: var(--st-gray); }
.ac-dot.ok       { background: var(--st-green); }

/* Toggle switch */
.ac-toggle {
  position: relative; width: 28px; height: 16px;
  background: var(--bg-3); border-radius: 999px;
  border: 1px solid var(--border-input);
  cursor: pointer; transition: background .14s, border-color .14s;
}
.ac-toggle::after {
  content: ''; position: absolute; left: 1px; top: 1px;
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--fg-dim);
  transition: transform .14s, background .14s;
}
.ac-toggle.on { background: var(--accent); border-color: var(--accent); }
.ac-toggle.on::after { transform: translateX(12px); background: #fff; }

/* Drawer */
.ac-scrim {
  position: fixed; inset: 0; background: var(--scrim);
  z-index: 50; opacity: 0; pointer-events: none;
  transition: opacity .18s;
}
.ac-scrim.open { opacity: 1; pointer-events: auto; }
.ac-drawer {
  position: fixed; top: 0; right: 0; bottom: 0;
  width: 540px; max-width: 80%;
  background: var(--drawer-bg);
  border-left: 1px solid var(--border);
  box-shadow: var(--shadow-drawer);
  z-index: 60;
  transform: translateX(100%);
  transition: transform .22s cubic-bezier(.2,.7,.3,1);
  display: flex; flex-direction: column;
}
.ac-drawer.open { transform: translateX(0); }
.ac-drawer-head {
  flex-shrink: 0;
  display: flex; align-items: center; gap: 10px;
  padding: 14px 18px 0;
}
.ac-drawer-title { font-size: var(--fs-xl); font-weight: 600; color: var(--fg-strong); letter-spacing: -0.01em; }
.ac-drawer-sub { color: var(--fg-dim); font-size: var(--fs-sm); margin-top: 2px; font-family: var(--font-mono); }
.ac-drawer-head .right { margin-left: auto; display: flex; gap: 4px; }
.ac-tabs {
  display: flex; gap: 0; padding: 8px 18px 0;
  border-bottom: 1px solid var(--border);
}
.ac-tab {
  padding: 8px 12px; font-size: var(--fs-sm); color: var(--fg-dim);
  border-bottom: 2px solid transparent; margin-bottom: -1px;
  cursor: pointer;
}
.ac-tab:hover { color: var(--fg); }
.ac-tab.on { color: var(--fg-strong); border-bottom-color: var(--accent); }
.ac-drawer-body { flex: 1; min-height: 0; overflow: auto; overscroll-behavior: contain; padding: 18px; }
.ac-agent-tools-controls { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.ac-agent-tools-controls .ac-search { min-height: 42px; }
.ac-agent-tools-controls .ac-chip { min-height: 40px; padding: 8px 12px; }
.ac-agent-tools-controls .ac-chip[aria-pressed="true"] { color: var(--accent); border-color: var(--accent); }
.ac-agent-tools-count { color: var(--fg-dim); font-size: 12px; margin: 16px 0 24px; }
.ac-agent-tool-group { margin-bottom: 26px; }
.ac-agent-tool-group h4 { display: flex; align-items: center; gap: 9px; font-size: 13px; margin: 0 0 12px; color: var(--fg); }
.ac-agent-tool-group h4 span { color: var(--fg-faint); font-size: 11px; font-weight: 400; }
.ac-agent-tool-option { display: flex; align-items: flex-start; gap: 14px; padding: 17px; margin-bottom: 8px; border: 1px solid var(--border); border-radius: 9px; background: var(--panel); cursor: pointer; }
.ac-agent-tool-option:hover { border-color: var(--border-strong); background: var(--bg-hover); }
.ac-agent-tool-option:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.ac-agent-tool-option.selected { border-left: 3px solid var(--accent); padding-left: 15px; }
.ac-agent-tool-option input { width: 17px; height: 17px; margin: 1px 0 0; flex-shrink: 0; accent-color: var(--accent); }
.ac-agent-tool-copy { display: flex; flex: 1; min-width: 0; flex-direction: column; gap: 7px; }
.ac-agent-tool-name { color: var(--fg-strong); font: 12px/1.5 var(--font-mono); overflow-wrap: anywhere; }
.ac-agent-tool-description { font-size: 13px; line-height: 1.65; color: var(--fg-dim); overflow-wrap: anywhere; }
.ac-agent-tool-option > .ac-badge { flex-shrink: 0; white-space: nowrap; }
.ac-agent-settings { display: grid; gap: 20px; }
.ac-setting-card { border: 1px solid var(--border); border-radius: 12px; padding: 22px; background: var(--panel); min-width: 0; }
.ac-setting-card h4 { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 16px; color: var(--fg-strong); margin: 0 0 8px; }
.ac-setting-card h4 span, .ac-setting-advanced summary span { font-size: 12px; font-weight: 400; color: var(--fg-dim); }
.ac-setting-card > p { margin: 0 0 22px; font-size: 13px; line-height: 1.7; color: var(--fg-dim); }
.ac-agent-editor .ac-setting-fields { display: block; margin: 0; }
.ac-setting-fields dt, .ac-setting-label { font-size: 13px; font-weight: 500; color: var(--fg); margin: 20px 0 9px; }
.ac-setting-fields dd { margin: 0; }
.ac-agent-editor .ac-setting-fields .ac-input { width: 100%; min-height: 44px; padding: 10px 12px; }
.ac-setting-card .ac-agent-tool-option { background: var(--bg-2); padding: 15px; }
.ac-setting-card .ac-agent-tool-name { font-family: var(--font-sans); font-size: 14px; font-weight: 500; }
.ac-setting-card .ac-agent-tool-description { font-size: 12px; }
.ac-setting-advanced summary { cursor: pointer; color: var(--fg-strong); font-size: 14px; font-weight: 500; }
.ac-setting-advanced summary span { display: block; margin: 7px 0 0 18px; }
.ac-setting-advanced[open] summary { margin-bottom: 20px; }
.ac-setting-card .ac-danger { margin-top: 12px; }
.ac-drawer-foot {
  padding: 10px 18px; border-top: 1px solid var(--border);
  display: flex; gap: 8px; align-items: center;
  background: var(--bg-2);
}

/* Definition pairs */
.ac-defs { display: grid; grid-template-columns: 140px 1fr; gap: 10px 16px; font-size: var(--fs-sm); }
.ac-defs dt { color: var(--fg-dim); }
/* Long values (server URLs, doc links) wrap instead of widening the drawer. */
.ac-defs dd { color: var(--fg); margin: 0; min-width: 0; overflow-wrap: anywhere; }
.ac-defs dd.mono { font-family: var(--font-mono); font-size: var(--fs-xs); }

/* Section header inside drawer */
.ac-sec-h { font-size: var(--fs-xs); color: var(--fg-faint); text-transform: uppercase; letter-spacing: 0.06em; margin: 18px 0 8px; }
.ac-sec-h:first-child { margin-top: 0; }

/* Prompt editor */
.ac-editor {
  font-family: var(--font-mono); font-size: var(--fs-xs); line-height: 1.55;
  background: var(--bg-2); border: 1px solid var(--border);
  border-radius: 8px; overflow: hidden;
  position: relative;
}
.ac-editor-head {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px; border-bottom: 1px solid var(--border);
  background: var(--bg-3); font-family: var(--font-sans);
}
.ac-editor-head .filename { color: var(--fg); font-size: var(--fs-sm); font-weight: 500; }
.ac-editor-head .meta { color: var(--fg-faint); font-size: var(--fs-xs); font-family: var(--font-mono); }
.ac-editor-head .right { margin-left: auto; display: flex; gap: 4px; }
.ac-editor-body {
  display: grid; grid-template-columns: 36px 1fr;
  max-height: 380px; overflow: auto;
}
.ac-editor-gutter {
  background: var(--bg-2); color: var(--fg-faint);
  padding: 8px 0; text-align: right;
  border-right: 1px solid var(--border);
  user-select: none;
}
.ac-editor-gutter div { padding-right: 8px; }
.ac-editor-content {
  padding: 8px 12px; outline: 0; white-space: pre-wrap; color: var(--fg);
  font-family: var(--font-mono);
}
.ac-editor-content .kw { color: #c084fc; }
.ac-editor-content .str { color: #6fa8ff; }
.ac-editor-content .com { color: var(--fg-faint); font-style: italic; }

/* Diff view */
.ac-diff-row { display: grid; grid-template-columns: 36px 1fr; font-family: var(--font-mono); font-size: var(--fs-xs); line-height: 1.55; }
.ac-diff-row .ln { color: var(--fg-faint); text-align: right; padding-right: 8px; user-select: none; background: var(--bg-2); }
.ac-diff-row .ct { padding: 0 12px; white-space: pre-wrap; }
.ac-diff-row.add .ct { background: rgba(62,207,142,0.10); color: #b6f1d2; }
.ac-diff-row.rem .ct { background: rgba(255,93,93,0.10); color: #ffc6c6; }
.ac-root[data-theme="light"] .ac-diff-row.add .ct { color: #075c3a; }
.ac-root[data-theme="light"] .ac-diff-row.rem .ct { color: #82181a; }

/* Sticky save bar */
.ac-savebar {
  position: sticky; bottom: 0; margin: 14px -18px -18px;
  padding: 10px 18px;
  background: var(--bg-2); border-top: 1px solid var(--border-strong);
  display: flex; align-items: center; gap: 10px;
  box-shadow: 0 -8px 20px rgba(0,0,0,0.18);
}
.ac-savebar .msg { color: var(--fg); font-size: var(--fs-sm); font-weight: 500; }
.ac-savebar .msg b { color: var(--accent); font-family: var(--font-mono); font-weight: 600; }
.ac-savebar .right { margin-left: auto; display: flex; gap: 6px; }

/* Tool checkbox list */
.ac-tool-row {
  display: flex; align-items: center; gap: 10px;
  height: 34px; padding: 0 8px; border-radius: 5px;
  cursor: pointer; font-size: var(--fs-sm);
}
.ac-tool-row:hover { background: var(--bg-hover); }
.ac-checkbox {
  width: 14px; height: 14px; border-radius: 3px;
  border: 1.5px solid var(--border-strong);
  display: grid; place-items: center; flex: 0 0 14px;
  transition: background .12s, border-color .12s;
}
.ac-checkbox.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.ac-tool-row .name { font-family: var(--font-mono); font-size: var(--fs-xs); color: var(--fg); }
.ac-tool-row .desc { color: var(--fg-faint); font-size: var(--fs-xs); margin-left: 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ac-tool-cat { font-size: var(--fs-xs); color: var(--fg-faint); text-transform: uppercase; letter-spacing: 0.06em; padding: 12px 8px 4px; }

/* MCP cards */
.ac-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; padding: 16px 20px; }
.ac-card {
  background: var(--panel); border: 1px solid var(--border); border-radius: 10px;
  padding: 14px; display: flex; flex-direction: column; gap: 10px;
  cursor: pointer; transition: border-color .12s, background .12s;
}
.ac-card:hover { border-color: var(--border-strong); }
.ac-card-head { display: flex; align-items: center; gap: 8px; }
.ac-card-name { font-weight: 600; color: var(--fg-strong); font-size: var(--fs-md); letter-spacing: -0.005em; }
.ac-card-meta { font-family: var(--font-mono); font-size: var(--fs-xs); color: var(--fg-dim); }
.ac-card-foot { display: flex; align-items: center; gap: 8px; }
.ac-card-foot .ac-btn { height: 26px; padding: 0 8px; font-size: var(--fs-xs); }

/* Dashboard widgets */
.ac-dash { padding: 16px 20px 24px; display: flex; flex-direction: column; gap: 16px; }
.ac-counters { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; }
.ac-counter {
  background: var(--panel); border: 1px solid var(--border); border-radius: 10px;
  padding: 14px 16px; display: flex; flex-direction: column; gap: 4px;
}
.ac-counter .label { font-size: var(--fs-xs); color: var(--fg-dim); text-transform: uppercase; letter-spacing: 0.06em; }
.ac-counter .value { font-size: 24px; font-weight: 600; color: var(--fg-strong); letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.ac-counter .delta { font-size: var(--fs-xs); color: var(--st-green); font-family: var(--font-mono); }
.ac-counter .delta.bad { color: var(--st-red); }
.ac-dash-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.ac-panel { background: var(--panel); border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.ac-panel-h { padding: 12px 14px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 8px; }
.ac-panel-h h3 { margin: 0; font-size: var(--fs-md); font-weight: 600; color: var(--fg-strong); }
.ac-panel-h .sub { color: var(--fg-faint); font-size: var(--fs-xs); margin-left: auto; font-family: var(--font-mono); }
.ac-list-row { display: flex; align-items: center; gap: 10px; padding: 8px 14px; border-bottom: 1px solid var(--border); font-size: var(--fs-sm); }
.ac-list-row:last-child { border-bottom: 0; }
.ac-list-row .ts { font-family: var(--font-mono); font-size: var(--fs-xs); color: var(--fg-faint); width: 64px; }
.ac-list-row .body { flex: 1; min-width: 0; color: var(--fg); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ac-list-row .right { color: var(--fg-faint); font-family: var(--font-mono); font-size: var(--fs-xs); }

/* Sparkline panel */
.ac-spark { padding: 14px; }
.ac-spark-head { display: flex; align-items: baseline; gap: 12px; margin-bottom: 8px; }
.ac-spark-head .num { font-size: 24px; font-weight: 600; color: var(--fg-strong); letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.ac-spark-head .lbl { font-size: var(--fs-xs); color: var(--fg-dim); text-transform: uppercase; letter-spacing: 0.06em; }
.ac-spark-head .sub { color: var(--st-green); font-size: var(--fs-xs); font-family: var(--font-mono); margin-left: auto; }

/* Cmd+K palette */
.ac-cmdk-scrim {
  position: absolute; inset: 0; background: var(--scrim); z-index: 100;
  display: grid; place-items: start center; padding-top: 96px;
  opacity: 0; pointer-events: none; transition: opacity .14s;
}
.ac-cmdk-scrim.open { opacity: 1; pointer-events: auto; }
.ac-cmdk {
  width: 560px; max-width: 80%;
  background: var(--modal-bg); border: 1px solid var(--border-strong); border-radius: 12px;
  box-shadow: var(--shadow-pop);
  overflow: hidden;
  transform: translateY(-4px); opacity: 0;
  transition: transform .16s cubic-bezier(.2,.7,.3,1), opacity .16s;
}
.ac-cmdk-scrim.open .ac-cmdk { transform: translateY(0); opacity: 1; }
.ac-cmdk-input {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 16px; border-bottom: 1px solid var(--border);
}
.ac-cmdk-input input { flex: 1; background: transparent; border: 0; outline: 0; font-size: var(--fs-lg); color: var(--fg-strong); }
.ac-cmdk-input input::placeholder { color: var(--fg-faint); }
.ac-cmdk-body { max-height: 360px; overflow: auto; padding: 6px; }
.ac-cmdk-group { font-size: var(--fs-xs); color: var(--fg-faint); text-transform: uppercase; letter-spacing: 0.06em; padding: 8px 10px 4px; }
.ac-cmdk-row {
  display: flex; align-items: center; gap: 10px;
  height: 32px; padding: 0 10px; border-radius: 6px;
  cursor: pointer; font-size: var(--fs-sm);
}
.ac-cmdk-row.active { background: var(--accent-soft); color: var(--accent); }
.ac-cmdk-row .meta { margin-left: auto; font-family: var(--font-mono); font-size: var(--fs-xs); color: var(--fg-faint); }
.ac-cmdk-row.active .meta { color: var(--accent); }
.ac-cmdk-foot {
  display: flex; align-items: center; gap: 14px;
  padding: 8px 14px; border-top: 1px solid var(--border);
  background: var(--bg-2);
  font-size: var(--fs-xs); color: var(--fg-faint);
}
.ac-cmdk-foot .item { display: flex; align-items: center; gap: 4px; }
.ac-cmdk-empty { padding: 28px; text-align: center; color: var(--fg-faint); font-size: var(--fs-sm); }

/* Toast */
.ac-toasts {
  position: absolute; bottom: 18px; right: 18px;
  display: flex; flex-direction: column; gap: 8px;
  z-index: 200; pointer-events: none;
}
.ac-toast {
  background: var(--modal-bg); border: 1px solid var(--border-strong);
  border-radius: 8px; padding: 10px 14px;
  display: flex; align-items: center; gap: 10px;
  font-size: var(--fs-sm); color: var(--fg);
  box-shadow: var(--shadow-pop);
  min-width: 280px; pointer-events: auto;
  animation: ac-toast-in .22s cubic-bezier(.2,.7,.3,1);
}
.ac-toast .icon { color: var(--st-green); }
.ac-toast.error .icon { color: var(--st-red); }
.ac-toast .body { flex: 1; }
.ac-toast .body b { color: var(--fg-strong); font-weight: 600; }
.ac-toast .body .sub { color: var(--fg-faint); font-size: var(--fs-xs); margin-top: 2px; }

@keyframes ac-toast-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Confirm modal */
.ac-modal-scrim {
  position: absolute; inset: 0; background: var(--scrim);
  z-index: 150; display: grid; place-items: center;
  opacity: 0; pointer-events: none; transition: opacity .14s;
}
.ac-modal-scrim.open { opacity: 1; pointer-events: auto; }
.ac-modal {
  background: var(--modal-bg); border: 1px solid var(--border-strong);
  border-radius: 12px; padding: 20px;
  width: 420px; max-width: 80%;
  box-shadow: var(--shadow-pop);
  transform: scale(.96); transition: transform .16s;
}
.ac-modal-scrim.open .ac-modal { transform: scale(1); }
.ac-modal h3 { margin: 0 0 8px; font-size: var(--fs-xl); font-weight: 600; color: var(--fg-strong); letter-spacing: -0.01em; }
.ac-modal p { margin: 0 0 16px; color: var(--fg-dim); font-size: var(--fs-sm); line-height: 1.5; }
.ac-modal p code { font-family: var(--font-mono); font-size: var(--fs-xs); background: var(--bg-2); padding: 1px 5px; border-radius: 3px; color: var(--fg); }
.ac-modal-foot {
  display: flex; gap: 8px; justify-content: flex-end; align-items: center;
  margin: 18px -20px -20px; padding: 14px 20px;
  border-top: 1px solid var(--border); background: var(--bg-2);
  border-radius: 0 0 12px 12px;
}

/* JSON viewer */
.ac-json { font-family: var(--font-mono); font-size: var(--fs-xs); line-height: 1.6; color: var(--fg); }
.ac-json .k { color: #c084fc; }
.ac-json .s { color: #6fa8ff; }
.ac-json .n { color: #3ecf8e; }
.ac-json .b { color: #f5a524; }
.ac-json .c { color: var(--fg-faint); cursor: pointer; user-select: none; }
.ac-json .indent { padding-left: 16px; border-left: 1px dashed var(--border); }

/* Skeleton */
.ac-skel { background: linear-gradient(90deg, var(--bg-2), var(--bg-3), var(--bg-2)); background-size: 200% 100%; animation: ac-skel 1.2s linear infinite; border-radius: 4px; }
@keyframes ac-skel { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* Empty state */
.ac-empty {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 64px 24px; gap: 8px;
}
.ac-empty .glyph {
  width: 48px; height: 48px; border-radius: 12px;
  background: var(--bg-2); border: 1px solid var(--border);
  display: grid; place-items: center; color: var(--fg-faint);
  margin-bottom: 8px;
}
.ac-empty h3 { margin: 0; font-size: var(--fs-lg); font-weight: 600; color: var(--fg-strong); }
.ac-empty p { margin: 0; color: var(--fg-dim); font-size: var(--fs-sm); }

/* Error banner */
.ac-error-banner {
  display: flex; align-items: center; gap: 10px;
  margin: 12px 20px; padding: 10px 14px;
  border: 1px solid rgba(255,93,93,0.3); background: rgba(255,93,93,0.08);
  border-radius: 8px; color: var(--st-red); font-size: var(--fs-sm);
}
.ac-error-banner b { color: var(--fg-strong); font-weight: 600; }
.ac-error-banner .right { margin-left: auto; display: flex; gap: 6px; }

/* Session timeline */
.ac-timeline { display: flex; flex-direction: column; gap: 10px; }
.ac-msg {
  border: 1px solid var(--border); border-radius: 8px;
  padding: 10px 12px; background: var(--bg-2);
}
.ac-msg.user { background: var(--accent-soft); border-color: var(--accent-line); }
.ac-msg .head {
  display: flex; align-items: center; gap: 8px;
  font-size: var(--fs-xs); color: var(--fg-dim); margin-bottom: 6px;
}
.ac-msg .role { font-weight: 600; color: var(--fg-strong); text-transform: uppercase; letter-spacing: 0.06em; }
.ac-msg .body { font-size: var(--fs-sm); color: var(--fg); white-space: pre-wrap; }
.ac-tool-call {
  margin-top: 8px; padding: 8px 10px;
  background: var(--bg-3); border-left: 2px solid var(--accent);
  border-radius: 0 6px 6px 0;
  font-family: var(--font-mono); font-size: var(--fs-xs); color: var(--fg-dim);
}
.ac-tool-call .tname { color: var(--accent); font-weight: 500; }

/* Pulse for "test connection" */
.ac-spin { animation: ac-spin 0.9s linear infinite; }
@keyframes ac-spin { to { transform: rotate(360deg); } }

/* Settings/danger zone */
.ac-danger {
  border: 1px solid rgba(255,93,93,0.25); border-radius: 8px;
  padding: 14px; background: rgba(255,93,93,0.04);
}
.ac-danger h4 { margin: 0 0 4px; color: var(--st-red); font-size: var(--fs-sm); font-weight: 600; }
.ac-danger p { margin: 0 0 10px; color: var(--fg-dim); font-size: var(--fs-xs); }

/* Slider */
.ac-slider { display: flex; align-items: center; gap: 12px; }
.ac-slider input[type=range] { flex: 1; accent-color: var(--accent); }
.ac-slider .val { font-family: var(--font-mono); font-size: var(--fs-sm); color: var(--fg-strong); min-width: 24px; text-align: right; }

/* Misc */
.ac-mono { font-family: var(--font-mono); }
.ac-dim { color: var(--fg-dim); }
.ac-faint { color: var(--fg-faint); }
.ac-strong { color: var(--fg-strong); font-weight: 600; }

/* ==========================================================================
   Atlas live console — appended rules. Reuse tokens above; do not restyle
   existing components.
   ========================================================================== */

/* Generic input used by providers + chat */
.ac-input {
  width: 100%;
  height: 28px; padding: 0 8px;
  background: var(--bg-2); color: var(--fg);
  border: 1px solid var(--border-input); border-radius: 6px;
  font-size: var(--fs-sm); outline: 0;
  transition: border-color .12s, background .12s;
}
.ac-input:focus { border-color: var(--accent-line); background: var(--bg-3); }
.ac-input::placeholder { color: var(--fg-faint); }
textarea.ac-input { height: auto; padding: 8px; resize: vertical; line-height: 1.5; font-family: var(--font-sans); }
textarea.ac-input.ac-mono { font-family: var(--font-mono); font-size: var(--fs-xs); }
select.ac-input { height: 28px; cursor: pointer; }

/* Modal forms (new agent / tool / project / mcp) */
.ac-modal-wide { width: 620px; max-width: 92%; max-height: 86vh; overflow: auto; }
.ac-modal.ac-agent-create { width: 740px; padding: 28px; }
.ac-agent-create h3 { font-size: 25px; margin-bottom: 8px; }
.ac-agent-form-nav { display: flex; gap: 6px; padding: 5px; background: var(--bg-2); border-radius: 9px; margin: 22px 0; }
.ac-agent-form-nav button { flex: 1; padding: 11px 8px; color: var(--fg-dim); border-radius: 6px; font-size: 12px; }
.ac-agent-form-nav button[aria-pressed="true"] { background: var(--panel); color: var(--fg-strong); box-shadow: 0 0 0 1px var(--border); }
.ac-agent-create .ac-form-grid { display: block; min-height: 360px; }
.ac-agent-form-section[hidden] { display: none; }
.ac-agent-form-section h4 { font-size: 17px; margin: 0 0 7px; }
.ac-agent-create .ac-field { margin-bottom: 18px; }
.ac-agent-create .ac-field-label { text-transform: none; letter-spacing: 0; font-size: 13px; color: var(--fg); margin-bottom: 8px; }
.ac-agent-create .ac-input { min-height: 40px; padding: 10px 12px; font-size: 13px; width: 100%; }
.ac-agent-create textarea { resize: vertical; line-height: 1.65; }
.ac-agent-create .ac-field-hint { margin-top: 7px; line-height: 1.5; }
.ac-agent-create .ac-modal-foot { position: sticky; bottom: -28px; background: var(--panel); padding: 18px 0 0; margin-top: 24px; border-top: 1px solid var(--border); }
.ac-agent-create .ac-tool-row { min-height: 44px; height: auto; gap: 10px; }
.ac-agent-create input[type="checkbox"] { accent-color: var(--accent); }
.ac-drawer.ac-agent-editor { width: 780px; max-width: 95vw; }
.ac-agent-editor .ac-drawer-head { padding: 26px 28px; }
.ac-agent-editor .ac-drawer-title { font-size: 23px; }
.ac-agent-editor .ac-drawer-sub { margin-top: 7px; }
.ac-agent-editor .ac-tabs { padding: 0 28px; gap: 22px; overflow-x: auto; flex-shrink: 0; }
.ac-agent-editor .ac-tab { padding: 15px 0; white-space: nowrap; font-size: 13px; }
.ac-agent-editor .ac-drawer-body { padding: 28px; }
.ac-agent-editor-intro { padding: 22px; background: var(--bg-2); border: 1px solid var(--border); border-radius: 10px; margin-bottom: 28px; }
.ac-agent-editor-intro h3, .ac-agent-section-heading h3 { font-size: 20px; margin: 8px 0; }
.ac-agent-editor-intro p, .ac-agent-section-heading p { color: var(--fg-dim); font-size: 13px; line-height: 1.7; margin: 0 0 20px; }
.ac-agent-editor .ac-defs { grid-template-columns: 150px minmax(0, 1fr); gap: 18px 24px; font-size: 13px; }
.ac-agent-editor .ac-defs dt { text-transform: capitalize; }
.ac-agent-editor .ac-input { min-height: 39px; font-size: 13px; }
.ac-agent-editor .ac-sec-h { margin-top: 30px; margin-bottom: 15px; }
.ac-agent-editor .ac-tool-row { height: auto; min-height: 46px; }
.ac-agent-prompt-input { display: block; width: 100%; min-height: 420px; padding: 20px; border: 0; background: var(--bg-2); color: var(--fg); resize: vertical; font: 13px/1.8 var(--font-mono); }
.ac-agent-editor .ac-editor-head { flex-wrap: wrap; gap: 9px; padding: 12px; }
.ac-agent-editor .ac-savebar { padding: 18px 28px; }
@media (max-width: 600px) {
  .ac-modal.ac-agent-create { padding: 20px; }
  .ac-agent-form-nav { flex-wrap: wrap; }
  .ac-agent-form-nav button { flex-basis: 100%; }
  .ac-agent-editor .ac-drawer-body, .ac-agent-editor .ac-drawer-head { padding: 20px; }
  .ac-agent-editor .ac-defs { grid-template-columns: 100px minmax(0, 1fr); gap: 14px; }
  .ac-agent-editor .ac-savebar { flex-wrap: wrap; }
}
.ac-field { display: block; margin-bottom: 12px; }
.ac-field-label, .ac-field > .ac-field-label { display: block; font-size: var(--fs-xs); color: var(--fg-dim); margin-bottom: 5px; text-transform: uppercase; letter-spacing: 0.05em; }
.ac-field-hint { display: block; font-size: var(--fs-xs); color: var(--fg-faint); margin-top: 4px; }
.ac-form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.ac-subnet { border: 1px solid var(--border); border-radius: 8px; padding: 4px; margin-top: 6px; max-height: 160px; overflow: auto; }

/* Streamed tool result preview in the playground */
.ac-tool-result { font-family: var(--font-mono); font-size: var(--fs-xs); white-space: pre-wrap; word-break: break-word; padding-left: 2px; }

/* Project switcher (topbar dropdown) */
.ac-proj { position: relative; }
.ac-proj .ac-chip { height: 28px; }
.ac-proj-menu {
  position: absolute; top: 34px; left: 0; z-index: 95;
  min-width: 300px; padding: 6px;
  background: var(--modal-bg); border: 1px solid var(--border-strong); border-radius: 10px;
  box-shadow: var(--shadow-pop);
}
.ac-proj-menu .ac-cmdk-row { min-height: 32px; height: auto; padding-top: 6px; padding-bottom: 6px; }
.ac-proj-menu .ac-cmdk-row > span:nth-child(2) {
  min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.ac-proj-menu .ac-cmdk-row .meta { white-space: nowrap; }

/* Project backend server status page */
.ac-servers-screen { display: flex; flex-direction: column; min-height: 100%; }
.ac-server-counters {
  display: grid; grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px; padding: 16px 20px 0;
}
.ac-servers-toolbar { margin-top: 14px; border-top: 1px solid var(--border); }
.ac-servers-table-card { overflow-x: auto; }
.ac-servers-table tbody tr { box-shadow: inset 2px 0 0 transparent; transition: background .1s, box-shadow .1s; }
.ac-servers-table tbody tr:hover { box-shadow: inset 2px 0 0 var(--accent-line); }
.ac-servers-table tbody tr.selected { box-shadow: inset 2px 0 0 var(--accent); }
.ac-server-name { display: flex; align-items: center; gap: 8px; min-width: 180px; }
.ac-server-name-main { color: var(--fg-strong); font-weight: 600; }
.ac-server-status { display: inline-flex; align-items: center; gap: 8px; min-width: 104px; color: var(--fg-dim); }
.ac-server-status.healthy { color: var(--st-green); }
.ac-server-status.warning { color: var(--st-amber); }
.ac-server-health { display: inline-flex; align-items: center; gap: 6px; }
.ac-server-actions { width: 190px !important; }
.ac-server-actionbar { display: flex; justify-content: flex-end; align-items: center; gap: 6px; min-width: 150px; }
.ac-server-actionbar .ac-btn { height: 24px; padding: 0 8px; font-size: var(--fs-xs); }
.ac-server-docs {
  margin: 0 20px 24px;
  display: flex; flex-direction: column; gap: 12px;
}
.ac-server-docs-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 14px;
  background: var(--panel); border: 1px solid var(--border); border-radius: 10px;
}
.ac-server-docs-title { display: flex; align-items: center; gap: 8px; color: var(--fg-strong); font-weight: 600; }
.ac-server-docs-sub { margin-top: 4px; color: var(--fg-dim); font-family: var(--font-mono); font-size: var(--fs-xs); }
.ac-server-docs-actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.ac-server-docs-actions .ac-btn { height: 24px; padding: 0 8px; font-size: var(--fs-xs); }
.ac-server-docs-grid { display: grid; grid-template-columns: minmax(260px, 0.8fr) minmax(520px, 1.4fr); gap: 12px; align-items: start; }
.ac-server-defs { padding: 14px; grid-template-columns: 90px 1fr; }
.ac-server-defs + .ac-sec-h { margin-left: 14px; margin-right: 14px; }
.ac-server-docs .ac-json { margin: 0 14px 14px; padding: 10px; background: var(--bg-2); border: 1px solid var(--border); border-radius: 8px; max-height: 160px; overflow: auto; }
.ac-server-endpoints-panel { overflow: hidden; }
.ac-server-docs-table tbody tr { cursor: default; }
.ac-server-docs-table tbody tr:hover { background: transparent; }
.ac-server-docs-table tbody td { height: 34px; }
.ac-server-docs-table tbody td:nth-child(2) a { color: var(--fg-strong); }
.ac-method {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 44px; height: 18px; padding: 0 6px; border-radius: 4px;
  font-family: var(--font-mono); font-size: 10px; font-weight: 700;
  background: var(--bg-2); color: var(--fg-dim); border: 1px solid var(--border);
}
.ac-method.get { color: var(--st-green); border-color: rgba(62,207,142,0.32); }
.ac-method.post { color: #6fa8ff; border-color: rgba(111,168,255,0.32); }
.ac-method.patch, .ac-method.put { color: var(--st-amber); border-color: rgba(245,165,36,0.32); }
.ac-method.delete { color: var(--st-red); border-color: rgba(255,93,93,0.32); }
.ac-method.all, .ac-method.use { color: var(--accent); border-color: var(--accent-line); }
@media (max-width: 900px) {
  .ac-server-counters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ac-server-docs-grid { grid-template-columns: 1fr; }
}

/* Provider cards: extend the card grid, but make them non-clickable forms */
.ac-prov-cards { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.ac-prov-card { gap: 8px; }
.ac-prov-field { display: flex; flex-direction: column; gap: 4px; }
.ac-prov-field label {
  font-size: var(--fs-xs); color: var(--fg-dim);
  text-transform: uppercase; letter-spacing: 0.04em;
}
.ac-prov-card .ac-card-foot { margin-top: 4px; }
.ac-prov-card .ac-card-foot .ac-chip[disabled] { opacity: 0.6; pointer-events: none; }

/* Connectors (OAuth "co-workers") — the directory grid, the one-time vendor
   setup banner, and the per-card untrusted-content warning. */
.ac-cw-bar {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 10px 20px; border-bottom: 1px solid var(--border); background: var(--bg);
}
.ac-cw-user { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ac-cw-user .ac-field-label { text-transform: uppercase; letter-spacing: 0.05em; }

.ac-cw-card { gap: 9px; }
.ac-cw-glyph {
  display: inline-grid; place-items: center;
  width: 22px; height: 22px; border-radius: 6px;
  background: var(--bg-3); border: 1px solid var(--border);
  font-size: 12px; font-weight: 600; color: var(--fg-strong);
}
.ac-cw-add {
  border-style: dashed; align-items: center; justify-content: center;
  gap: 6px; min-height: 140px;
}

.ac-cw-warn {
  display: flex; align-items: flex-start; gap: 6px;
  font-size: var(--fs-xs); line-height: 1.45; color: var(--st-amber);
}
.ac-cw-warn.block {
  padding: 10px 12px; margin-top: 12px;
  border: 1px solid rgba(245,165,36,0.28); border-radius: 8px;
  background: rgba(245,165,36,0.08);
}

.ac-cw-setup {
  margin: 16px 20px -4px;
  border: 1px solid var(--border-strong); border-radius: 10px;
  background: var(--panel); overflow: hidden;
}
.ac-cw-setup-head {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 11px 14px; cursor: pointer; font-size: var(--fs-sm); color: var(--fg);
}
.ac-cw-setup-head:hover { background: var(--bg-hover); }
.ac-cw-setup-body {
  display: flex; flex-direction: column; gap: 10px;
  padding: 4px 14px 14px; border-top: 1px solid var(--border);
}
.ac-cw-setup-body .ac-btn { text-decoration: none; }
.ac-cw-steps {
  margin: 8px 0 4px; padding-left: 20px;
  font-size: var(--fs-sm); color: var(--fg-dim); line-height: 1.6;
}
.ac-cw-steps li { margin-bottom: 4px; }

/* The add-connector dialog grows when "Advanced settings" opens — let it scroll
   inside itself rather than run off a short window. */
.ac-cw-modal { max-height: 86vh; overflow: auto; }

.ac-cw-adv {
  display: inline-flex; align-items: center; gap: 6px;
  margin: 4px 0 12px; cursor: pointer; user-select: none;
  font-size: var(--fs-sm); color: var(--fg-dim);
}
.ac-cw-adv:hover { color: var(--fg); }
.ac-cw-caret { font-size: 10px; color: var(--fg-faint); }

/* Playground / chat panel */
.ac-chat { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.ac-chat-bar {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 20px; border-bottom: 1px solid var(--border); background: var(--bg);
}
.ac-chat-body { flex: 1; overflow: auto; padding: 16px 20px; }
.ac-chat-body .ac-timeline { max-width: 880px; margin: 0 auto; }
.ac-chat-input {
  display: flex; align-items: flex-end; gap: 8px;
  padding: 12px 20px; border-top: 1px solid var(--border); background: var(--bg-2);
}
.ac-chat-input textarea.ac-input { flex: 1; max-height: 160px; }
.ac-chat-input .ac-btn { height: 36px; }

/* Knowledge / RAG screen
   One gutter for the whole screen: 14px, matching the counters and the settings
   grid, so panels do not step in and out as you scroll past them. */
.ac-kb { display: flex; flex-direction: column; gap: 16px; }
.ac-kb > .ac-panel > .ac-table-card { margin: 0 14px 14px; }
.ac-kb > .ac-panel > .ac-cards { border-top: 0; }

/* The overview's subtitle is prose, not a mono stat — undo .ac-panel-h .sub. */
.ac-kb .ac-panel-h > div { min-width: 0; }
.ac-kb .ac-panel-h .sub {
  margin-left: 0; margin-top: 2px; font-family: var(--font-sans);
  font-size: var(--fs-sm); color: var(--fg-dim); max-width: 68ch;
}
.ac-kb-head-right { margin-left: auto; display: flex; align-items: center; gap: 8px; flex: none; }

.ac-kb-counters { padding: 14px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.ac-kb-counters .ac-counter { min-width: 0; }
/* Model ids and store names are long and unbreakable; clip with an ellipsis
   rather than letting break-all hyphenate "index.json" mid-word. */
.ac-kb-counters .ac-counter .value {
  min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.ac-kb-counters .ac-counter .value.sm { font-size: 15px; font-weight: 500; }

.ac-kb-note {
  margin: 0 14px 14px; padding: 9px 11px; border-radius: 8px;
  font-size: var(--fs-sm); line-height: 1.55; color: var(--fg-dim);
  background: var(--bg-3); border: 1px solid var(--border);
}
.ac-kb-note.warn {
  color: var(--st-amber); background: rgba(245, 165, 36, 0.08);
  border-color: rgba(245, 165, 36, 0.28);
}
.ac-kb-note strong { color: inherit; font-weight: 600; }
.ac-kb-note .ac-mono { font-size: var(--fs-xs); }

/* Why the last re-index produced nothing. Stays until the next run. */
.ac-kb-fails {
  margin: 0 14px 14px; border-radius: 8px; overflow: hidden;
  border: 1px solid rgba(255, 93, 93, 0.30); background: rgba(255, 93, 93, 0.05);
}
.ac-kb-fails-h {
  padding: 7px 11px; font-size: var(--fs-xs); font-weight: 600;
  letter-spacing: 0.04em; text-transform: uppercase; color: var(--st-red);
  background: rgba(255, 93, 93, 0.08); border-bottom: 1px solid rgba(255, 93, 93, 0.22);
}
.ac-kb-fail {
  display: flex; gap: 10px; align-items: baseline;
  padding: 7px 11px; font-size: var(--fs-sm); line-height: 1.5;
  border-bottom: 1px solid rgba(255, 93, 93, 0.14);
}
.ac-kb-fail:last-child { border-bottom: 0; }
.ac-kb-fail-src {
  flex: none; max-width: 34%; color: var(--fg-strong); font-size: var(--fs-xs);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.ac-kb-fail-msg { min-width: 0; color: var(--fg-dim); }

.ac-kb-actions {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 14px; border-top: 1px solid var(--border); background: var(--bg-2);
}

/* Documents table: a failed row is tinted, and carries its reason inline so the
   badge is never the only evidence. */
.ac-kb-row-bad > td { background: rgba(255, 93, 93, 0.045); }
.ac-kb-row-msg {
  margin: 2px 0 6px; font-size: var(--fs-xs); line-height: 1.45;
  color: var(--st-red); white-space: normal;
}
.ac-kb .ac-badge.err  { background: rgba(255, 93, 93, 0.14); color: var(--st-red); }
.ac-kb .ac-badge.warn { background: rgba(245, 165, 36, 0.14); color: var(--st-amber); }
.ac-kb-confirm { display: inline-flex; gap: 6px; }
.ac-kb-confirm .ac-chip { height: 24px; padding: 0 9px; }
.ac-kb-confirm .ac-chip.danger { color: var(--st-red); border-color: rgba(255, 93, 93, 0.35); }
.ac-kb-confirm .ac-chip.danger:hover { background: rgba(255, 93, 93, 0.12); color: var(--st-red); }

.ac-kb-search { display: flex; align-items: center; gap: 8px; padding: 14px 14px 0; }
.ac-kb-hits { padding: 14px; }
.ac-kb-hits-count { font-size: var(--fs-xs); padding-bottom: 8px; }

.ac-kb-hit {
  margin-bottom: 10px; border: 1px solid var(--border);
  border-radius: 8px; background: var(--bg-2); overflow: hidden;
}
.ac-kb-hit:last-child { margin-bottom: 0; }
.ac-kb-hit-head {
  display: flex; align-items: center; gap: 6px; min-width: 0;
  padding: 7px 10px; border-bottom: 1px solid var(--border);
  font-size: var(--fs-xs); background: var(--bg-3);
}
.ac-kb-hit-head > .ac-mono { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ac-kb-hit-badges { margin-left: auto; display: flex; gap: 6px; align-items: center; flex: none; }
.ac-kb-hit-body {
  padding: 10px; font-size: var(--fs-sm); line-height: 1.6; color: var(--fg-dim);
  white-space: pre-wrap; max-height: 190px; overflow: auto;
}

.ac-kb-cards { padding: 14px; }

.ac-kb-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 14px; padding: 14px;
}
.ac-kb-field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.ac-kb-field > label {
  font-size: var(--fs-xs); color: var(--fg-dim);
  text-transform: uppercase; letter-spacing: 0.06em;
}
.ac-kb-toggle-row { display: flex; align-items: center; gap: 8px; min-height: 26px; }
.ac-kb-toggle-row .ac-dim { font-size: var(--fs-xs); }
.ac-kb-hint { margin: 0; font-size: var(--fs-xs); line-height: 1.5; color: var(--fg-faint); }
.ac-kb-hint.warn { color: var(--st-amber); }

/* The embedder the config points at. */
.ac-kb-active { border-color: var(--accent-line); box-shadow: inset 0 0 0 1px var(--accent-soft); }

/* Loading state, shaped like the panels it replaces. */
.ac-kb-skel { display: flex; flex-direction: column; gap: 8px; padding: 14px; }

/* Agent directory */
.ac-agent-directory { max-width: 1280px; width: 100%; margin: 0 auto; padding: 38px 40px 48px; }
.ac-agent-page-heading { display: flex; align-items: center; justify-content: space-between; gap: 24px; margin-bottom: 26px; }
.ac-agent-page-heading h1 { margin: 7px 0 9px; font-size: 32px; font-weight: 600; letter-spacing: -.045em; line-height: 1.2; color: var(--fg-strong); }
.ac-agent-page-heading p { margin: 0; font-size: 13px; color: var(--fg-dim); line-height: 1.6; max-width: 580px; }
.ac-agent-page-heading > .ac-btn { flex-shrink: 0; }
.ac-agent-summary { display: flex; align-items: center; gap: 22px; padding: 16px 0 23px; margin-bottom: 24px; border-bottom: 1px solid var(--border); font-size: 12px; color: var(--fg-faint); }
.ac-agent-summary > span { display: inline-flex; align-items: center; gap: 6px; }
.ac-agent-summary strong { color: var(--fg); font-weight: 500; font-variant-numeric: tabular-nums; }
.ac-agent-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--st-green); }
.ac-agent-summary-hint { margin-left: auto; font-size: 11px; }
.ac-agent-controls { display: flex; gap: 10px; }
.ac-agent-search { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; height: 41px; padding: 0 13px; border: 1px solid var(--border-input); border-radius: 8px; background: var(--panel); color: var(--fg-faint); }
.ac-agent-search input { width: 100%; min-width: 0; border: 0; outline: 0; background: transparent; font-size: 12px; }
.ac-agent-search:focus-within { border-color: var(--accent); }
.ac-agent-search input::placeholder { color: var(--fg-faint); }
.ac-agent-controls select { height: 41px; border: 1px solid var(--border-input); border-radius: 8px; background: var(--panel); padding: 0 12px; font-size: 12px; color: var(--fg-dim); max-width: 160px; }
.ac-agent-source-tabs { display: flex; align-items: center; gap: 6px; margin: 20px 0 23px; flex-wrap: wrap; }
.ac-agent-source-tabs button { display: inline-flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 6px; color: var(--fg-faint); font-size: 12px; }
.ac-agent-source-tabs button:hover { background: var(--bg-hover); color: var(--fg); }
.ac-agent-source-tabs button[aria-pressed="true"] { background: var(--bg-3); color: var(--fg-strong); }
.ac-agent-source-tabs button > span { font-size: 10px; color: var(--fg-faint); font-variant-numeric: tabular-nums; }
.ac-agent-result-count { margin-left: auto; font-size: 11px; color: var(--fg-faint); }
.ac-agent-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 18px; }
.ac-agent-tile { display: flex; flex-direction: column; min-width: 0; padding: 23px 24px 0; border: 1px solid var(--border); border-radius: 11px; background: var(--panel); transition: border-color .15s; }
.ac-agent-tile:hover { border-color: var(--border-strong); }
.ac-agent-tile:focus-within { border-color: var(--accent-line); }
.ac-agent-tile-top { display: flex; gap: 12px; align-items: center; }
.ac-agent-avatar { flex: 0 0 40px; height: 40px; display: grid; place-items: center; color: #83acd9; background: rgba(92,151,209,.09); border: 1px solid rgba(92,151,209,.13); border-radius: 10px; }
.orchestrator .ac-agent-avatar { color: var(--accent); background: var(--accent-soft); border-color: var(--accent-line); }
.ac-agent-identity { min-width: 0; flex: 1; }
.ac-agent-role { display: block; text-transform: capitalize; font-size: 10px; color: var(--fg-faint); margin-bottom: 4px; }
.ac-agent-identity h2 { margin: 0; font-size: 16px; font-weight: 500; color: var(--fg-strong); line-height: 1.35; letter-spacing: -.025em; }
.ac-agent-identity h2 button { text-align: left; overflow-wrap: anywhere; }
.ac-agent-identity h2 button:hover { color: var(--accent); }
.ac-agent-switch { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.ac-agent-switch > span { font-size: 10px; color: var(--fg-faint); }
.ac-agent-purpose { color: var(--fg-dim); font-size: 12px; line-height: 1.7; margin: 18px 0; min-height: 41px; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; overflow-wrap: anywhere; }
.ac-agent-model { display: flex; align-items: center; gap: 8px; color: var(--fg-faint); font-size: 11px; min-width: 0; padding: 10px 11px; background: var(--bg); border: 1px solid var(--border); border-radius: 6px; }
.ac-agent-model svg { flex-shrink: 0; }
.ac-agent-model > span:not(.ac-agent-inherited) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--fg-dim); }
.ac-agent-inherited { margin-left: auto; font-size: 9px; flex-shrink: 0; }
.ac-agent-metadata { display: flex; gap: 15px; align-items: center; padding: 16px 0 18px; font-size: 11px; color: var(--fg-faint); flex-wrap: wrap; }
.ac-agent-metadata > span { display: inline-flex; align-items: center; gap: 6px; }
.ac-agent-origin { margin-left: auto; text-transform: capitalize; }
.ac-agent-edited { color: var(--accent); }
.ac-agent-tile-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 13px 0; border-top: 1px solid var(--border); margin-top: auto; }
.ac-agent-configure { display: inline-flex; align-items: center; gap: 5px; color: var(--fg-dim); font-size: 12px; padding: 7px 0; }
.ac-agent-configure:hover { color: var(--accent); }
.ac-agent-test { display: inline-flex; align-items: center; gap: 7px; padding: 7px 10px; border: 1px solid var(--border-input); border-radius: 6px; color: var(--fg); font-size: 11px; }
.ac-agent-test:hover { background: var(--bg-3); }
.ac-agent-test:disabled { opacity: .4; }
.disabled-agent .ac-agent-avatar { opacity: .5; }
@media (max-width: 1100px) {
  .ac-agent-directory { padding: 28px; }
  .ac-agent-switch > span { display: none; }
  .ac-agent-summary-hint { display: none !important; }
}
@media (max-width: 960px) {
  .ac-agent-grid { grid-template-columns: 1fr; }
  .ac-agent-switch > span { display: block; }
}
@media (max-width: 600px) {
  .ac-agent-directory { padding: 24px 18px; }
  .ac-agent-page-heading { flex-direction: column; align-items: flex-start; gap: 18px; }
  .ac-agent-page-heading h1 { font-size: 28px; }
  .ac-agent-controls { flex-wrap: wrap; }
  .ac-agent-search { flex-basis: 100%; }
  .ac-agent-controls select { flex: 1; max-width: none; min-width: 0; }
  .ac-agent-summary { gap: 12px; font-size: 11px; flex-wrap: wrap; }
  .ac-agent-source-tabs { gap: 2px; }
  .ac-agent-source-tabs button { padding: 7px 8px; font-size: 11px; }
  .ac-agent-result-count { display: none; }
  .ac-agent-tile { padding: 18px 16px 0; }
  .ac-agent-switch > span { display: none; }
  .ac-agent-avatar { flex-basis: 34px; height: 34px; }
  .ac-agent-identity h2 { font-size: 15px; }
}

/* Workspace redesign: quiet chrome, clear actions, focused knowledge views. */
.ac-workspace {
  --fs-md: 14px;
  --accent: #a28af8;
  --accent-soft: rgba(148, 120, 234, .12);
  --accent-line: rgba(148, 120, 234, .3);
}
.ac-workspace[data-theme="dark"] {
  color-scheme: dark;
  --bg: #141517; --bg-2: #1c1d21; --bg-3: #232429;
  --panel: #191a1d; --sidebar-bg: #101113; --topbar-bg: #141517;
  --fg: #e4e4e8; --fg-strong: #f4f4f6; --fg-dim: #a1a2ab; --fg-faint: #80818c;
  --border: rgba(255,255,255,.075); --border-strong: rgba(255,255,255,.14);
  --border-input: rgba(255,255,255,.13);
}
.ac-workspace[data-theme="light"] {
  color-scheme: light;
  --bg: #f8f9fb; --bg-2: #f1f2f6; --bg-3: #e9ebf1;
  --panel: #fff; --sidebar-bg: #f0f1f5; --topbar-bg: #f8f9fb;
  --fg: #333440; --fg-strong: #20212b; --fg-dim: #646573; --fg-faint: #737482;
  --accent: #7254c9;
}
.ac-root [hidden] { display: none !important; }
.ac-root :is(button, a, input, textarea, select, summary, [tabindex]):focus-visible {
  outline: 2px solid var(--accent); outline-offset: 3px;
}
.ac-root :is(button, a, summary) { touch-action: manipulation; }
.ac-root button:disabled { cursor: not-allowed; }
.ac-sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}
.ac-skip-link {
  position: absolute; left: 16px; top: -60px; z-index: 200;
  padding: 12px 18px; background: var(--panel); border: 1px solid var(--accent); border-radius: 8px;
}
.ac-skip-link:focus { top: 12px; }
.ac-workspace .ac-btn {
  justify-content: center; gap: 8px; min-height: 34px; height: auto; padding: 8px 13px;
  border-radius: 7px; font-size: 13px; font-weight: 500; line-height: 1.35;
  box-shadow: 0 1px 2px rgba(0,0,0,.06);
}
.ac-workspace .ac-btn.primary {
  background: #7554cf; border-color: #896bd9; color: #fff;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.1), 0 1px 3px rgba(0,0,0,.12);
}
.ac-workspace .ac-btn.primary:hover { background: #8262db; border-color: #9a80e5; }
.ac-workspace .ac-btn .icon { display: inline-flex; flex-shrink: 0; }
.ac-workspace .ac-btn[disabled] { opacity: .45; }
.ac-workspace .ac-icon-btn { width: 32px; height: 32px; flex-shrink: 0; }
.ac-workspace .ac-chip { min-height: 28px; height: auto; padding: 5px 9px; }
.ac-workspace .ac-input { min-width: 0; }
.ac-workspace .ac-toggle { flex: 0 0 30px; }
.ac-workspace .ac-sidebar {
  width: 228px; flex-basis: 228px; min-height: 0; background: var(--sidebar-bg); transition: none;
}
.ac-workspace .ac-logo {
  height: 84px; min-height: 84px; padding: 0 18px; gap: 10px; border: 0; background: none;
}
.ac-workspace .ac-logo-mark {
  width: 31px; height: 31px; flex-basis: 31px; border-radius: 9px;
  background: #8163db; font-size: 16px; font-family: var(--font-sans); letter-spacing: -.04em;
}
.ac-workspace .ac-logo-text { display: flex; flex-direction: column; font-size: 19px; line-height: 1.15; font-weight: 600; letter-spacing: -.045em; }
.ac-logo-caption { margin-top: 5px; color: var(--fg-faint); font-size: 10px; font-weight: 400; letter-spacing: .01em; }
.ac-sidebar-collapse { margin-left: auto; color: var(--fg-faint); }
.ac-workspace .ac-sidebar-search {
  display: flex; align-items: center; gap: 8px; min-height: 35px; margin: 0 14px 22px; padding: 0 10px;
  border: 1px solid var(--border-input); border-radius: 7px; color: var(--fg-faint); font-size: 12px;
  background: var(--bg-hover); text-align: left;
}
.ac-sidebar-search > svg { flex-shrink: 0; }
.ac-sidebar-search > span:not(.ac-kbd) { flex: 1; white-space: nowrap; }
.ac-sidebar-search .ac-kbd { padding: 1px 3px; font-size: 9px; }
.ac-workspace .ac-sidebar-search:hover { background: var(--bg-active); color: var(--fg); }
.ac-workspace .ac-nav { padding: 0 12px 16px; gap: 26px; overflow-y: auto; overflow-x: hidden; min-height: 0; scrollbar-width: thin; }
.ac-nav-group { display: flex; flex-direction: column; gap: 4px; }
.ac-workspace .ac-nav-section {
  padding: 0 12px 8px; height: auto; color: var(--fg-faint);
  font-size: 10px; font-weight: 500; text-transform: uppercase; letter-spacing: .09em;
}
.ac-workspace .ac-nav-item, .ac-workspace .ac-nav-more {
  display: flex; align-items: center; width: 100%; min-height: 39px; height: 39px; flex-shrink: 0; gap: 11px;
  padding: 0 12px; border-radius: 7px; color: var(--fg-dim); text-align: left; font-size: 13px; font-weight: 450;
  overflow: hidden; white-space: nowrap; text-decoration: none;
}
.ac-workspace .ac-nav-item:hover, .ac-workspace .ac-nav-more:hover { background: var(--bg-hover); color: var(--fg-strong); }
.ac-workspace .ac-nav-item.active { background: var(--bg-active); color: var(--fg-strong); box-shadow: none; font-weight: 500; }
.ac-workspace .ac-nav-item.active .ac-nav-icon { color: var(--accent); }
.ac-workspace .ac-nav-icon { display: inline-flex; align-items: center; justify-content: center; width: 18px; flex: 0 0 18px; color: var(--fg-faint); }
.ac-nav-label { min-width: 0; text-overflow: ellipsis; overflow: hidden; }
.ac-workspace .ac-nav-count { margin-left: auto; padding: 1px 5px; font-size: 10px; border-radius: 4px; background: var(--bg-3); color: var(--fg-dim); line-height: 1.6; }
.ac-nav-more-wrap { padding-top: 14px; border-top: 1px solid var(--border); }
.ac-nav-chevron { margin-left: auto; display: inline-flex; transition: transform .15s; }
.ac-nav-more-wrap.open .ac-nav-chevron { transform: rotate(180deg); }
.ac-workspace .ac-nav-more.has-active { color: var(--fg-strong); }
.ac-nav-more-items { margin: 5px 0 0 21px; padding-left: 7px; border-left: 1px solid var(--border-strong); }
.ac-workspace .ac-nav-more-items .ac-nav-item { height: 34px; min-height: 34px; font-size: 12px; }
.ac-workspace .ac-sidebar-footer { display: flex; flex-direction: column; align-items: stretch; padding: 12px; gap: 17px; border-top: 1px solid var(--border); background: transparent; }
.ac-workspace-status { display: flex; align-items: center; gap: 7px; padding: 0 12px 5px; font-size: 10px; color: var(--fg-faint); }
.ac-workspace-status > span:first-child { width: 5px; height: 5px; background: var(--fg-faint); border-radius: 50%; }
.ac-status-caption { margin-left: auto; opacity: .7; }
.ac-workspace .ac-sidebar.collapsed { width: 68px; flex-basis: 68px; }
.ac-workspace .ac-sidebar.collapsed .ac-logo { justify-content: center; padding: 0; }
.ac-workspace .ac-sidebar.collapsed :is(.ac-logo-text, .ac-logo-caption, .ac-sidebar-collapse, .ac-nav-section, .ac-nav-label, .ac-nav-count, .ac-nav-chevron, .ac-workspace-status) { display: none; }
.ac-workspace .ac-sidebar.collapsed .ac-sidebar-search { justify-content: center; margin: 0 14px 20px; padding: 0; }
.ac-workspace .ac-sidebar.collapsed .ac-sidebar-search span { display: none; }
.ac-workspace .ac-sidebar.collapsed .ac-nav { padding-inline: 10px; gap: 20px; }
.ac-workspace .ac-sidebar.collapsed :is(.ac-nav-item, .ac-nav-more) { justify-content: center; padding: 0; }
.ac-workspace .ac-sidebar.collapsed .ac-nav-more-items { margin-left: 0; border: 0; padding: 0; }
.ac-workspace .ac-sidebar.collapsed .ac-sidebar-footer { display: flex; padding-inline: 10px; }
.ac-workspace .ac-topbar { height: 60px; flex-basis: 60px; gap: 14px; padding-inline: 24px; background: var(--topbar-bg); backdrop-filter: none; }
.ac-workspace .ac-topbar > .ac-icon-btn { color: var(--fg-faint); }
.ac-workspace .ac-proj { min-width: 0; }
.ac-workspace .ac-proj > .ac-chip { max-width: 100%; border: none; background: none; padding: 7px 0; font-size: 12px; color: var(--fg-dim); }
.ac-proj > .ac-chip > .ac-strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.ac-workspace .ac-breadcrumb { font-size: 12px; gap: 14px; }
.ac-workspace .ac-topbar-right { gap: 9px; }
.ac-workspace .ac-avatar { width: 28px; height: 28px; background: var(--bg-3); border: 1px solid var(--border-strong); color: var(--fg-dim); }
.ac-workspace .ac-page { min-height: 0; scrollbar-width: thin; }
.ac-workspace .ac-page-h { padding: 28px 32px 20px; }
.ac-workspace .ac-page-h h1 { font-size: 27px; letter-spacing: -.04em; }
.ac-workspace .ac-page-h .sub { margin-top: 6px; color: var(--fg-dim); }

.ac-kb.ac-kb-workspace { width: 100%; max-width: 1260px; margin: 0 auto; padding: 34px 40px 44px; gap: 24px; }
.ac-kb-page-heading { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding-bottom: 4px; }
.ac-eyebrow { color: var(--fg-faint); font-size: 10px; font-weight: 500; letter-spacing: .09em; text-transform: uppercase; }
.ac-kb-page-heading h1 { margin: 6px 0 7px; color: var(--fg-strong); font-size: 32px; font-weight: 600; letter-spacing: -.045em; line-height: 1.2; }
.ac-kb-page-heading p { margin: 0; font-size: 14px; color: var(--fg-dim); line-height: 1.5; }
.ac-kb-heading-actions { flex-shrink: 0; }
.ac-kb-heading-actions .ac-btn { min-height: 38px; padding-inline: 15px; }
.ac-kb-status-strip { display: flex; align-items: center; gap: 13px; padding: 16px 18px; border: 1px solid var(--border); border-radius: 9px; background: var(--panel); }
.ac-kb-status-symbol { display: grid; place-items: center; width: 36px; height: 36px; flex: 0 0 36px; border-radius: 9px; color: var(--fg-dim); background: var(--bg-3); }
.ac-kb-status-copy { display: flex; flex-direction: column; flex: 1; min-width: 0; gap: 4px; }
.ac-kb-status-copy strong { font-weight: 500; color: var(--fg); font-size: 13px; }
.ac-kb-status-copy > span { color: var(--fg-faint); font-size: 12px; line-height: 1.5; overflow-wrap: anywhere; }
.ac-kb-status-strip.ready .ac-kb-status-symbol { color: var(--st-green); background: rgba(62,207,142,.08); }
.ac-kb-status-strip.warn .ac-kb-status-symbol { color: var(--st-amber); background: rgba(245,165,36,.08); }
.ac-kb-enable { display: flex; align-items: center; gap: 11px; color: var(--fg-dim); font-size: 11px; flex-shrink: 0; padding-left: 14px; }
.ac-kb-tabs { display: flex; gap: 28px; border-bottom: 1px solid var(--border-strong); min-height: 43px; }
.ac-kb-tabs > button { display: flex; align-items: center; gap: 8px; position: relative; padding: 0 0 14px; font-size: 13px; color: var(--fg-faint); white-space: nowrap; }
.ac-kb-tabs > button:hover { color: var(--fg); }
.ac-kb-tabs > button[aria-selected="true"] { color: var(--fg-strong); }
.ac-kb-tabs > button[aria-selected="true"]::after { content: ''; position: absolute; height: 2px; left: 0; right: 0; bottom: -1px; border-radius: 2px; background: var(--accent); }
.ac-kb-tab-count { padding: 0 5px; min-width: 19px; text-align: center; border-radius: 4px; background: var(--bg-3); color: var(--fg-dim); font-size: 10px; line-height: 18px; font-variant-numeric: tabular-nums; }
.ac-kb-library-layout { display: grid; grid-template-columns: minmax(0,1fr) 265px; gap: 26px; align-items: start; }
.ac-kb .ac-panel { border-radius: 10px; background: var(--panel); box-shadow: none; min-width: 0; }
.ac-kb-library-header { display: flex; align-items: center; gap: 14px; padding: 22px 24px 20px; border-bottom: 1px solid var(--border); }
.ac-kb-library-header h2 { margin: 0; color: var(--fg-strong); font-size: 15px; font-weight: 500; letter-spacing: -.02em; }
.ac-kb-library-header p { margin: 5px 0 0; font-size: 12px; color: var(--fg-faint); }
.ac-kb-file-count { margin-left: auto; white-space: nowrap; color: var(--fg-faint); font-size: 11px; }
.ac-kb-library-empty { min-height: 350px; display: flex; align-items: center; flex-direction: column; padding: 38px 24px 30px; text-align: center; background: transparent; }
.ac-kb-document-art { position: relative; width: 136px; height: 104px; margin: 0 0 25px; }
.ac-kb-document-art .sheet { position: absolute; width: 66px; height: 84px; border: 1px solid var(--border-strong); border-radius: 8px; left: 35px; top: 10px; background: var(--bg-3); }
.ac-kb-document-art .rear { transform: rotate(-18deg) translate(-13px,2px); opacity: .45; }
.ac-kb-document-art .middle { transform: rotate(15deg) translate(15px,-1px); background: var(--bg-2); }
.ac-kb-document-art .front { display: flex; flex-direction: column; align-items: flex-start; padding: 11px 12px; gap: 5px; background: var(--panel); box-shadow: 0 5px 12px rgba(0,0,0,.1); }
.sheet-icon { display: inline-flex; color: var(--accent); margin-bottom: 3px; }
.ac-kb-document-art i { width: 100%; height: 3px; border-radius: 2px; background: var(--border-strong); }
.ac-kb-document-art i:last-child { width: 65%; }
.sheet-plus { position: absolute; display: grid; place-items: center; width: 29px; height: 29px; right: 17px; bottom: 4px; color: var(--accent); background: var(--bg-3); border: 3px solid var(--panel); border-radius: 50%; }
.ac-kb-library-empty h3 { max-width: 330px; margin: 0 0 10px; color: var(--fg-strong); font-size: 19px; line-height: 1.35; font-weight: 500; letter-spacing: -.035em; text-wrap: balance; }
.ac-kb-library-empty p { max-width: 390px; margin: 0 0 23px; color: var(--fg-faint); font-size: 12px; line-height: 1.7; text-wrap: pretty; }
.ac-kb-library-empty .ac-btn { min-height: 38px; padding-inline: 16px; }
.ac-kb-drop-caption { margin-top: 11px; font-size: 11px; color: var(--fg-faint); }
.ac-kb-file-types { display: flex; justify-content: center; gap: 7px; margin-top: 27px; }
.ac-kb-file-types > span { border: 1px solid var(--border); color: var(--fg-faint); border-radius: 4px; font-family: var(--font-mono); font-size: 9px; padding: 3px 6px; }
.ac-kb-docs.is-dragging { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.ac-kb-docs.is-dragging .ac-kb-library-empty { background: var(--accent-soft); }
.ac-kb-file-help { border-top: 1px solid var(--border); padding: 0 24px; font-size: 11px; color: var(--fg-faint); }
.ac-kb-file-help summary { display: flex; align-items: center; gap: 8px; padding: 16px 0; cursor: pointer; list-style: none; }
.ac-kb-file-help summary > svg:last-child { margin-left: auto; }
.ac-kb-file-help summary::-webkit-details-marker { display: none; }
.ac-kb-file-help[open] summary > svg:last-child { transform: rotate(180deg); }
.ac-kb-file-help > div { padding-bottom: 14px; line-height: 1.65; overflow-wrap: anywhere; }
.ac-kb-file-help p { margin: 0 0 10px; }
.ac-kb-file-help p:last-child { margin-bottom: 0; }
.ac-kb-file-help .ac-mono { font-size: 10px; color: var(--fg-dim); }
.ac-kb-library-toolbar { display: flex; gap: 10px; padding: 16px 20px; }
.ac-kb-library-toolbar .ac-search { min-width: 0; flex: 1; height: 35px; background: var(--bg); }
.ac-kb-library-toolbar input { min-width: 0; }
.ac-kb-library-toolbar select { width: 140px; height: 35px; font-size: 11px; }
.ac-kb-docs .ac-table-card { margin: 0; overflow-x: auto; border-radius: 0; border-left: 0; border-right: 0; box-shadow: none; }
.ac-kb-docs .ac-table { min-width: 650px; }
.ac-kb-docs .ac-table tbody td:first-child { min-width: 180px; }
.ac-kb-no-results { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 35px 20px; white-space: normal; }
.ac-kb-no-results > span { color: var(--fg-faint); }
.ac-kb-setup { padding: 5px 0; min-width: 0; }
.ac-kb-setup-header { display: flex; align-items: center; justify-content: space-between; }
.ac-kb-setup-header > span:last-child { color: var(--fg-faint); font-family: var(--font-mono); font-size: 10px; }
.ac-kb-setup h2 { max-width: 235px; margin: 17px 0 9px; color: var(--fg); font-size: 18px; font-weight: 500; letter-spacing: -.03em; line-height: 1.45; }
.ac-kb-setup > p { font-size: 12px; line-height: 1.7; color: var(--fg-faint); margin: 0; max-width: 250px; }
.ac-kb-steps { margin: 24px 0 8px; padding: 0; list-style: none; }
.ac-kb-steps li { position: relative; display: flex; align-items: flex-start; gap: 13px; padding-bottom: 23px; }
.ac-kb-steps li:not(:last-child)::after { content: ''; position: absolute; width: 1px; background: var(--border-strong); left: 13px; top: 32px; bottom: 5px; }
.ac-kb-step-number { display: grid; place-items: center; width: 28px; height: 28px; flex: 0 0 28px; border: 1px solid var(--border-strong); border-radius: 50%; color: var(--fg-faint); font-size: 10px; font-family: var(--font-mono); }
.ac-kb-steps li.current .ac-kb-step-number { color: var(--accent); background: var(--accent-soft); border-color: var(--accent-line); }
.ac-kb-steps li.done .ac-kb-step-number { color: var(--st-green); background: rgba(62,207,142,.07); border-color: rgba(62,207,142,.2); }
.ac-kb-steps li > div { display: flex; flex-direction: column; gap: 5px; padding-top: 3px; }
.ac-kb-steps strong { color: var(--fg-dim); font-weight: 500; font-size: 12px; }
.ac-kb-steps li.current strong { color: var(--fg-strong); }
.ac-kb-steps li > div > span { font-size: 10px; color: var(--fg-faint); line-height: 1.5; }
.ac-kb-text-action { display: inline-flex; align-items: center; gap: 6px; color: var(--accent); font-size: 11px; padding: 5px 0; }
.ac-kb-text-action:hover { color: var(--fg-strong); }
.ac-kb-text-action:disabled { opacity: .5; }
.ac-kb-text-action.subtle { color: var(--fg-dim); }
.ac-kb-text-action.subtle:hover { color: var(--fg-strong); }
.ac-kb-index-details { margin-top: 27px; padding-top: 23px; border-top: 1px solid var(--border); }
.ac-kb-small-stats { display: grid; grid-template-columns: repeat(3,1fr); gap: 14px; }
.ac-kb-small-stats > div { display: flex; flex-direction: column; gap: 6px; }
.ac-kb-small-stats strong { font-size: 18px; font-weight: 500; color: var(--fg-dim); font-variant-numeric: tabular-nums; }
.ac-kb-small-stats span { color: var(--fg-faint); font-size: 10px; }
.ac-kb-index-details dl { margin: 20px 0 13px; display: flex; flex-direction: column; gap: 10px; font-size: 11px; }
.ac-kb-index-details dl > div { display: flex; justify-content: space-between; gap: 10px; }
.ac-kb-index-details dt { color: var(--fg-faint); }
.ac-kb-index-details dd { margin: 0; text-align: right; color: var(--fg-dim); overflow-wrap: anywhere; }
.ac-kb .ac-kb-fails { margin: 0; }
.ac-kb .ac-panel-h { padding: 24px; align-items: flex-start; }
.ac-kb .ac-panel-h h2 { margin: 0; font-size: 16px; font-weight: 500; color: var(--fg-strong); letter-spacing: -.02em; }
.ac-kb .ac-panel-h .sub { margin-top: 7px; font-size: 12px; color: var(--fg-faint); line-height: 1.6; }
.ac-kb-test-panel { min-height: 410px; }
.ac-kb-search { padding: 24px 24px 0; gap: 10px; }
.ac-kb-search .ac-search { height: 43px; min-width: 0; background: var(--bg); padding-inline: 12px; }
.ac-kb-search input { min-width: 0; }
.ac-kb-search > .ac-btn { height: 43px; padding-inline: 18px; }
.ac-kb-search-helper { padding: 54px 24px 46px; display: flex; flex-direction: column; align-items: center; gap: 20px; text-align: center; }
.ac-kb-search-helper-icon { display: grid; place-items: center; width: 45px; height: 45px; background: var(--bg-3); color: var(--fg-faint); border-radius: 12px; }
.ac-kb-search-helper > div { display: flex; flex-direction: column; align-items: center; gap: 10px; max-width: 370px; }
.ac-kb-search-helper strong { font-size: 16px; font-weight: 500; color: var(--fg); letter-spacing: -.02em; }
.ac-kb-search-helper span { font-size: 12px; line-height: 1.6; color: var(--fg-faint); }
.ac-kb-hits { padding: 0 24px 24px; }
.ac-kb-hit-body { max-height: 320px; overflow-wrap: anywhere; }
.ac-kb-config-layout { display: flex; flex-direction: column; gap: 20px; }
.ac-kb-model-layout { display: grid; grid-template-columns: 215px minmax(0,1fr); }
.ac-kb-model-picker { display: flex; flex-direction: column; gap: 6px; padding: 20px 15px; border-right: 1px solid var(--border); background: var(--bg); }
.ac-kb-model-picker > button { display: flex; align-items: center; gap: 9px; min-height: 42px; padding: 7px 10px; border-radius: 7px; color: var(--fg-dim); font-size: 12px; text-align: left; }
.ac-kb-model-picker > button:hover { background: var(--bg-hover); color: var(--fg); }
.ac-kb-model-picker > button.selected { background: var(--bg-active); color: var(--fg-strong); }
.ac-kb-provider-icon { width: 23px; height: 23px; display: grid; place-items: center; border: 1px solid var(--border-strong); border-radius: 6px; font-size: 10px; font-weight: 600; color: var(--fg-faint); }
.ac-kb-active-label { margin-left: auto; color: var(--accent); font-size: 9px; }
.ac-kb-model-editors { padding: 25px 28px; min-width: 0; }
.ac-kb-model-editors .ac-prov-card { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); align-content: start; gap: 19px; padding: 0; border: 0; box-shadow: none; border-radius: 0; background: none; }
.ac-kb-model-editors :is(.ac-card-head, .ac-card-foot, .ac-kb-hint) { grid-column: 1 / -1; }
.ac-kb-model-editors .ac-card-head { margin-bottom: 2px; }
.ac-kb-model-editors .ac-card-name { font-size: 16px; font-weight: 500; }
.ac-kb-model-editors .ac-card-foot { margin-top: 3px; border-top: 1px solid var(--border); padding-top: 18px; }
.ac-kb .ac-prov-field label { color: var(--fg-dim); font-size: 11px; text-transform: none; letter-spacing: 0; overflow-wrap: anywhere; }
.ac-kb .ac-input { height: 36px; padding: 8px 10px; background: var(--bg); border-radius: 6px; font-size: 12px; }
.ac-kb .ac-kb-hint { font-size: 11px; line-height: 1.65; color: var(--fg-faint); }
.ac-kb .ac-kb-hint.warn { color: var(--st-amber); }
.ac-kb-advanced { border: 1px solid var(--border); border-radius: 9px; background: var(--panel); overflow: hidden; }
.ac-kb-advanced > summary { display: flex; align-items: center; justify-content: space-between; gap: 15px; padding: 20px 24px; cursor: pointer; list-style: none; color: var(--fg-dim); }
.ac-kb-advanced > summary::-webkit-details-marker { display: none; }
.ac-kb-advanced > summary > span { display: flex; align-items: center; gap: 12px; }
.ac-kb-advanced > summary strong { font-size: 13px; font-weight: 500; color: var(--fg); }
.ac-kb-advanced > summary > span > span { font-size: 11px; color: var(--fg-faint); }
.ac-kb-advanced[open] > summary > svg { transform: rotate(180deg); }
.ac-kb-advanced .ac-panel { border: 0; border-top: 1px solid var(--border); border-radius: 0; }
.ac-kb .ac-kb-grid { grid-template-columns: repeat(3,minmax(0,1fr)); gap: 25px; padding: 24px; }
.ac-kb .ac-kb-field > label { color: var(--fg-dim); font-size: 12px; text-transform: none; letter-spacing: 0; }
.ac-kb .ac-kb-field .ac-segment { flex-wrap: wrap; }
.ac-kb .ac-kb-actions { padding: 16px 24px; flex-wrap: wrap; background: transparent; }
.ac-kb-maintenance { display: flex; align-items: center; gap: 24px; padding: 10px 0; }
.ac-kb-maintenance > div { flex: 1; }
.ac-kb-maintenance strong { color: var(--fg-dim); font-size: 12px; font-weight: 500; }
.ac-kb-maintenance p { color: var(--fg-faint); font-size: 11px; line-height: 1.6; margin: 5px 0 0; }
.ac-kb-maintenance .ac-btn { flex-shrink: 0; }
@media (min-width: 1600px) {
  .ac-kb.ac-kb-workspace { padding-top: 44px; gap: 28px; }
  .ac-kb-library-empty { padding-block: 48px 36px; }
}
@media (max-width: 1150px) {
  .ac-kb.ac-kb-workspace { padding: 28px; }
  .ac-kb-library-layout { grid-template-columns: minmax(0,1fr) 225px; gap: 22px; }
  .ac-kb-enable > span { display: none; }
  .ac-kb-model-layout { grid-template-columns: 190px minmax(0,1fr); }
  .ac-kb-model-editors { padding: 24px 20px; }
}
@media (max-width: 960px) {
  .ac-kb-library-layout { grid-template-columns: 1fr; }
  .ac-kb-setup { padding: 24px; border: 1px solid var(--border); border-radius: 9px; }
  .ac-kb-setup h2, .ac-kb-setup > p { max-width: none; }
  .ac-kb-steps { display: flex; gap: 20px; }
  .ac-kb-steps li { flex: 1; padding-bottom: 12px; }
  .ac-kb-steps li::after { display: none; }
  .ac-kb-index-details { margin-top: 22px; }
  .ac-kb .ac-kb-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .ac-kb-model-editors .ac-prov-card { grid-template-columns: 1fr; }
  .ac-kb-advanced > summary > span > span { display: none; }
}
@media (max-width: 760px) {
  .ac-workspace .ac-sidebar { width: 68px; flex-basis: 68px; }
  .ac-workspace .ac-sidebar .ac-logo { justify-content: center; padding: 0; }
  .ac-workspace .ac-sidebar :is(.ac-logo-text, .ac-sidebar-collapse, .ac-nav-section, .ac-nav-label, .ac-nav-count, .ac-workspace-status, .ac-nav-chevron) { display: none; }
  .ac-workspace .ac-sidebar .ac-sidebar-search { justify-content: center; margin: 0 14px 20px; padding: 0; }
  .ac-workspace .ac-sidebar .ac-sidebar-search span { display: none; }
  .ac-workspace .ac-sidebar .ac-nav { padding-inline: 10px; gap: 18px; }
  .ac-workspace .ac-sidebar :is(.ac-nav-item, .ac-nav-more) { justify-content: center; padding: 0; }
  .ac-workspace .ac-sidebar .ac-nav-more-items { margin: 5px 0 0; border: 0; padding: 0; }
  .ac-workspace .ac-topbar { padding: 0 12px; gap: 6px; }
  .ac-workspace .ac-breadcrumb { display: none; }
  .ac-workspace .ac-proj { flex: 1; }
  .ac-kb.ac-kb-workspace { padding: 24px 18px; gap: 20px; }
  .ac-kb-page-heading { align-items: flex-start; }
  .ac-kb-page-heading h1 { font-size: 27px; }
  .ac-kb-page-heading p { font-size: 12px; max-width: 280px; }
  .ac-kb-page-heading .ac-eyebrow { font-size: 9px; }
  .ac-kb-status-strip { padding: 13px; }
  .ac-kb-status-symbol { display: none; }
  .ac-kb-tabs { gap: 22px; }
  .ac-kb-tabs > button { font-size: 11px; gap: 6px; }
  .ac-kb .ac-kb-grid { grid-template-columns: 1fr; }
  .ac-kb-model-layout { grid-template-columns: 1fr; }
  .ac-kb-model-picker { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); border-right: 0; border-bottom: 1px solid var(--border); }
}
@media (max-width: 520px) {
  .ac-workspace .ac-topbar > .ac-icon-btn, .ac-workspace .ac-topbar .ac-avatar { display: none; }
  .ac-workspace .ac-topbar-right { gap: 0; }
  .ac-workspace .ac-proj > .ac-chip { font-size: 10px; }
  .ac-kb-page-heading { flex-direction: column; gap: 16px; }
  .ac-kb-page-heading .ac-btn { min-height: 36px; }
  .ac-kb-tabs { gap: 18px; overflow-x: auto; }
  .ac-kb-tabs > button > svg { display: none; }
  .ac-kb-library-header { padding: 18px; }
  .ac-kb-library-header p { line-height: 1.6; }
  .ac-kb-library-empty { padding: 30px 16px; }
  .ac-kb-library-empty h3 { font-size: 18px; }
  .ac-kb-library-empty p { font-size: 11px; }
  .ac-kb-library-empty p br { display: none; }
  .ac-kb-file-help { padding: 0 16px; }
  .ac-kb-file-help summary { font-size: 10px; }
  .ac-kb-steps { flex-direction: column; gap: 4px; }
  .ac-kb-setup { padding: 20px; }
  .ac-kb-library-toolbar { flex-direction: column; padding: 15px; }
  .ac-kb-library-toolbar select { width: 100%; }
  .ac-kb .ac-panel-h, .ac-kb-model-editors { padding: 20px; }
  .ac-kb-search { padding: 20px 16px 0; flex-wrap: wrap; }
  .ac-kb-search > .ac-search { flex-basis: 100%; }
  .ac-kb-search > .ac-btn { width: 100%; }
  .ac-kb-maintenance { flex-direction: column; align-items: flex-start; gap: 12px; }
}
@media (prefers-reduced-motion: reduce) {
  .ac-root *, .ac-root *::before, .ac-root *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

/* Connectors — brand marks, the stat strip, the tab/search/filter toolbar and
   the browsable directory. The whole screen uses the 20px gutter .ac-cards
   already establishes, so nothing steps in and out as you scroll. */

/* A mark is either a real inline SVG or a tinted monogram; both occupy the same
   box so card headers never shift by a pixel between the two. */
.ac-cw-logo {
  display: inline-grid; place-items: center; flex: none;
  border-radius: 6px; overflow: hidden;
}
.ac-cw-logo svg, .ac-cw-logo img { display: block; }
.ac-cw-mono {
  color: #fff; font-weight: 700; letter-spacing: -0.02em;
  font-family: var(--font-sans);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.14);
}

/* ---- stat strip ---- */
.ac-cw-stats {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(128px, 1fr));
  gap: 10px; padding: 14px 20px 0;
}
.ac-cw-stat {
  padding: 10px 12px; border: 1px solid var(--border);
  border-radius: 9px; background: var(--bg-2); min-width: 0;
}
.ac-cw-stat .v {
  font-size: 20px; font-weight: 600; line-height: 1.15;
  color: var(--fg-strong); font-variant-numeric: tabular-nums;
}
.ac-cw-stat .l {
  margin-top: 2px; font-size: var(--fs-xs); color: var(--fg-dim);
  text-transform: uppercase; letter-spacing: 0.05em;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.ac-cw-stat.good .v { color: var(--st-green); }
.ac-cw-stat.accent .v { color: var(--accent); }

/* ---- tabs + search ---- */
.ac-cw-tabs {
  display: flex; align-items: center; gap: 4px; flex-wrap: wrap;
  padding: 16px 20px 0; border-bottom: 1px solid var(--border); margin-bottom: 0;
}
.ac-cw-tab {
  display: inline-flex; align-items: center; gap: 7px;
  height: 30px; padding: 0 11px; margin-bottom: -1px;
  border: 0; border-bottom: 2px solid transparent; background: none;
  font: inherit; font-size: var(--fs-md); color: var(--fg-dim);
  cursor: pointer;
}
.ac-cw-tab:hover { color: var(--fg); }
.ac-cw-tab.on { color: var(--fg-strong); border-bottom-color: var(--accent); font-weight: 500; }
.ac-cw-tab-n {
  min-width: 18px; padding: 0 5px; border-radius: 999px;
  background: var(--bg-3); color: var(--fg-dim);
  font-size: 10px; line-height: 16px; text-align: center;
  font-variant-numeric: tabular-nums;
}
.ac-cw-tab.on .ac-cw-tab-n { background: var(--accent-soft); color: var(--accent); }

.ac-cw-find { position: relative; margin: 0 0 6px auto; display: block; width: min(280px, 44vw); }
.ac-cw-find .ac-input { width: 100%; height: 28px; padding-left: 28px; padding-right: 26px; }
.ac-cw-find-i {
  position: absolute; left: 9px; top: 50%; transform: translateY(-50%);
  display: inline-flex; color: var(--fg-faint); pointer-events: none;
}
.ac-cw-find-x {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  display: inline-grid; place-items: center; width: 17px; height: 17px;
  border: 0; border-radius: 4px; background: none; color: var(--fg-faint); cursor: pointer;
}
.ac-cw-find-x:hover { background: var(--bg-hover); color: var(--fg); }

/* ---- category chips ---- */
.ac-cw-chips {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  padding: 12px 20px 0;
}

/* ---- directory grouping ---- */
.ac-cw-group + .ac-cw-group { margin-top: 2px; }
.ac-cw-group-h {
  display: flex; align-items: center; gap: 8px;
  padding: 18px 20px 0;
  font-size: var(--fs-xs); font-weight: 600; color: var(--fg-dim);
  text-transform: uppercase; letter-spacing: 0.07em;
}
.ac-cw-group-h::after {
  content: ''; flex: 1; height: 1px; background: var(--border);
}
.ac-cw-group-n {
  order: 1; padding: 0 6px; border-radius: 999px; background: var(--bg-3);
  color: var(--fg-faint); font-size: 10px; line-height: 15px; letter-spacing: 0;
}
.ac-cw-group .ac-cards { padding-top: 10px; }

/* ---- cards ---- */
.ac-cw-card { gap: 9px; }
/* Blurbs are prose, not identifiers — .ac-card-meta's mono face made every card
   read like a config value. Two lines keeps the grid on one baseline. */
.ac-cw-blurb {
  font-size: var(--fs-sm); line-height: 1.45; color: var(--fg-dim);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden; min-height: 2.9em;
}
.ac-cw-facts {
  display: flex; gap: 8px; flex-wrap: wrap;
  font-size: var(--fs-xs); color: var(--fg-dim);
}
.ac-cw-tags { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ac-cw-auth { font-size: var(--fs-xs); color: var(--fg-faint); }
.ac-cw-dirnote { margin-left: auto; font-size: var(--fs-xs); color: var(--fg-faint); }
.ac-cw-card { cursor: pointer; transition: border-color 0.12s, transform 0.12s; }
.ac-cw-card:hover { transform: translateY(-1px); }
.ac-cw-on { border-color: rgba(62, 207, 142, 0.32); }
.ac-cw-dir .ac-card-foot .ac-btn { height: 26px; }

.ac-cw-empty {
  margin: 14px 20px; padding: 14px 16px;
  border: 1px dashed var(--border-strong); border-radius: 10px;
  background: var(--bg-2); font-size: var(--fs-sm); color: var(--fg-dim);
}
.ac-cw-empty strong { color: var(--fg-strong); font-weight: 600; }
.ac-cw-link {
  border: 0; background: none; padding: 0; font: inherit;
  color: var(--accent); cursor: pointer; text-decoration: underline;
}

/* ---- directory detail dialog ---- */
.ac-cw-dlg-head { display: flex; align-items: center; gap: 12px; min-width: 0; }
.ac-cw-dlg-rows {
  border: 1px solid var(--border); border-radius: 9px; overflow: hidden; background: var(--bg-2);
}
.ac-cw-dlg-rows > div {
  display: flex; align-items: center; gap: 12px;
  padding: 8px 12px; font-size: var(--fs-sm);
  border-bottom: 1px solid var(--border);
}
.ac-cw-dlg-rows > div:last-child { border-bottom: 0; }
.ac-cw-dlg-rows span { color: var(--fg-dim); }
.ac-cw-dlg-rows b { margin-left: auto; font-weight: 500; color: var(--fg-strong); }

/* ============================================================
   Voice (speech.jsx) — ac-sp-*
   The screen renders its own page heading, like Knowledge, so it
   owns the outer padding rather than sitting inside .ac-page-h.
   ============================================================ */
.ac-sp {
  display: flex; flex-direction: column; gap: 22px;
  width: 100%; max-width: 1260px; margin: 0 auto; padding: 34px 40px 44px;
}

.ac-sp-heading { display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.ac-sp-heading h1 {
  margin: 0 0 7px; color: var(--fg-strong);
  font-size: 32px; font-weight: 600; letter-spacing: -.045em; line-height: 1.2;
}
.ac-sp-heading p { margin: 0; max-width: 62ch; font-size: 14px; color: var(--fg-dim); line-height: 1.55; }
.ac-sp-enable { display: flex; align-items: center; gap: 11px; flex-shrink: 0; }
.ac-sp-state { font-size: var(--fs-xs); color: var(--fg-faint); text-transform: uppercase; letter-spacing: .08em; }
.ac-sp-state.on { color: var(--st-green); }

/* One line of facts, so the state of the whole layer reads at a glance. */
.ac-sp-summary {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 20px;
  padding: 13px 16px; border: 1px solid var(--border); border-radius: 9px;
  background: var(--panel); font-size: var(--fs-sm); color: var(--fg-dim);
}
.ac-sp-summary > span { display: inline-flex; align-items: center; gap: 7px; }
.ac-sp-summary strong { color: var(--fg-strong); font-weight: 600; font-variant-numeric: tabular-nums; }
.ac-sp-live { margin-left: auto; color: var(--fg-faint); font-size: var(--fs-xs); }

.ac-sp-tabs { display: flex; gap: 28px; border-bottom: 1px solid var(--border-strong); min-height: 40px; }
.ac-sp-tabs > button { position: relative; padding: 0 0 13px; font-size: 13px; color: var(--fg-faint); white-space: nowrap; }
.ac-sp-tabs > button:hover { color: var(--fg); }
.ac-sp-tabs > button[aria-selected="true"] { color: var(--fg-strong); }
.ac-sp-tabs > button[aria-selected="true"]::after {
  content: ''; position: absolute; left: 0; right: 0; bottom: -1px;
  height: 2px; border-radius: 2px; background: var(--accent);
}

.ac-sp-panel { border-radius: 10px; background: var(--panel); box-shadow: none; min-width: 0; }
.ac-sp-panel .ac-panel-h > div { min-width: 0; }
/* .ac-panel-h .sub is a mono stat by default; here it is prose. */
.ac-sp-panel .ac-panel-h .sub {
  margin-left: 0; margin-top: 3px; font-family: var(--font-sans);
  font-size: var(--fs-sm); color: var(--fg-dim); max-width: 74ch;
}
.ac-sp-panel-icon {
  display: grid; place-items: center; width: 30px; height: 30px; flex: 0 0 30px;
  border-radius: 8px; color: var(--fg-dim); background: var(--bg-3);
}
.ac-sp-panel-tag { margin-left: auto; flex: none; font-size: var(--fs-xs); color: var(--fg-faint); }
.ac-sp-subhead { padding: 12px 20px; border-bottom: 1px solid var(--border); }
.ac-sp-body { display: flex; flex-direction: column; gap: 14px; padding: 18px 20px 20px; }

.ac-sp-hint { margin: 0; font-size: var(--fs-sm); color: var(--fg-faint); line-height: 1.55; max-width: 84ch; }
.ac-sp-hint.warn { color: var(--st-amber); }
.ac-sp-hint code, .ac-sp-card-langs code {
  padding: 1px 5px; border-radius: 4px; background: var(--bg-3);
  font-family: var(--font-mono); font-size: 11px; color: var(--fg);
}
.ac-sp-warn { color: var(--st-amber); }

.ac-sp-row {
  display: flex; align-items: flex-start; gap: 20px;
  padding-top: 14px; border-top: 1px solid var(--border);
}
.ac-sp-row > div:first-child { flex: 1; min-width: 0; }
.ac-sp-row .ac-toggle { flex: none; margin-top: 2px; }
.ac-sp-row-name { font-size: var(--fs-sm); font-weight: 500; color: var(--fg-strong); }
.ac-sp-row-sub { margin-top: 4px; font-size: var(--fs-xs); color: var(--fg-faint); line-height: 1.6; max-width: 78ch; }

.ac-sp-inline { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; }
.ac-sp-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.ac-sp-field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.ac-sp-field > span { font-size: var(--fs-xs); color: var(--fg-faint); }
.ac-sp-actions { display: flex; justify-content: flex-end; gap: 8px; }

.ac-sp-advanced { padding-top: 14px; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 12px; }
.ac-sp-disclose {
  display: inline-flex; align-items: center; gap: 6px; align-self: flex-start;
  font-size: var(--fs-xs); color: var(--fg-faint);
}
.ac-sp-disclose:hover { color: var(--fg); }
.ac-sp-disclose[aria-expanded="false"] > svg { transform: rotate(-90deg); }
.ac-sp-format { display: flex; align-items: center; gap: 12px; font-size: var(--fs-sm); color: var(--fg-dim); }

/* ---- engine cards ---- */
.ac-sp-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px; padding: 16px 20px 20px;
}
.ac-sp-card {
  display: flex; flex-direction: column; gap: 11px;
  padding: 14px; border: 1px solid var(--border); border-radius: 9px; background: var(--bg-2);
}
.ac-sp-card.is-default { border-color: var(--accent-line); background: var(--accent-soft); }
.ac-sp-card.is-unconfigured { opacity: .82; }
.ac-sp-card.is-unconfigured:hover, .ac-sp-card.is-unconfigured:focus-within { opacity: 1; }
.ac-sp-card-head { display: flex; align-items: center; gap: 8px; }
.ac-sp-card-name { font-size: var(--fs-sm); font-weight: 600; color: var(--fg-strong); }
.ac-sp-card-head > .ac-badge, .ac-sp-card-head > .ac-chip { margin-left: auto; flex: none; }
.ac-sp-keys { display: flex; flex-direction: column; gap: 8px; }
.ac-sp-key { display: flex; flex-direction: column; gap: 4px; }
.ac-sp-key-name { display: inline-flex; align-items: center; gap: 6px; font-size: 10px; color: var(--fg-faint); }
.ac-sp-key-name code { font-family: var(--font-mono); }
.ac-sp-card-langs { font-size: var(--fs-xs); color: var(--fg-faint); }
.ac-sp-card-foot {
  display: flex; align-items: center; gap: 8px;
  margin-top: auto; padding-top: 10px; border-top: 1px solid var(--border);
}
.ac-sp-card-note { font-size: var(--fs-xs); color: var(--st-amber); }
.ac-sp-card-note.ok { color: var(--fg-faint); }
.ac-sp-card-foot .ac-btn { margin-left: auto; height: 26px; }

/* ---- language pins + fallback chain ---- */
.ac-sp-pins { display: flex; flex-direction: column; gap: 8px; }
.ac-sp-pin {
  display: flex; align-items: center; gap: 9px;
  padding: 7px 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg-2);
}
.ac-sp-pin-code {
  min-width: 40px; padding: 2px 7px; border-radius: 5px; background: var(--bg-3);
  font-family: var(--font-mono); font-size: 11px; color: var(--fg-strong); text-align: center;
}
.ac-sp-pin-arrow { color: var(--fg-faint); display: inline-flex; }
.ac-sp-pin select { max-width: 210px; }
.ac-sp-pin .ac-icon-btn { margin-left: auto; }
.ac-sp-suggest { display: flex; flex-wrap: wrap; gap: 6px; }
.ac-sp-suggest .ac-chip { font-family: var(--font-mono); font-size: 10px; }
.ac-sp-fallback { padding-top: 14px; border-top: 1px solid var(--border); }
.ac-sp-chain { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 11px; }
.ac-sp-chain-n {
  display: inline-grid; place-items: center; width: 15px; height: 15px; margin-right: 6px;
  border-radius: 4px; background: var(--accent); color: var(--bg);
  font-size: 9px; font-weight: 600; font-variant-numeric: tabular-nums;
}

/* ---- test bench ---- */
.ac-sp-recorder { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.ac-sp-clip { font-family: var(--font-mono); font-size: var(--fs-xs); color: var(--fg-faint); }
.ac-sp-audio { height: 32px; max-width: 260px; }
.ac-sp .ac-sp-audio[hidden] { display: none; }
.ac-sp textarea.ac-input { resize: vertical; min-height: 68px; line-height: 1.55; }
.ac-sp-transcript {
  display: flex; flex-direction: column; gap: 10px;
  padding: 13px 14px; border: 1px solid var(--border); border-radius: 9px; background: var(--bg-2);
}
.ac-sp-transcript-text { font-size: 14px; color: var(--fg-strong); line-height: 1.6; overflow-wrap: anywhere; }
.ac-sp-result {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px 16px;
  font-size: var(--fs-xs); color: var(--fg-faint);
}
.ac-sp-result > span { display: inline-flex; align-items: center; gap: 6px; }
.ac-sp-result strong { color: var(--fg); font-weight: 500; font-variant-numeric: tabular-nums; }
.ac-sp-result .ac-btn { height: 24px; }

.ac-sp-skel { display: flex; flex-direction: column; gap: 10px; padding: 18px 20px; }

@media (max-width: 1080px) {
  .ac-sp { padding: 28px; }
  .ac-sp-heading { flex-direction: column; align-items: flex-start; gap: 14px; }
  .ac-sp-live { margin-left: 0; }
}
@media (max-width: 720px) {
  .ac-sp { padding: 22px 16px 34px; gap: 18px; }
  .ac-sp-heading h1 { font-size: 26px; }
  .ac-sp-tabs { gap: 20px; overflow-x: auto; }
  .ac-sp-grid { grid-template-columns: 1fr; padding: 14px 16px 18px; }
  .ac-sp-body { padding: 16px; }
  .ac-sp-pin { flex-wrap: wrap; }
  .ac-sp-audio { max-width: 100%; width: 100%; }
}

/* ---- voice in the Playground (chat.jsx) ---- */
.ac-chat-bar .ac-chip { display: inline-flex; align-items: center; gap: 6px; }
.ac-chat-voice-tag {
  display: inline-flex; align-items: center; gap: 4px;
  color: var(--accent); font-size: 10px; text-transform: uppercase; letter-spacing: .07em;
}
.ac-chat-voice-meta {
  display: flex; flex-wrap: wrap; align-items: center; gap: 5px 9px;
  margin-top: 8px; font-size: var(--fs-xs); color: var(--fg-faint);
}
.ac-chat-voice-meta b { color: var(--fg); font-weight: 500; }
.ac-chat-voice-warn { color: var(--st-amber); }
.ac-chat-audio { height: 28px; max-width: 220px; }
.ac-chat-heard {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px;
  margin: 0 14px; padding: 9px 12px;
  border: 1px solid var(--accent-line); border-radius: 9px; background: var(--accent-soft);
  font-size: var(--fs-xs); color: var(--fg-dim);
}
.ac-chat-heard b { color: var(--fg-strong); font-weight: 600; }
.ac-chat-heard > span:first-of-type { flex: 1; min-width: 200px; line-height: 1.5; }
.ac-chat-heard .ac-chip { flex: none; }
.ac-chat-input > .ac-icon-btn { flex: none; align-self: flex-end; height: 34px; width: 34px; }
.ac-badge.warn { background: rgba(245,165,36,.14); color: var(--st-amber); }
.ac-chat-bar .ac-chip, .ac-chat-bar .ac-btn { white-space: nowrap; flex: none; }
