/* AI Agents: the list of agents, one agent's page with its tabs, an automation, the proposed changes and the questions
   to try. Every class of these pages starts with ag-. The setup wizard's level picker and scopes stay at the end. */

/* ---------- A page head icon in the tone of what the page is about ---------- */
.phead-ic.ag-ic-ok { --rtc: var(--ok); }
.phead-ic.ag-ic-warn { --rtc: var(--warn); }
.phead-ic.ag-ic-teal { --rtc: var(--accent-teal); }

/* ---------- The list of AI agents ---------- */
.ag-list { --rl-cols: 128px minmax(0, 1fr) 204px 104px 120px 40px; --rl-cols-md: 120px minmax(0, 1fr) 204px 40px; }
.ag-saved { --rl-cols: 128px minmax(0, 1fr) 170px 110px 168px; --rl-cols-md: 120px minmax(0, 1fr) 168px; }
.ag-install .zone-head > .brandmark { flex: none; align-self: center; }

/* ---------- The sheets an agent works with: one soft card per sheet, opening it in its own system ---------- */
.ag-sheets { display: grid; gap: 10px; padding-top: 16px; padding-bottom: 6px; }
.ag-sheets .rl-row.ag-sheet {
  grid-template-columns: 46px minmax(0, 1fr) auto; gap: 16px; min-height: 76px; padding: 14px 14px 14px 16px;
  border: 1px solid var(--line); border-radius: 14px; background: var(--panel); box-shadow: var(--sh-xs);
  transition: border-color .18s ease, background .18s ease, box-shadow .18s ease, transform .18s ease;
}
.ag-sheets .rl-row.ag-sheet:is(:hover, :focus-within) {
  border-color: var(--brand-line); background: color-mix(in srgb, var(--brand-text) 3%, var(--panel));
  box-shadow: 0 14px 30px -22px var(--shade-hover); transform: translateY(-1px);
}
.ag-sheet-ic {
  display: grid; place-items: center; width: 46px; height: 46px; border-radius: 12px; color: var(--ok);
  background: linear-gradient(145deg, color-mix(in srgb, var(--ok) 26%, var(--panel)), color-mix(in srgb, var(--ok) 9%, var(--panel)));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--ok) 30%, transparent);
}
.ag-sheet-ic svg { width: 21px; height: 21px; }
.ag-sheet .rl-name b { font-size: var(--fs-m); }
.ag-sheet-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 8px; min-width: 0; font-size: var(--fs-xs); color: var(--ink-4); }
.ag-sheet-meta .sep { width: 3px; height: 3px; border-radius: var(--r-full); background: var(--line-strong); }
.ag-sheet .rl-do { gap: 10px; }
.ag-sheet-open {
  display: grid; place-items: center; width: 36px; height: 36px; border: 1px solid var(--btn-line); border-radius: var(--r-full);
  background: var(--panel-2); color: var(--ink-3); transition: background .18s ease, color .18s ease, border-color .18s ease;
}
.ag-sheet-open svg { width: 17px; height: 17px; }
.ag-sheet:is(:hover, :focus-within) .ag-sheet-open { border-color: var(--brand-line); background: var(--brand-soft); color: var(--brand-text); }
.ag-sheet-open:focus-visible { outline: none; box-shadow: var(--focus-ring); }
@media (prefers-reduced-motion: reduce) { .ag-sheets .rl-row.ag-sheet:is(:hover, :focus-within) { transform: none; } }
@container page (max-width: 760px) {
  .ag-sheets .rl-row.ag-sheet { grid-template-columns: 40px minmax(0, 1fr) auto; gap: 12px; padding: 12px; }
  .ag-sheet-ic { width: 40px; height: 40px; border-radius: 11px; }
}

/* ---------- One agent: overview ---------- */
.ag-changes { --rl-cols: minmax(0, 1fr) 176px 168px; }
.ag-ovrules { --rl-cols: minmax(0, 1fr) 176px; }
.ag-connected { --rl-cols: 128px minmax(0, 1fr) 150px 176px; --rl-btn: 176px; }
/* Side by side lists end on the same line: the foot sits at the bottom of the taller half. */
.ag-half { display: flex; flex-direction: column; }
.ag-half > .rl-foot { margin-top: auto; }
.ag-changes .rl-name b, .ag-did .rl-name b { font-size: var(--fs-s); font-weight: 500; }
.ag-assistant {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; flex: none; width: 110px; height: 26px;
  border-radius: 7px; background: var(--paper); box-shadow: inset 0 0 0 1px var(--line); color: var(--paper-ink); font-size: 11.5px; font-weight: 600;
}
.ag-assistant img { width: 14px; height: 14px; border-radius: 4px; }

