/* Agent popup — bottom-right liquid-glass chat (agent/agent-panel.js), owned
   by the portal shell so it works on every page. Views: All chats (list),
   a project chat, a general chat, an automation chat (dashboard embed). */
.ap-panel {
  position: fixed; right: 28px; bottom: 64px; z-index: 9500;
  /* Always the taller height — the chats list and every chat share it (no
     shrinking when going back to previous chats). */
  width: 360px; height: 580px; max-height: calc(100vh - 104px); max-width: calc(100vw - 32px);
  display: flex; flex-direction: column; gap: 10px;
  font-family: inherit; color: #111827;
  opacity: 0; transform: translateY(10px) scale(.98); pointer-events: none;
  transition: opacity .22s ease, transform .26s cubic-bezier(.22, 1, .36, 1), height .38s cubic-bezier(.22, 1, .36, 1);
}
.ap-panel.has-thread { height: 580px; }
.ap-panel.is-open { opacity: 1; transform: none; pointer-events: auto; }

/* The conversation: its own liquid-glass rectangle. */
.ap-box {
  position: relative; flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column;
  border-radius: 24px;
  background: rgb(255 255 255 / 65%);
  border: 1px solid rgba(255, 255, 255, .85);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .85), 0 18px 48px rgb(28 36 48 / 14%), 0 2px 8px rgb(28 36 48 / 5%);
  backdrop-filter: blur(22px) saturate(1.4); -webkit-backdrop-filter: blur(22px) saturate(1.4);
}

/* Same X as the portal's New Project popup (.cl-close). */
.ap-close {
  position: absolute; top: 12px; right: 12px; width: 32px; height: 32px; z-index: 2;
  border-radius: 999px; border: 1px solid #e5e7eb; background: rgba(255, 255, 255, .7);
  box-shadow: 0 2px 8px rgba(0, 0, 0, .04); color: rgba(15, 23, 42, .72);
  display: flex; align-items: center; justify-content: center; cursor: pointer;
  transition: transform .15s ease, background .15s ease;
}
.ap-close:hover { transform: translateY(-1px); background: rgba(255, 255, 255, .92); }
.ap-close svg { width: 14px; height: 14px; }

.ap-log {
  flex: 1 1 auto; min-height: 0; overflow-y: auto;
  /* First message starts below the close X (it may scroll under it). */
  padding: 56px 16px 14px; display: flex; flex-direction: column; gap: 18px;
  scrollbar-width: thin;
}
/* Messages + this thread's inline automation chat (manage_automation hand-off),
   which continues the conversation under the messages at its own height. */
