/* The Agents page (site/agents.html), inside the app shell (/app.css). Rows follow the kit api-keys table and teammates list.
   Green = on, amber = a ticked agent that needs a key. No inline style. */
.ag { max-width: 760px; }
.ag [hidden] { display: none !important; }

/* signed out */
.ag-sign { max-width: 480px; padding: 24px; display: grid; gap: 18px; justify-items: start; }
.ag-sign form { max-width: 440px; }
.ag-sign h2 { margin: 0; font: 600 15px var(--sans); letter-spacing: -0.01em; }
.ag-sign form { display: grid; gap: 8px; width: 100%; padding-top: 12px; }
.ag-alt { width: 100%; padding-top: 14px; border-top: 1px solid var(--line); }
.ag-alt summary { list-style: none; cursor: pointer; font-size: 13px; color: var(--muted); }
.ag-alt summary::-webkit-details-marker { display: none; }
.ag-alt summary:hover, .ag-alt summary:focus-visible, .ag-alt[open] summary { color: var(--text); }
.ag-sign label { font-size: 13px; color: var(--muted); }
.ag-sign small { font-size: 12px; color: var(--faint); }
.ag-inrow { display: flex; gap: 8px; }
.ag-inrow .b-input { flex: 1; min-width: 0; min-height: 36px; font-size: 13.5px; }

/* the list */
.ag-list { max-width: 760px; list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); border-bottom: 0; border-radius: 12px 12px 0 0; background: var(--card); overflow: hidden; }
.ag-row + .ag-row, .ag-empty + .ag-row { border-top: 1px solid var(--line); }
.ag-empty { padding: 22px 18px; color: var(--muted); font-size: 13.5px; }
.ag-head { display: flex; align-items: center; gap: 14px; padding: 14px 18px; cursor: pointer; transition: background .12s; }
.ag-head:hover { background: rgba(255,255,255,.02); }
.ag-txt { flex: 1; min-width: 0; display: grid; grid-template-columns: 1fr auto; column-gap: 16px; align-items: center; }
.ag-txt b { grid-column: 1; font-weight: 500; font-size: 14px; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ag-sub { grid-column: 1; font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ag-faint, .ag-dotsep { color: var(--faint); }
.ag-short { display: none; }
.ag-need { grid-column: 2; grid-row: 1 / span 2; display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--faint); white-space: nowrap; }
.ag-need.ok { color: var(--muted); }
.ag-need.warn { color: var(--amber); }
.ag-need .ax-i { width: 13px; height: 13px; }

/* switch: a checkbox */
.ag-sw { appearance: none; -webkit-appearance: none; flex: none; position: relative; width: 34px; height: 20px; margin: 0; border-radius: 10px;
  background: var(--raised); border: 1px solid var(--line3); cursor: pointer; transition: background .15s, border-color .15s; }
.ag-sw::after { content: ""; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: var(--muted);
  transition: transform .15s, background .15s; }
.ag-sw:checked { background: var(--green); border-color: var(--green); }
.ag-sw:checked::after { transform: translateX(14px); background: #070908; }
.ag-sw:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; }

/* a ticked agent: its key and sign-in */
.ag-more { padding: 0 18px 16px 18px; display: grid; gap: 12px; }
.ag-more dl { margin: 0; display: grid; grid-template-columns: 64px 1fr; gap: 4px 12px; font-size: 12.5px; }
.ag-more dt { color: var(--faint); }
.ag-more dd { margin: 0; color: var(--muted); min-width: 0; overflow-wrap: anywhere; }
.ag-more dd.ax-mono { font-size: 12px; color: var(--text); }
.ag-key { display: flex; gap: 8px; }
.ag-key .b-input { min-height: 34px; font-size: 13px; border-radius: 8px; }
.ag-key input { flex: 1; min-width: 0; }
.ag-key select { width: auto; flex: none; padding-right: 8px; }
.ag-key .ax-btn { height: 34px; }
.ag-key input::placeholder { font-family: var(--sans); letter-spacing: 0; color: var(--faint); }
.ag-rep { justify-self: start; }

/* count + save */
.ag-bar { max-width: 760px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 12px 12px 18px; position: sticky; bottom: 0; z-index: 5;
  border: 1px solid var(--line); border-radius: 0 0 12px 12px; background: var(--card); }
.ag-bar-t { display: flex; align-items: center; gap: 6px 14px; flex-wrap: wrap; min-width: 0; font-size: 12.5px; }
#p-count { color: var(--muted); }
#p-count.dirty { color: var(--text); }
.ag-note { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); }
.ag-note .ax-i { color: var(--green); width: 13px; height: 13px; }
.ag-err { color: var(--amber); display: inline-flex; align-items: center; gap: 7px; }
.ag-err .ax-dot { flex: none; }
.ag-sign .ag-err { margin: 0; font-size: 13px; }
.ag-sign .ag-inrow input::placeholder { font-family: var(--sans); letter-spacing: 0; color: var(--faint); }
/* the sign-in card is the one sign-in call on this page: the sidebar's own Sign in button steps aside while it shows */
body:has(#s-key:not([hidden])) .ax-foot > .ax-btn { display: none; }
.ax-banner + .ag-sign, .ax-banner + #s-list { margin-top: 16px; }

/* how agents sign in */
.ag-how { margin-top: 20px; font-size: 13px; color: var(--muted); }
.ag-how summary { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; color: var(--muted); list-style: none; padding: 4px 0; }
.ag-how summary::-webkit-details-marker { display: none; }
.ag-how summary::before { content: ""; width: 6px; height: 6px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor;
  transform: rotate(-45deg); transition: transform .15s; margin: 0 2px; }
.ag-how[open] summary::before { transform: rotate(45deg); }
.ag-how summary:hover { color: var(--text); }
.ag-how summary:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; border-radius: 4px; }
.ag-how ul { margin: 10px 0 0; padding: 0 0 0 20px; display: grid; gap: 6px; list-style: none; }
.ag-how b { color: var(--text); font-weight: 500; }