/* ---------- One agent: automations and settings ---------- */
.ag-rules { --rl-cols: minmax(0, 1fr) minmax(0, 1.3fr) 196px 168px 120px 96px; --rl-cols-md: minmax(0, 1fr) 196px 96px; }
.ag-sentence { min-width: 0; font-size: var(--fs-s); line-height: 1.45; color: var(--ink-3); overflow-wrap: anywhere; }
.ag-ideas { --rl-cols: minmax(0, 1fr) 96px; }
.ag-idea { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; min-width: 0; }
.ag-quote { min-width: 0; margin: 0; font-size: var(--fs-m); line-height: 1.5; color: var(--ink); overflow-wrap: anywhere; text-wrap: pretty; }

/* ---------- Questions to try ---------- */
.ag-try { --rl-cols: minmax(0, 1fr) 196px 96px; --rl-cols-md: minmax(0, 1fr) 96px; }
.ag-try .rl-type { align-items: flex-start; }
.chatq { --rl-cols: minmax(0, 1fr) auto; --rl-cols-md: minmax(0, 1fr) auto; }
.chatq .rl-row { align-items: center; }
.chatq .chatq-switch { margin: 0 0 6px; }

/* ---------- Waiting agents picked in the list and switched on together ---------- */
.ag-list.has-switch { --rl-cols: 152px minmax(0, 1fr) 204px 104px 120px 196px; --rl-cols-md: 144px minmax(0, 1fr) 204px 196px; }
.rl-pick { flex: none; margin-right: 8px; }
.rl-row:has(.rl-pick input:not(:checked)) .brandmark { opacity: .55; }

/* ---------- An automation ---------- */
.fig-big.ag-fig-word { font-family: var(--sans); font-size: 24px; letter-spacing: var(--tr-tight); }
.ag-rule-sentence { margin: 0; font-size: var(--fs-m); color: var(--ink); }
.ag-examples { --rl-cols: minmax(0, 1fr); }
.ag-did { --rl-cols: minmax(0, 1fr) 176px 168px; }

/* ---------- Proposed changes ---------- */
.ag-fields { table-layout: fixed; }
.ag-fields th:first-child { width: 26%; }
.ag-fields td { overflow-wrap: anywhere; }

/* An automation's rule as rows, on its page and in the Approve confirm: what starts it, then each step, with the icon of
   what it adds in the colour of the record type it works on (plain for a condition or a step on no record). */
.rule-rows { border: 1px solid var(--line); border-radius: var(--r-l); background: var(--panel-2); }
.rule-row { display: flex; gap: 14px; padding: 12px 16px; }
.rule-row + .rule-row { border-top: 1px solid var(--line); }
.zone .rule-row { padding-left: var(--zl, var(--pad-x)); padding-right: var(--zr, var(--pad-x)); }
.popup .rule-rows { margin-top: 0; }
.rule-k { flex: none; width: 44px; padding-top: 5px; font-size: var(--fs-2xs); font-weight: 600; letter-spacing: var(--tr-caps); text-transform: uppercase; color: var(--ink-4); }
.rule-list { display: grid; flex: 1; gap: 8px; min-width: 0; margin: 0; padding: 0; list-style: none; }
.rule-list li { display: flex; align-items: flex-start; gap: 10px; font-size: var(--fs-m); font-weight: 500; line-height: 1.45; color: var(--ink); }
.rule-list li > span:last-child { min-width: 0; padding-top: 2px; overflow-wrap: anywhere; }
.rule-ic {
  display: inline-grid; place-items: center; flex: none; width: 24px; height: 24px; border-radius: var(--r-s);
  color: var(--rtc, var(--ink-3)); background: color-mix(in srgb, var(--rtc, var(--ink-3)) 12%, transparent);
}
.rule-ic svg { width: 14px; height: 14px; }

/* How far an agent may go with a record type, as filled bars. */
.tile-level { display: inline-flex; gap: 3px; flex: none; }
.tile-level i { width: 18px; height: 6px; border-radius: 2px; background: var(--panel-3); }
.tile-level i.on { background: var(--rtc, var(--brand)); }

@container page (max-width: 640px) {
  .ag-install .zone-head { flex-wrap: wrap; }
  .ag-install .zone-head > .right { flex-basis: 100%; margin-left: 0; }
  .ag-try .rl-type { align-items: center; }
}