.ap-msgs { display: flex; flex-direction: column; gap: 18px; flex: 1 0 auto; }
.ap-inline[hidden] { display: none; }
/* With an inline chat under them the messages keep their own height (no gap). */
.ap-log:has(> .ap-inline:not([hidden])) > .ap-msgs { flex: none; }
.ap-inline-frame { display: block; width: 100%; height: 0; border: 0; background: transparent; color-scheme: normal; }
.ap-empty { margin: auto 8px; text-align: center; color: #9ca3af; font-size: 12.5px; line-height: 1.45; }
.ap-empty-spark { display: block; margin: 0 auto 8px; width: 14px; height: 14px; color: #111827; }

.ap-msg { max-width: 88%; font-size: 13px; line-height: 1.5; white-space: pre-wrap; word-wrap: break-word;
  -webkit-user-select: text; user-select: text; }
/* Only newly shown messages animate in (agent-panel.js render). */
.ap-msg.ap-anim { animation: apIn .24s cubic-bezier(.22, 1, .36, 1) both; }
.ap-msg-user { align-self: flex-end; background: rgb(17 24 39 / 5%); color: #111827; font-weight: 500;
  padding: 8px 13px; border-radius: 18px; }
.ap-msg-agent { align-self: flex-start; color: #1f2937; font-weight: 500; padding: 0 2px; }
/* Suggested-response pills under an agent reply ("Import stream"). */
.ap-pills { align-self: flex-start; display: flex; flex-wrap: wrap; gap: 6px; margin: -2px 0 2px; }
.ap-pill { border: 1px solid #e3e5ea; background: #fff; color: #111827; border-radius: 999px; padding: 6px 12px;
  font-size: 12px; font-weight: 600; font-family: inherit; cursor: pointer; box-shadow: 0 1px 2px rgba(17,24,39,.05);
  transition: background .15s ease, border-color .15s ease; }
.ap-pill:hover { background: #f6f7f9; border-color: #d4d7de; }
@keyframes apIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.ap-ts { display: inline-block; padding: 0 6px; margin: 0 1px; border-radius: 6px; cursor: pointer;
  background: rgb(17 24 39 / 7%); color: #111827; font-weight: 600; font-variant-numeric: tabular-nums; }
.ap-ts:hover { background: #111827; color: #fff; }

/* "Notify me when it's done" — quiet text button under the working status. */
.ap-notify { align-self: center; margin: -4px 0 0; padding: 0 2px; border: 0; background: none;
  font: 600 12px inherit; font-family: inherit; color: #6b7280; cursor: pointer; text-decoration: none;
  transition: color .15s ease; }
.ap-notify:hover { color: #111827; }
.ap-notify.is-on { cursor: default; color: #6b7280; }
.ap-thinking { align-self: flex-start; font-size: 13px; font-weight: 500; padding: 0 2px;
  background: linear-gradient(90deg, #9ca3af 0%, #9ca3af 35%, #1f2937 50%, #9ca3af 65%, #9ca3af 100%);
  background-size: 200% auto; -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
  animation: apShimmer 2.2s linear infinite; }
@keyframes apShimmer { 0% { background-position: 200% center; } 100% { background-position: 0% center; } }

.ap-confirm { align-self: stretch; display: flex; align-items: center; gap: 8px; padding: 10px 12px;
  border-radius: 16px; background: rgba(255, 255, 255, .7); border: 1px solid rgba(17, 24, 39, .06); }
.ap-confirm-text { flex: 1; min-width: 0; font-size: 12.5px; font-weight: 600; color: #111827; }
.ap-confirm-cost { display: block; font-size: 11.5px; font-weight: 500; color: #6b7280; margin-top: 1px; }
.ap-btn { border: 0; border-radius: 999px; padding: 7px 13px; font-size: 12px; font-weight: 600; cursor: pointer; font-family: inherit; }
.ap-btn-primary { background: #111827; color: #fff; }
.ap-btn-primary:hover { background: #000; }
.ap-btn-ghost { background: transparent; color: #6b7280; }
.ap-btn-ghost:hover { color: #111827; }
.ap-confirm.is-done { opacity: .55; pointer-events: none; }
/* Live Auto Clip mid-stream: two choices + Cancel, stacked. */
.ap-confirm-choice { flex-direction: column; align-items: stretch; gap: 6px; }
.ap-confirm-choice .ap-btn-ghost { align-self: flex-end; }
.ap-choice { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; text-align: left; padding: 9px 12px;
  border-radius: 12px; border: 1px solid #e5e7eb; background: #fff; color: #111827; font-family: inherit; cursor: pointer;
  transition: background .15s ease, border-color .15s ease; }
.ap-choice b { font-size: 12.5px; font-weight: 700; }
.ap-choice span { font-size: 11.5px; font-weight: 500; color: #6b7280; }
.ap-choice:hover { background: #f9fafb; border-color: #d4d7de; }
.ap-choice.is-primary { border-color: rgba(7,248,196,.75); box-shadow: 0 0 0 1px rgba(7,248,196,.35); }

/* The input: its own pill below the rectangle. */
.ap-bar { flex: 0 0 auto; display: flex; align-items: flex-end; gap: 8px; padding: 8px 8px 8px 18px;
  border-radius: 999px; background: rgba(255, 255, 255, .78); border: 1px solid rgba(255, 255, 255, .9);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .9), 0 12px 32px rgb(28 36 48 / 12%), 0 1px 3px rgb(28 36 48 / 6%);
  backdrop-filter: blur(22px) saturate(1.4); -webkit-backdrop-filter: blur(22px) saturate(1.4);
  transition: border-radius .18s ease; }
/* Past one line (toggled by autosize() in agent-panel.js): rounded rectangle, not a stadium. */
.ap-bar.is-multiline { border-radius: 22px; }
.ap-input { flex: 1; min-width: 0; border: 0; outline: 0; resize: none; background: transparent;
  font: inherit; font-size: 13px; line-height: 1.4; color: #111827; padding: 5px 0;
  overflow-y: hidden; scrollbar-width: none; -ms-overflow-style: none; }
.ap-input::-webkit-scrollbar { display: none; }
.ap-input::placeholder { color: #9ca3af; }
.ap-send { flex: 0 0 auto; width: 32px; height: 32px; border: 0; border-radius: 50%;
  background: #111827; color: #fff; display: flex; align-items: center; justify-content: center; cursor: pointer;
  box-shadow: 0 2px 6px rgb(17 24 39 / 25%); }
.ap-send:disabled { opacity: .35; cursor: default; box-shadow: none; }
.ap-send svg { width: 13px; height: 13px; }

@media (max-width: 520px) {
  .ap-panel { right: 12px; left: 12px; bottom: 12px; width: auto; height: 72vh; }
}

/* Drag from the top strip of the box; resize from its corners. */
.ap-drag { position: absolute; top: 0; left: 0; right: 52px; height: 44px; cursor: grab; z-index: 1; }
.ap-panel.is-dragging .ap-drag { cursor: grabbing; }
.ap-resize { position: absolute; width: 18px; height: 18px; z-index: 3; }
.ap-resize-nw { top: -4px; left: -4px; cursor: nwse-resize; }
.ap-resize-ne { top: -4px; right: -4px; cursor: nesw-resize; }
.ap-resize-sw { bottom: -4px; left: -4px; cursor: nesw-resize; }
.ap-resize-se { bottom: -4px; right: -4px; cursor: nwse-resize; }
.ap-panel.is-dragging { transition: opacity .22s ease; user-select: none; }
.ap-panel.is-placed { transition: opacity .22s ease, transform .26s cubic-bezier(.22, 1, .36, 1); }

/* Header: back (left), title, new chat + close (right). Drag from its empty area. */
.ap-head { position: absolute; top: 0; left: 0; right: 0; height: 56px; z-index: 2;
  display: flex; align-items: center; gap: 8px; padding: 6px 10px 0; pointer-events: none; }
.ap-head > * { pointer-events: auto; }
.ap-title { flex: 1; min-width: 0; font-size: 13px; font-weight: 600; color: #111827;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; pointer-events: none; }
.ap-iconbtn { width: 32px; height: 32px; flex: 0 0 auto; border-radius: 999px; border: 1px solid #e5e7eb;
  background: rgba(255, 255, 255, .7); box-shadow: 0 2px 8px rgba(0, 0, 0, .04); color: rgba(15, 23, 42, .72);
  display: flex; align-items: center; justify-content: center; cursor: pointer; transition: transform .15s ease, background .15s ease; }
.ap-iconbtn:hover { transform: translateY(-1px); background: rgba(255, 255, 255, .92); }
.ap-iconbtn svg { width: 14px; height: 14px; }
.ap-iconbtn[hidden] { display: none; }
.ap-close { position: static; }
.ap-drag { left: 52px; right: 96px; height: 52px; }

/* All chats */
.ap-list { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 60px 12px 12px; display: none; }
.ap-panel.view-list .ap-list { display: block; }
.ap-panel.view-list .ap-log, .ap-panel.view-list .ap-embed { display: none; }
.ap-section { font-size: 12px; font-weight: 600; color: #9ca3af; margin: 4px 4px 8px; }
.ap-autos { display: flex; gap: 8px; overflow-x: auto; padding: 0 2px 10px; scrollbar-width: none; }
.ap-auto { flex: 0 0 auto; min-width: 150px; max-width: 200px; display: flex; align-items: center; gap: 9px; padding: 9px 11px;
  border-radius: 16px; background: rgba(255, 255, 255, .7); border: 1px solid rgba(255, 255, 255, .9);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .9), 0 4px 12px rgb(28 36 48 / 8%); cursor: pointer; text-align: left; font: inherit; }
.ap-auto:hover { background: rgba(255, 255, 255, .95); }
.ap-auto-pfps { display: flex; flex: 0 0 auto; }
.ap-auto-pfps > img, .ap-auto-pfps > span:not(.ap-ava) { width: 26px; height: 26px; border-radius: 50%; object-fit: cover; background: rgba(17, 24, 39, .08); }
.ap-auto-pfps > * + * { margin-left: -9px; }
.ap-auto-text { min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
.ap-auto-text b { font-size: 12px; font-weight: 600; color: #111827; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ap-auto-text span { font-size: 11px; color: #6b7280; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ap-thread { display: block; width: 100%; text-align: left; border: 0; background: transparent; font: inherit; cursor: pointer;
  padding: 9px 10px; border-radius: 12px; }
.ap-thread:hover { background: rgb(17 24 39 / 4%); }
.ap-thread-top { display: flex; align-items: baseline; gap: 8px; }
.ap-thread-title { flex: 1; min-width: 0; font-size: 13px; font-weight: 600; color: #111827; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ap-thread-time { flex: 0 0 auto; font-size: 11px; color: #9ca3af; }
.ap-thread-prev { font-size: 12px; color: #6b7280; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 1px; }
.ap-list-empty { font-size: 12.5px; color: #9ca3af; padding: 6px 4px; }

/* Automation chat: the dashboard's own chat, embedded chat-only. */
.ap-embed { display: none; flex: 1 1 auto; min-height: 0; border: 0; width: 100%; background: transparent; border-radius: 0 0 24px 24px; }
.ap-panel.view-automation .ap-embed { display: block; margin-top: 0; }
.ap-panel.view-automation .ap-log { display: none; }

/* Back + new chat: icon only (no pill). New chat only on the Chats list. */
.ap-back, .ap-new { border: 0; background: transparent; box-shadow: none; color: #111827; }
.ap-back:hover, .ap-new:hover { background: transparent; transform: none; opacity: .65; }
.ap-back svg, .ap-new svg { width: 16px; height: 16px; }
.ap-panel:not(.view-list) .ap-new { display: none; }
.ap-new, .ap-new:hover { color: #6b7280; opacity: 1; transform: none; transition: none; }

/* Messages fade + blur out as they scroll under the top bar. */
.ap-box::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 64px; z-index: 1; pointer-events: none;
  border-radius: 24px 24px 0 0;
  background: linear-gradient(to bottom, rgba(255, 255, 255, .72) 0%, rgba(255, 255, 255, .5) 55%, rgba(255, 255, 255, 0) 100%);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  -webkit-mask-image: linear-gradient(to bottom, #000 0%, #000 50%, transparent 100%);
  mask-image: linear-gradient(to bottom, #000 0%, #000 50%, transparent 100%);
}

/* The portal styles every iframe with a high z-index — keep the embedded
   automation chat under the popup's own header (back / close). */
.ap-panel .ap-embed { position: relative; z-index: 0 !important; opacity: 0; }
.ap-panel .ap-embed.is-ready { opacity: 1; }
.ap-head { z-index: 5; }
.ap-embed-loading { position: absolute; top: 64px; left: 18px; font-size: 13px; font-weight: 500; display: none;
  background: linear-gradient(90deg, #9ca3af 0%, #9ca3af 35%, #1f2937 50%, #9ca3af 65%, #9ca3af 100%);
  background-size: 200% auto; -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent; animation: apShimmer 2.2s linear infinite; }
.ap-panel.view-automation .ap-embed:not(.is-ready) ~ .ap-embed-loading { display: block; }

/* Long titles / previews fade out on the right instead of "…". */
.ap-thread-title, .ap-thread-prev, .ap-auto-text b, .ap-auto-text span {
  text-overflow: clip;
  -webkit-mask-image: linear-gradient(to right, #000 82%, transparent 100%);
  mask-image: linear-gradient(to right, #000 82%, transparent 100%);
}

/* Chats list entrance. */
.ap-in { animation: apListIn .32s cubic-bezier(.22, 1, .36, 1) both; }
@keyframes apListIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* "Automated channels" + and its clipping-channel picker — the dashboard's
   .add-channel-dropdown / .newtask-* look, floating (pushes nothing). */
.ap-section-row { display: flex; align-items: center; justify-content: space-between; position: relative; }
.ap-sec-plus { border: 0; background: transparent; cursor: pointer; display: flex; align-items: center; justify-content: center; padding: 0; }
.ap-dd {
  position: absolute; top: calc(100% + 4px); right: 0; z-index: 20; width: 190px;
  text-transform: none; letter-spacing: 0; font-weight: 400;
  background: #ffffff7a; backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  border-radius: 18px; box-shadow: 0 22px 70px rgba(15, 23, 42, 0.25); padding: 4px;
  max-height: 260px; overflow-y: auto;
  opacity: 0; visibility: hidden; pointer-events: none; transform: translateY(-6px); filter: blur(8px);
  transition: opacity .22s ease, transform .22s ease, filter .22s ease, visibility .22s ease;
}
.ap-dd.show { opacity: 1; visibility: visible; pointer-events: auto; transform: none; filter: blur(0); }
.ap-dd-opt { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 12px;
  font-size: 13px; color: #111827; cursor: pointer; transition: background-color .15s ease; }
.ap-dd-opt:hover { background-color: #f3f4f6ab; }
.ap-dd-opt.is-empty { cursor: default; opacity: .7; }
.ap-dd-pfp { width: 18px; height: 18px; border-radius: 50%; object-fit: cover; flex-shrink: 0; display: block; }
.ap-dd-pfp-blank { background: rgba(17, 24, 39, .12); }
.ap-dd-label { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ap-dd-plat { margin-left: auto; font-size: 10.5px; color: #9ca3af; }
.ap-dd-check { display: none; width: 14px; height: 14px; border-radius: 50%; flex-shrink: 0; box-shadow: inset 0 0 0 1.5px #c4c8cf; }
.ap-dd.is-multi .ap-dd-check { display: inline-block; }
.ap-dd-opt.is-picked .ap-dd-check { box-shadow: none; background: #111827 url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12l5 5L19 7'/%3E%3C/svg%3E") center/9px no-repeat; }
.ap-dd-multi { display: flex; justify-content: flex-end; padding: 4px 8px 4px; }
.ap-dd-multi-btn { border: 0; background: none; cursor: pointer; padding: 3px 4px; font: 500 10.5px inherit; font-size: 10.5px; font-weight: 500; color: #6b7280; }
.ap-dd-multi-btn:hover { color: #111827; }
.ap-dd-multi-btn.is-done { color: #fff; background: #111827; border-radius: 999px; padding: 4px 11px; }

/* List view: the back button is hidden, so line the title up with the
   "Automated channels" / "Chats" headings (list padding 12 + label 4). */
.ap-panel.view-list .ap-title { padding-left: 6px; }

/* Stronger fade + blur where messages scroll under the top bar. */
.ap-box::before {
  height: 76px;
  background: linear-gradient(to bottom, rgba(255, 255, 255, .92) 0%, rgba(255, 255, 255, .78) 45%, rgba(255, 255, 255, 0) 100%);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  -webkit-mask-image: linear-gradient(to bottom, #000 0%, #000 60%, transparent 100%);
  mask-image: linear-gradient(to bottom, #000 0%, #000 60%, transparent 100%);
}

/* Same + as the header's new-chat button (size, stroke, color). */
.ap-sec-plus { width: 24px; height: 24px; color: #6b7280; }
.ap-sec-plus svg { width: 16px; height: 16px; }

/* "+ New chat" in the header: icon then a regular-weight label. */
.ap-new { width: auto; gap: 5px; padding: 0 6px; border-radius: 8px; }
.ap-new-label {
    font-size: 12.5px;
    font-weight: 600;
    color: #6b7280;
    font-family: 'Lato';
    white-space: nowrap;
}

/* Automation chats: "@channel Agent". */
.ap-title-suffix { font-weight: 400; color: #6b7280; }
/* Messages and the chats list scroll without a visible scrollbar. */
.ap-log, .ap-list { scrollbar-width: none; }
.ap-log::-webkit-scrollbar, .ap-list::-webkit-scrollbar { display: none; }

/* Automation cards: "…" on hover (no background) and its menu. */
.ap-auto-wrap { position: relative; flex: 0 0 auto; }
.ap-auto { padding-right: 28px; }
.ap-auto-more { position: absolute; top: 50%; right: 6px; transform: translateY(-50%); width: 22px; height: 22px;
  border: 0; background: transparent; color: #6b7280; cursor: pointer; padding: 0; display: flex; align-items: center; justify-content: center;
  opacity: 0; transition: opacity .15s ease; }
.ap-auto-more svg { width: 14px; height: 14px; }
.ap-auto-wrap:hover .ap-auto-more, .ap-auto-more:focus-visible, .ap-auto-wrap:has(.ap-auto-menu) .ap-auto-more { opacity: 1; }
.ap-auto-more:hover { background: transparent; color: #111827; }
.ap-auto-menu { top: calc(100% + 4px); right: 0; width: 170px; }
.ap-dd-opt.is-danger, .ap-dd-opt.is-danger .ap-dd-label { color: #dc2626; }
.ap-dd-opt.is-danger:hover { background-color: rgba(220, 38, 38, .08); }
.ap-dd-confirm { font-size: 12px; color: #374151; padding: 8px 10px 4px; line-height: 1.35; }
/* The cards row must not clip the menu. */
.ap-autos { overflow: visible; flex-wrap: wrap; }

/* Clipping-channel pfps on automation cards carry the platform badge in the
   bottom-right, same as the dashboard's (.agent-plat-badge). */
.ap-ava { position: relative; display: inline-flex; flex: 0 0 auto; }
.ap-auto-pfps > .ap-ava + .ap-ava { margin-left: -9px; }
.ap-ava img, .ap-ava-blank { width: 26px; height: 26px; border-radius: 50%; object-fit: cover; background: rgba(17, 24, 39, .08); display: block; }
.ap-plat-badge { position: absolute; right: -3px; bottom: -3px; width: 13px; height: 13px; box-sizing: border-box;
  border-radius: 50%; background: #111827; border: 1.5px solid #fff; display: flex; align-items: center; justify-content: center;  color: #fff; }
.ap-plat-badge svg { width: 7px; height: 7px; }

/* The "…" menu sits over cards where backdrop blur can't work — solid white. */
.ap-dd.ap-auto-menu { background: #fff; backdrop-filter: none; -webkit-backdrop-filter: none; box-shadow: 0 12px 40px rgba(15, 23, 42, 0.18); }

/* Sparkle before "Cutline Agent" on the chats page. */
.ap-title-icon { display: inline-flex; vertical-align: -1px; margin-right: 6px; color: #111827; }
.ap-title-icon svg { width: 12px; height: 12px; }

/* "…" menu on automation cards — same size/spacing/icons as the dashboard's
   Automated Channels menu (.agent-more-dropdown): 124px, 11.5px items, 13px icons. */
.ap-dd.ap-auto-menu { width: 124px; padding: 4px; border-radius: 18px; }
.ap-auto-menu .ap-dd-opt { font-size: 11.5px; padding: 7px 9px; gap: 8px; font-weight: 400; }
.ap-opt-icon { flex-shrink: 0; width: 18px; height: 18px; display: inline-flex; align-items: center; justify-content: center; color: #111827; }
.ap-opt-icon svg { width: 13px; height: 13px; display: block; }
.ap-auto-menu .ap-dd-opt.is-danger .ap-opt-icon { color: #dc2626; }

/* Links in agent replies ("Open on Twitch ↗" — e.g. the stream a clip is from). */
.ap-link { color: #111827; font-weight: 600; text-decoration: underline; text-underline-offset: 2px; white-space: nowrap; }
.ap-link:hover { color: #000; }

/* Link cards for links the user posts — click opens the link. */
.ap-linkcard { align-self: flex-end; display: flex; align-items: center; gap: 10px; max-width: 86%;
  padding: 8px 12px 8px 8px; border-radius: 14px; background: #fff; border: 1px solid #e5e7eb;
  box-shadow: 0 1px 3px rgba(17,24,39,.06); text-decoration: none; color: #111827; cursor: pointer;
  transition: background .15s ease, border-color .15s ease, box-shadow .15s ease; }
.ap-linkcard-agent { align-self: flex-start; }
.ap-linkcard:hover { background: #f9fafb; border-color: #d4d7de; box-shadow: 0 3px 10px rgba(17,24,39,.08); }
.ap-linkcard-icon { width: 30px; height: 30px; flex-shrink: 0; border-radius: 9px; display: flex; align-items: center;
  justify-content: center; background: #f3f4f6; color: #111827; }
.ap-linkcard-tiktok { background: #111; color: #fff; }
.ap-linkcard-x { background: #111; color: #fff; }
.ap-linkcard-text { display: flex; flex-direction: column; min-width: 0; }
.ap-linkcard-name { font-size: 12px; font-weight: 700; line-height: 1.2; }
.ap-linkcard-url { font-size: 11px; color: #6b7280; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 1.3; }
/* Chat list: a running chat shows animated dots where its time would be. */
.ap-thread-working { display: inline-flex; align-items: center; gap: 3px; flex-shrink: 0; padding: 0 2px; height: 14px; }
.ap-thread-working i { width: 4px; height: 4px; border-radius: 50%; background: #9ca3af; display: block;
  animation: apWorkDot 1.1s ease-in-out infinite; }
.ap-thread-working i:nth-child(2) { animation-delay: .15s; }
.ap-thread-working i:nth-child(3) { animation-delay: .3s; }
@keyframes apWorkDot { 0%, 80%, 100% { opacity: .3; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-2px); } }
@media (prefers-reduced-motion: reduce) { .ap-thread-working i { animation: none; opacity: .7; } }
/* 👍/👎 on final answers: bare icons to the right of the pills; filled when chosen. */
.ap-rate { display: inline-flex; align-items: center; gap: 2px; margin-left: 4px; }
.ap-rate-btn { border: 0; background: none; padding: 4px; border-radius: 8px; color: #9ca3af; cursor: pointer;
  display: inline-flex; align-items: center; transition: color .15s ease; }
.ap-rate-btn:hover { color: #111827; }
.ap-rate-btn.is-on { color: #111; }
.ap-rate-btn.is-on svg { fill: currentColor; }

/* Unread chat — small dot just left of the timestamp. */
.ap-thread-unread { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: #ef4444; margin-right: 5px; vertical-align: middle; position: relative; top: -1px; }
