/* Nasjicad — agent.css
   The AI agent panel (#agent-panel, src/js/agent-panel.js): section 14 of app.css, a file of its own so that Nasji Cube
   (nasjicube/, hosted beside Nasjicad) draws the same panel from the same rules. Loaded after app.css: no rule of
   app.css after this block touched the panel, so the cascade is what it was. */


/* ----------------------------------------------------------------
   14. AI agent panel (#agent-panel) — right dock. Owner: PANEL.
   A drafting instrument: one accent, quiet paper, motion only where
   it means something. The pipeline never appears. draw_cad is the
   only tool the architect is allowed to see.
   ---------------------------------------------------------------- */
#agent-panel {
  position: relative;
  flex: 0 0 420px;
  width: 420px;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background:
    radial-gradient(1200px 420px at 100% -40px, rgba(79, 179, 234, .09), transparent 58%),
    linear-gradient(180deg, #1c2026 0%, #161a1f 48%, #13171c 100%);
  border-left: 1px solid rgba(255, 255, 255, .06);
  box-shadow: inset 1px 0 0 rgba(255, 255, 255, .03);
  font-size: 13px;
  line-height: 1.55;
  color: var(--text);
  letter-spacing: .01em;
}

/* ---- header: the brand orb + icon-only ghosts ---- */
.ag-head {
  flex: none;
  display: flex;
  align-items: center;
  gap: 2px;
  height: 48px;
  padding: 0 10px 0 16px;
  border-bottom: 1px solid rgba(255, 255, 255, .05);
  background: linear-gradient(180deg, rgba(255, 255, 255, .025), transparent);
}
.ag-brand {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.ag-brand-name {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .18px;
  color: var(--text-bright);
}
/* the orb is the agent's pulse: still when listening, breathing while it
   works — the only status lamp the panel needs */
.ag-orb {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 32%, #b8e2ff, #3fa9e0 58%, #1c6ba0);
  box-shadow: 0 0 6px rgba(63, 169, 224, .55);
}
.ag-orb.busy { animation: ag-orb 1.15s ease-in-out infinite; }
@keyframes ag-orb {
  0%, 100% { transform: scale(1); box-shadow: 0 0 5px rgba(63, 169, 224, .5); }
  50% { transform: scale(1.28); box-shadow: 0 0 14px rgba(63, 169, 224, .95); }
}
.ag-head-sp { flex: 1 1 auto; }
.ag-ghost {
  flex: none;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  color: var(--text-dim);
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}
.ag-ghost svg { width: 15px; height: 15px; }
.ag-ghost:hover { background: rgba(255, 255, 255, .06); color: var(--text-bright); }
.ag-ghost:active { background: rgba(255, 255, 255, .1); }
.ag-ghost.ag-sm { width: 24px; height: 24px; }
.ag-ghost.ag-sm svg { width: 14px; height: 14px; }

/* ---- thread ---- */
.ag-thread {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 18px 18px 14px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  overscroll-behavior: contain;
  scroll-behavior: auto;
}
.ag-thread > * { flex-shrink: 0; max-width: 100%; animation: ag-rise 200ms var(--ease); }
@keyframes ag-rise {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: none; }
}

/* ---- the empty room: a hero and four things worth clicking ---- */
.ag-empty {
  margin: auto 0;
  text-align: center;
  color: var(--text-dim);
  padding: 0 8px;
  animation: ag-rise 320ms var(--ease);
}
.ag-empty p { margin: 0; }
.ag-hero-ico {
  display: flex;
  justify-content: center;
  margin-bottom: 14px;
}
.ag-hero-ico img {
  width: 56px;
  height: 56px;
  object-fit: contain;
  border-radius: 12px;
}
.ag-empty-title {
  font-size: 17px;
  font-weight: 600;
  color: var(--text-bright);
  letter-spacing: -.2px;
}
.ag-empty-sub {
  margin-top: 8px !important;
  font-size: 12.5px;
  line-height: 1.65;
  opacity: .78;
}
.ag-empty-sub strong {
  color: var(--accent-bright);
  font-weight: 600;
}
.ag-presets {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 22px;
  text-align: left;
}
.ag-preset {
  padding: 11px 12px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, .07);
  background: rgba(255, 255, 255, .03);
  color: var(--text);
  font-size: 12px;
  text-align: left;
  transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease),
    color var(--dur) var(--ease), transform var(--dur) var(--ease),
    box-shadow var(--dur) var(--ease);
}
.ag-preset:hover {
  border-color: rgba(63, 169, 224, .5);
  background: rgba(63, 169, 224, .09);
  color: var(--text-bright);
  transform: translateY(-1px);
}
.ag-preset:active { transform: none; }