@media (max-width: 860px) {
  .ag-head { padding: 13px 14px; gap: 12px; align-items: flex-start; }
  .ag-sw { margin-top: 6px; }
  .ag-txt { grid-template-columns: 1fr; }
  .ag-sub .ag-dotsep { display: none; }
  .ag-sub .ag-faint { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .ag-more dd .ag-long { display: none; }
  .ag-more dd .ag-short { display: inline; }
  .ag-bar-t { flex-wrap: nowrap; }
  .ag-bar.said #p-count, .ag-bar.bad #p-count { display: none; }
  .ag-err { min-width: 0; white-space: nowrap; }
  .ag-note { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }
  .ag-note .ax-i { vertical-align: -2px; margin-right: 6px; }
  .ag-need { grid-column: 1; grid-row: auto; margin-top: 3px; font-size: 12px; }
  .ag-more { padding: 0 14px 14px; }
  .ag-key { flex-wrap: wrap; }
  .ag-key select { flex: 1 1 100%; }
  .ag-bar { margin: 0 -16px; padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); border-radius: 0; border-left: 0; border-right: 0;
    border-top: 1px solid var(--line2); background: var(--bg); }
  .ag-bar .ax-btn { height: 40px; padding: 0 18px; }
  .ag-list { border-radius: 12px 12px 0 0; border-bottom: 0; }
  .ag-sign { padding: 20px; }
  /* a toast (a failed Save says why) sits above the sticky Save bar, not over it */
  body:has(#s-list:not([hidden])) .ax-toasts { bottom: calc(80px + env(safe-area-inset-bottom)); }
}
@media (prefers-reduced-motion: reduce) { .ag-sw, .ag-sw::after, .ag-how summary::before { transition: none; } }
.ag-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