/* ---- messages ---- */
.ag-user {
  align-self: flex-end;
  max-width: 88%;
  padding: 9px 13px;
  border-radius: 16px 16px 5px 16px;
  background: linear-gradient(180deg, rgba(79, 179, 234, .2), rgba(63, 169, 224, .1));
  border: 1px solid rgba(79, 179, 234, .2);
  color: var(--text-bright);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  box-shadow: 0 6px 16px rgba(0, 0, 0, .12);
}
.ag-answer {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  color: var(--text);
}
.ag-error {
  padding: 8px 10px;
  border-radius: var(--radius-lg);
  background: rgba(224, 76, 76, .1);
  border: 1px solid rgba(224, 76, 76, .18);
  color: #f0a0a0;
  font-family: var(--font-mono);
  font-size: 11.5px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* ---- the first-run doorstep: bring your own key ---- */
.ag-setup {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid rgba(63, 169, 224, .3);
  background: linear-gradient(135deg, rgba(63, 169, 224, .13), rgba(63, 169, 224, .04));
}
.ag-setup-ico { flex: none; display: flex; color: var(--accent-bright); }
.ag-setup-txt { flex: 1 1 auto; min-width: 0; font-size: 12px; line-height: 1.55; }
.ag-setup-txt strong { color: var(--text-bright); }
.ag-setup-btn {
  flex: none;
  padding: 6px 13px;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-size: 12px;
  transition: background var(--dur) var(--ease);
}
.ag-setup-btn:hover { background: var(--accent-bright); }
/* the device sign-in code, read off the card into the browser */
.ag-signin-code {
  font-family: var(--font-mono);
  font-size: 15px;
  letter-spacing: .12em;
  color: var(--text-bright);
  user-select: text;
}

/* ---- thinking: dim, monospace, collapsible, self-summarising ---- */
.ag-think { margin: -2px 0; }
.ag-think-head {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 2px 0;
  color: var(--text-dim);
  font-size: 12px;
}
.ag-think-head:hover { color: var(--text); }
.ag-think-chev {
  display: flex;
  color: inherit;
  transition: transform 140ms var(--ease);
}
.ag-think-chev svg { width: 12px; height: 12px; }
.ag-think.open .ag-think-chev { transform: rotate(90deg); }
.ag-think:not(.done) .ag-think-label { animation: ag-pulse 1.6s ease-in-out infinite; }
@keyframes ag-pulse { 0%, 100% { opacity: .55; } 50% { opacity: 1; } }

.ag-think-body { display: none; }
.ag-think.open .ag-think-body {
  display: block;
  margin: 5px 0 0 5px;
  padding-left: 11px;
  border-left: 1px solid var(--border-soft);
  max-height: 260px;
  overflow-y: auto;
  overscroll-behavior: contain;
  font-family: var(--font-mono);
  font-size: 11.5px;
  line-height: 1.6;
  color: var(--text-dim);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* ---- the one tool card. Its exhibits are the brief and the finished
   strokes drawn small — never a stage of the pipeline. ---- */
.ag-tool {
  border-radius: 14px;
  background: rgba(255, 255, 255, .032);
  border: 1px solid rgba(255, 255, 255, .07);
  overflow: hidden;
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.ag-tool.running {
  border-color: rgba(79, 179, 234, .42);
  box-shadow: 0 0 0 1px rgba(79, 179, 234, .08), 0 10px 28px rgba(20, 40, 56, .25);
}
.ag-tool.failed { border-color: rgba(224, 76, 76, .35); }
.ag-tool.done { border-color: rgba(95, 191, 95, .22); }
.ag-tool-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  cursor: default;
  transition: background var(--dur) var(--ease);
}
.ag-tool-head:hover { background: rgba(255, 255, 255, .03); }
.ag-tool-ico {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  color: var(--accent-bright);
}
.ag-tool-ico svg { width: 13px; height: 13px; }
.ag-tool.done .ag-tool-ico { color: #5fbf5f; }
.ag-tool.failed .ag-tool-ico { color: var(--danger); }
.ag-spin {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  border: 1.5px solid var(--accent-soft);
  border-top-color: var(--accent-bright);
  animation: ag-spin 700ms linear infinite;
}
@keyframes ag-spin { to { transform: rotate(360deg); } }
.ag-tool-name {
  flex: none;
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-bright);
}
.ag-tool-sum {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 11.5px;
  color: var(--text-dim);
}
/* the way back to a drawing: every finished row carries a target that
   takes the view to what it drew, however far the drawing has moved on */
.ag-show {
  flex: none;
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px 2px 6px;
  border-radius: 999px;
  border: 1px solid rgba(143, 214, 255, .22);
  background: rgba(143, 214, 255, .08);
  color: var(--text);
  font-family: inherit;
  font-size: 11px;
  line-height: 1.5;
  cursor: pointer;
  transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.ag-show:hover { background: rgba(143, 214, 255, .16); border-color: rgba(143, 214, 255, .42); }
.ag-show svg { width: 12px; height: 12px; }

/* one quiet line under the head, said only when the view actually moved */
.ag-tool-note {
  padding: 0 10px 8px 32px;
  font-size: 11px;
  color: var(--text-dim);
}

.ag-tool-chev {
  flex: none;
  display: flex;
  color: var(--text-dim);
  transition: transform 140ms var(--ease);
}
.ag-tool-chev svg { width: 12px; height: 12px; }
.ag-tool.open .ag-tool-chev { transform: rotate(90deg); }

/* the moving light under the head while the tool works */
.ag-tool-track { display: none; height: 2px; overflow: hidden; }
.ag-tool.running .ag-tool-track { display: block; }
.ag-tool-track i {
  display: block;
  height: 100%;
  width: 45%;
  border-radius: 2px;
  background: linear-gradient(90deg, transparent, var(--accent-bright), transparent);
  animation: ag-slide 1.3s ease-in-out infinite;
}
@keyframes ag-slide {
  from { transform: translateX(-100%); }
  to { transform: translateX(320%); }
}

.ag-tool-body { display: none; }
.ag-tool.open .ag-tool-body {
  display: block;
  padding: 2px 12px 12px 32px;
  animation: ag-in 140ms var(--ease);
}
@keyframes ag-in { from { opacity: 0; } to { opacity: 1; } }

.ag-brief {
  color: var(--text);
  font-size: 12px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.ag-kvhead {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--text-dim);
  opacity: .65;
  margin: 8px 0 3px;
}
.ag-err {
  margin-top: 8px;
  padding: 6px 8px;
  border-radius: var(--radius);
  background: rgba(224, 76, 76, .1);
  color: #f0a0a0;
  font-family: var(--font-mono);
  font-size: 11.5px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* the finished strokes on the panel's own paper — a viewport you can
   scroll, not a clipped thumbnail trapped under the brief */
.ag-pv-wrap {
  margin-top: 8px;
  max-height: min(340px, 46vh);
  overflow: auto;
  overscroll-behavior: contain;
  border-radius: 8px;
  border: 1px solid rgba(143, 214, 255, .14);
  background:
    repeating-linear-gradient(0deg, rgba(143, 214, 255, .045) 0 1px, transparent 1px 20px),
    repeating-linear-gradient(90deg, rgba(143, 214, 255, .045) 0 1px, transparent 1px 20px),
    #0c1218;
}
.ag-pv {
  display: block;
  width: 100%;
  height: auto;
}
.ag-tool-stats { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.ag-stat {
  padding: 2px 9px;
  border-radius: 999px;
  border: 1px solid rgba(143, 214, 255, .16);
  background: rgba(143, 214, 255, .07);
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text);
}
.ag-stat-warn {
  border-color: rgba(232, 163, 61, .35);
  background: rgba(232, 163, 61, .1);
  color: #e8c27d;
}

/* ---- menus (history, overflow, mode) ---- */
.ag-menu {
  position: fixed;
  z-index: 420;
  min-width: 168px;
  max-width: 260px;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg-card);
  box-shadow: var(--shadow-2);
  animation: ag-in 120ms var(--ease);
  overflow-y: auto;
  overscroll-behavior: contain;
}
.ag-menu-item {
  display: block;
  width: 100%;
  padding: 5px 8px;
  border-radius: var(--radius);
  text-align: left;
  font-size: 12px;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ag-menu-item:hover:not(:disabled) { background: var(--hover); color: var(--text-bright); }
.ag-menu-item:disabled { color: var(--text-dim); }
.ag-menu-item.on { color: var(--accent-bright); }

/* ---- composer: the centre of gravity ---- */
.ag-composer {
  flex: none;
  padding: 8px 14px 16px;
  background: linear-gradient(180deg, transparent, rgba(0, 0, 0, .18));
}
.ag-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.ag-chips.ag-chips-empty { display: none; }
.ag-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  padding: 3px 4px 3px 8px;
  border-radius: 999px;
  background: var(--accent-soft);
  font-size: 11.5px;
  color: var(--text);
}
.ag-chip svg { width: 13px; height: 13px; flex: none; color: var(--accent-bright); }
.ag-chip > span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ag-chip-x {
  flex: none;
  width: 16px;
  height: 16px;
  border-radius: 999px;
  color: var(--text-dim);
  font-size: 13px;
  line-height: 1;
}
.ag-chip-x:hover { background: var(--hover); color: var(--text-bright); }

.ag-box {
  display: flex;
  flex-direction: column;
  padding: 12px 10px 8px 14px;
  background: rgba(12, 15, 19, .72);
  border: 1px solid rgba(255, 255, 255, .08);
  border-radius: 16px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .04);
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.ag-box:focus-within {
  border-color: rgba(79, 179, 234, .55);
  box-shadow: 0 0 0 4px rgba(63, 169, 224, .12), inset 0 1px 0 rgba(255, 255, 255, .05);
}
#ag-input {
  min-height: 52px;
  max-height: 160px;
  padding: 0 4px 0 0;
  border: 0;
  outline: none;
  resize: none;
  overflow-y: auto;
  background: transparent;
  color: var(--text-bright);
  font-family: var(--font-ui);
  font-size: 13px;
  line-height: 20px;
}
#ag-input::placeholder { color: var(--text-dim); }

.ag-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
}
.ag-bar-sp { flex: 1 1 auto; }
.ag-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 6px 2px 5px;
  border-radius: 999px;
  border: 1px solid var(--border-soft);
  color: var(--text-dim);
  font-size: 11.5px;
  transition: color var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.ag-pill:hover { color: var(--text); border-color: var(--border); }
.ag-pill svg { flex: none; }
.ag-model {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
  padding: 2px 4px;
  border-radius: 6px;
  color: var(--text-dim);
  font-size: 11.5px;
  transition: color var(--dur) var(--ease), background var(--dur) var(--ease);
}
.ag-model:hover { color: var(--text); background: rgba(255, 255, 255, .05); }
.ag-model svg { flex: none; opacity: .8; }
.ag-model-ico { display: inline-flex; flex: none; }
/* the balance, on the site only: green while there is some, red when out */
.ag-credit { flex: none; color: #8fd68f; }
.ag-credit.low { color: #f0a0a0; }
/* the price of a turn, said once at the foot of the answer */
.ag-cost {
  font-size: 10.5px;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
  margin-top: -4px;
}
.ag-model span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ag-send {
  flex: none;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: rgba(255, 255, 255, .08);
  color: var(--text);
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease),
    transform var(--dur) var(--ease);
}
.ag-send svg { width: 15px; height: 15px; }
.ag-box:focus-within .ag-send { background: var(--accent); color: #fff; }
.ag-send:hover { background: var(--accent-bright); color: #fff; transform: scale(1.06); }
.ag-send:active { transform: scale(.96); }
.ag-send.stop,
.ag-box:focus-within .ag-send.stop { background: var(--danger); color: #fff; }
.ag-send.stop:hover { background: #ef6060; }

/* ---- AI Selection: the prompt that sits on the drawing ---- */
.ag-region {
  position: fixed;
  z-index: 260;
  width: 320px;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  border-radius: 10px;
  background: var(--panel, #1b2027);
  border: 1px solid var(--accent-bright, #3fa9e0);
  box-shadow: 0 10px 28px rgba(0, 0, 0, .55);
}
.ag-region-row { display: flex; align-items: center; gap: 6px; }
.ag-region input {
  flex: 1 1 auto;
  min-width: 0;
  padding: 6px 8px;
  border-radius: 6px;
  border: 1px solid var(--line, #333b45);
  background: var(--bg, #12161b);
  color: var(--text, #dfe3e7);
  font: inherit;
}
.ag-region input:focus { outline: none; border-color: var(--accent-bright, #3fa9e0); }
.ag-region-go, .ag-region-x {
  flex: none;
  width: 26px; height: 26px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 6px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text, #dfe3e7);
  cursor: pointer;
}
.ag-region-go { background: var(--accent, #2b7fb8); color: #fff; }
.ag-region-go:hover { background: var(--accent-bright, #3fa9e0); }
.ag-region-x:hover { background: var(--line, #333b45); }
.ag-region-acts { gap: 6px; }
.ag-region-btn {
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid var(--line, #333b45);
  background: transparent;
  color: var(--text, #dfe3e7);
  font-size: 12px;
  cursor: pointer;
}
.ag-region-btn:hover { border-color: var(--accent-bright, #3fa9e0); }
.ag-region-note { margin-left: auto; font-size: 11px; opacity: .6; }

/* the brief scrolls instead of clipping; the drafting stream sticks to its tail */
.ag-brief { max-height: 200px; overflow-y: auto; }
.ag-drafting { border-left: 2px solid var(--accent-bright, #3fa9e0); padding-left: 6px; }

/* ---- BYOK: the agent settings slide-over ---- */
.ag-keys {
  position: absolute;
  inset: 0;
  z-index: 6;
  display: flex;
  flex-direction: column;
  background: var(--bg-palette);
  animation: ag-keys-in 200ms var(--ease);
}
.ag-keys.hidden { display: none; }
@keyframes ag-keys-in {
  from { opacity: 0; transform: translateX(26px); }
  to { opacity: 1; transform: none; }
}
.ag-keys-head {
  flex: none;
  display: flex;
  align-items: center;
  gap: 6px;
  height: 44px;
  padding: 0 10px;
  border-bottom: 1px solid var(--border-soft);
}
.ag-keys-title { font-size: 12.5px; font-weight: 600; color: var(--text-bright); }
.ag-keys-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 16px 16px 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.ag-keys-hero {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid rgba(63, 169, 224, .2);
  background: rgba(63, 169, 224, .07);
  color: var(--accent-bright);
}
.ag-keys-hero svg { flex: none; margin-top: 1px; }
.ag-keys-hero > div { flex: 1 1 auto; min-width: 0; }
.ag-keys-hero p { margin: 0; font-size: 12px; line-height: 1.6; color: var(--text); }
.ag-keys-hero p strong { color: var(--text-bright); font-weight: 600; }
.ag-keys-hero .ag-setup-btn { margin-top: 10px; }
/* the account line: who is signed in, and the way out */
.ag-keys-who {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  color: var(--text-dim);
}
.ag-keys-who svg { flex: none; color: var(--accent-bright); }
.ag-keys-mail {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-bright);
}
/* the one choice: the NASJI model on the balance, or a key of your own */
.ag-choice { display: flex; flex-direction: column; gap: 8px; }
.ag-choice-btn {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  padding: 10px 12px;
  text-align: left;
  border-radius: 12px;
  border: 1px solid var(--border-soft);
  background: rgba(255, 255, 255, .03);
  color: var(--text);
  transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease);
}
.ag-choice-btn:hover { border-color: rgba(63, 169, 224, .45); background: rgba(63, 169, 224, .06); }
.ag-choice-btn.on { border-color: rgba(63, 169, 224, .6); background: rgba(63, 169, 224, .1); }
.ag-choice-ico {
  flex: none;
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 9px;
  background: rgba(255, 255, 255, .05);
  color: var(--accent-bright);
}
.ag-choice-ico img { width: 24px; height: 24px; object-fit: contain; border-radius: 6px; }
.ag-choice-txt { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.ag-choice-txt strong { font-size: 12.5px; font-weight: 600; color: var(--text-bright); }
.ag-choice-txt small {
  font-size: 11px;
  color: var(--text-dim);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ag-choice-dot {
  flex: none;
  position: relative;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 1.5px solid rgba(255, 255, 255, .28);
  transition: border-color var(--dur) var(--ease);
}
.ag-choice-btn.on .ag-choice-dot { border-color: var(--accent-bright); }
.ag-choice-btn.on .ag-choice-dot::after {
  content: '';
  position: absolute;
  inset: 3px;
  border-radius: 50%;
  background: var(--accent-bright);
}
.ag-field { display: flex; flex-direction: column; gap: 7px; }
.ag-field-top { display: flex; align-items: baseline; gap: 8px; }
.ag-field-name { font-size: 12.5px; font-weight: 600; color: var(--text-bright); }
.ag-field-vendor { font-size: 11px; color: var(--text-dim); }
.ag-key-row { display: flex; gap: 6px; }
.ag-key-row input {
  flex: 1 1 auto;
  min-width: 0;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--border-soft);
  background: var(--bg-input);
  color: var(--text-bright);
  font-family: var(--font-mono);
  font-size: 12px;
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.ag-key-row input:focus {
  outline: none;
  border-color: rgba(63, 169, 224, .55);
  box-shadow: 0 0 0 3px rgba(63, 169, 224, .12);
}
.ag-key-save {
  flex: none;
  padding: 0 14px;
  border-radius: 8px;
  border: 1px solid var(--border-soft);
  background: rgba(255, 255, 255, .06);
  color: var(--text);
  font-size: 12px;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease),
    border-color var(--dur) var(--ease);
}
.ag-key-save:hover { background: var(--accent); border-color: transparent; color: #fff; }
.ag-key-save:disabled { opacity: .55; }
.ag-field-status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--text-dim);
}
.ag-key-x, .ag-keys-signout {
  margin-left: auto;
  padding: 1px 6px;
  border-radius: 6px;
  color: var(--text-dim);
  font-size: 11px;
  transition: color var(--dur) var(--ease), background var(--dur) var(--ease);
}
.ag-key-x:hover, .ag-keys-signout:hover { color: #f0a0a0; background: rgba(224, 76, 76, .1); }
.ag-keys-signout { margin-left: 4px; }
.ag-keys-signin { align-self: flex-start; }
.ag-key-dot { flex: none; width: 7px; height: 7px; border-radius: 50%; }
.ag-key-dot.on { background: #5fbf5f; box-shadow: 0 0 5px rgba(95, 191, 95, .6); }
.ag-key-dot.off { background: rgba(255, 255, 255, .22); }
.ag-seg {
  display: flex;
  width: max-content;
  border: 1px solid var(--border-soft);
  border-radius: 9px;
  overflow: hidden;
}
.ag-seg-btn {
  padding: 6px 14px;
  font-size: 12px;
  color: var(--text-dim);
  background: transparent;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}
.ag-seg-btn + .ag-seg-btn { border-left: 1px solid var(--border-soft); }
.ag-seg-btn:hover { color: var(--text); }
.ag-seg-btn.on { background: rgba(63, 169, 224, .16); color: var(--text-bright); }
.ag-seg-wide { width: 100%; }
.ag-seg-wide .ag-seg-btn { flex: 1 1 0; text-align: center; padding: 6px 8px; }
.ag-model-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.ag-model-chip {
  padding: 4px 9px;
  border-radius: 999px;
  border: 1px solid var(--border-soft);
  background: transparent;
  color: var(--text-dim);
  font-size: 11px;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease),
    border-color var(--dur) var(--ease);
}
.ag-model-chip:hover { color: var(--text); border-color: rgba(63, 169, 224, .4); }
.ag-model-chip.on {
  background: rgba(63, 169, 224, .16);
  color: var(--text-bright);
  border-color: transparent;
}
