/* Phyllis in action — hero chat panels. This is the AgentInAction chat
   window from the old /plan and /develop pages (servicenow-mcp ui-v2 dark
   tokens, verbatim), re-cut as a time-driven autoplay for the homepage hero
   tabs. Injected by phyllis-chat.js in place of each img.tab_image-right. */
.phx {
  --sn-bg: #0a0a0b;
  --sn-card: #141417;
  --sn-border: #212127;
  --sn-fg: #ededf0;
  --sn-muted-fg: #8a8b90;
  --sn-accent: #1a1a1f;
  --sn-muted: #1c1c22;
  --sn-mint: #1ae299;
  width: 100%;
  max-width: 448px;
  text-align: left;
}

/* Use-case pages give the mock a wider, centered column than the homepage
   hero (whose .right_tab-home column is only ~397px). Fill + center it. */
.widget-centered > .phx { max-width: 524px; margin-inline: auto; }

.phx .chat {
  position: relative;
  width: 100%;
  display: flex;
  flex-direction: column;
  height: 520px;
  border-radius: 16px;
  border: 1px solid var(--sn-border);
  background: var(--sn-bg);
  box-shadow: 0 40px 120px -50px rgba(0, 0, 0, 0.9);
  overflow: hidden;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-user-select: none;
  user-select: none;
}

/* top bar */
.phx .chat-top {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--sn-border);
  flex-shrink: 0;
}
.phx .chat-mark { display: grid; place-items: center; flex-shrink: 0; }
.phx .chat-title {
  flex: 1;
  min-width: 0;
  font-size: 12.5px;
  font-weight: 500;
  letter-spacing: -0.18px;
  color: var(--sn-fg);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.phx .chat-tools {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
  color: var(--sn-muted-fg);
}
.phx .ct-pill {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 8px;
  border-radius: 6px;
  border: 1px solid var(--sn-border);
  background: var(--sn-muted);
  font-size: 11px;
  font-weight: 500;
  color: var(--sn-fg);
}
.phx .ct-avatar {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  background: var(--sn-mint);
  color: #0b0c0e;
  font-size: 11px;
  font-weight: 600;
}

/* stream */
.phx .chat-clip {
  position: relative;
  flex: 1;
  overflow: hidden;
  -webkit-mask-image: linear-gradient(180deg, transparent 0, #000 20px, #000 calc(100% - 24px), transparent 100%);
          mask-image: linear-gradient(180deg, transparent 0, #000 20px, #000 calc(100% - 24px), transparent 100%);
}
.phx .chat-stream {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  padding: 14px 14px 8px;
}
.phx .row {
  display: grid;
  grid-template-rows: 0fr;
  opacity: 0;
  transition: grid-template-rows 420ms cubic-bezier(0.22, 0.8, 0.2, 1), opacity 380ms ease;
}
.phx .row-in { overflow: hidden; min-height: 0; }
.phx .row.is-in { grid-template-rows: 1fr; opacity: 1; margin-bottom: 12px; }

/* user bubble */
.phx .user-row { display: flex; justify-content: flex-end; }
.phx .user-bubble {
  display: inline-block;
  max-width: 85%;
  padding: 7px 11px;
  border-radius: 8px;
  background: var(--sn-accent);
  font-size: 13px;
  line-height: 19px;
  font-weight: 500;
  color: var(--sn-fg);
}

/* assistant message */
.phx .msg {
  margin: 0;
  font-size: 13px;
  line-height: 20px;
  letter-spacing: -0.01em;
  color: var(--sn-fg);
}
.phx .msg.streaming::after {
  content: "";
  display: inline-block;
  width: 1.5px;
  height: 13px;
  margin-left: 2px;
  background: var(--sn-muted-fg);
  vertical-align: text-bottom;
  animation: phx-blink 1.05s steps(1) infinite;
}

/* tool timeline */
.phx .timeline {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 2px 0;
  background: none;
  border: 0;
  text-align: left;
}
.phx .tl-label { font-size: 13px; font-weight: 500; color: var(--sn-muted-fg); }
.phx .tl-chev { color: var(--sn-muted-fg); transform: rotate(90deg); }

/* findings + citation chips */
.phx .findings-head { margin: 0 0 7px; font-size: 13px; font-weight: 600; color: var(--sn-fg); }
.phx .findings { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 7px; }
.phx .findings li {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-size: 12px;
  line-height: 18px;
  color: var(--sn-muted-fg);
  opacity: 0;
  transform: translateY(5px);
}
.phx .cite {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
  padding: 1px 7px 1px 3px;
  border-radius: 5px;
  background: rgba(14, 165, 233, 0.1);
  border: 1px solid rgba(14, 165, 233, 0.4);
  color: #7dd3fc;
  font-family: "SF Mono", ui-monospace, "Cascadia Code", Menlo, Consolas, monospace;
  font-size: 10px;
  line-height: 15px;
}
.phx .cite-num {
  display: inline-grid;
  place-items: center;
  min-width: 13px;
  height: 13px;
  padding: 0 3px;
  border-radius: 3px;
  background: rgba(14, 165, 233, 0.25);
  color: #bae6fd;
  font-size: 9px;
  font-weight: 600;
}
.phx .row.is-in .findings li { animation: phx-cite-in 380ms cubic-bezier(0.22, 0.8, 0.2, 1) forwards; }
.phx .row.is-in .findings li:nth-child(1) { animation-delay: 60ms; }
.phx .row.is-in .findings li:nth-child(2) { animation-delay: 150ms; }
.phx .row.is-in .findings li:nth-child(3) { animation-delay: 240ms; }
.phx .row.is-in .findings li:nth-child(4) { animation-delay: 330ms; }
.phx .row.is-in .findings li:nth-child(5) { animation-delay: 420ms; }
.phx .row.is-in .findings li:nth-child(6) { animation-delay: 510ms; }
@keyframes phx-cite-in { 0% { opacity: 0; transform: translateY(5px); } 100% { opacity: 1; transform: none; } }
.phx .row.is-in .findings li .cite { animation: phx-cite-glow 620ms ease forwards; }
@keyframes phx-cite-glow {
  0%, 30% { box-shadow: 0 0 0 0 rgba(14, 165, 233, 0); }
  55%     { box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.22); }
  100%    { box-shadow: 0 0 0 0 rgba(14, 165, 233, 0); }
}

/* document card */
.phx .doc-card {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--sn-border);
  background: var(--sn-card);
}
.phx .doc-ic {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  flex-shrink: 0;
  border-radius: 7px;
  background: var(--sn-muted);
  color: var(--sn-muted-fg);
}
.phx .doc-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.phx .doc-title {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--sn-fg);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.phx .doc-meta { font-size: 10.5px; color: var(--sn-muted-fg); }

/* plan card + rec cards */
.phx .plan-card {
  border-radius: 8px;
  border: 1px solid var(--sn-border);
  background: var(--sn-bg);
  padding: 11px;
}
.phx .plan-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.phx .plan-head-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.phx .plan-title { font-size: 13px; font-weight: 500; line-height: 17px; color: var(--sn-fg); }
.phx .plan-desc { font-size: 11px; color: var(--sn-muted-fg); }
.phx .plan-recs { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; overflow: hidden; }
.phx .rec-card {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--sn-border);
  background: var(--sn-card);
}
.phx .rec-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  align-self: flex-start;
  padding: 4px 11px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  border: 1px solid rgba(43, 181, 203, 0.4);
  background: rgba(43, 181, 203, 0.06);
  color: #2BB5CB;
}
.phx .rec-badge svg { width: 9px; height: 9px; }
.phx .rec-badge--story {
  border: 1px solid rgba(139, 132, 245, 0.4);
  background: rgba(120, 110, 240, 0.08);
  color: #b3acff;
}
.phx .rec-badge--fix {
  border: 1px solid rgba(26, 226, 153, 0.4);
  background: rgba(26, 226, 153, 0.07);
  color: #6ff0c4;
}
.phx .rec-name { flex: 1; min-width: 0; font-size: 13px; font-weight: 500; line-height: 18px; color: var(--sn-fg); }
.phx .rec-table { flex-shrink: 0; font-size: 11px; color: var(--sn-muted-fg); text-align: right; white-space: nowrap; }

/* approval rows */
.phx .approve-rows { display: flex; flex-direction: column; gap: 2px; }
.phx .ar-row { display: flex; align-items: center; gap: 12px; padding: 10px 11px; border-radius: 6px; }
.phx .ar-row--focus { background: var(--sn-muted); }
.phx .ar-num {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  border-radius: 6px;
  background: var(--sn-muted);
  color: var(--sn-muted-fg);
  font-size: 12px;
  font-weight: 500;
}
.phx .ar-row--focus .ar-num { background: #34363b; color: var(--sn-fg); }
.phx .ar-label { flex: 1; font-size: 13px; color: var(--sn-fg); }
.phx .ar-pencil, .phx .ar-arrow {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  border-radius: 6px;
  color: var(--sn-muted-fg);
}
.phx .ar-pencil { background: var(--sn-muted); }
.phx .ar-placeholder { flex: 1; font-size: 13px; color: var(--sn-muted-fg); }

/* composer */
.phx .chat-composer {
  margin: 0 12px 10px;
  border-radius: 12px;
  border: 1px solid var(--sn-border);
  background: var(--sn-card);
  padding: 10px 11px 9px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex-shrink: 0;
}
.phx .composer-input { min-height: 24px; font-size: 13px; line-height: 19px; color: var(--sn-fg); word-break: break-word; }
.phx .ci-placeholder { color: var(--sn-muted-fg); }
.phx .composer-input.is-typing .ci-placeholder { display: none; }
.phx .ci-caret { display: none; }
.phx .composer-input.is-typing .ci-caret {
  display: inline-block;
  width: 1.5px;
  height: 15px;
  margin-left: 1px;
  background: var(--sn-fg);
  vertical-align: text-bottom;
  animation: phx-blink 1.05s steps(1) infinite;
}
@keyframes phx-blink { 0%, 50% { opacity: 1; } 50.01%, 100% { opacity: 0; } }
.phx .composer-bar { display: flex; align-items: center; justify-content: space-between; }
.phx .composer-left { display: flex; align-items: center; gap: 2px; color: var(--sn-muted-fg); }
.phx .composer-right { display: flex; align-items: center; gap: 4px; color: var(--sn-muted-fg); }
.phx .cb-model {
  display: inline-flex; align-items: center;
  font-size: 11.5px; font-weight: 500;
  color: var(--sn-muted-fg);
  padding: 3px 7px; border-radius: 6px;
}
.phx .cb-model--name { color: var(--sn-fg); }
.phx .cb-ic { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 6px; color: var(--sn-muted-fg); }
.phx .composer-send {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 6px;
  background: var(--sn-muted);
  border: 1px solid var(--sn-border);
  color: var(--sn-fg);
}
/* persistent AI disclaimer, like the real chat */
.phx .chat-legal { padding: 8px 14px 11px; text-align: center; border-top: 1px solid var(--sn-border); flex-shrink: 0; }
.phx .chat-legal .disclaimer { margin: 0; font-size: 10px; color: rgba(138, 139, 144, 0.7); }

/* approval footer */
.phx .chat-foot { border-top: 1px solid var(--sn-border); padding: 10px 14px 12px; text-align: center; flex-shrink: 0; }
.phx .kbd-hint { margin: 0; font-size: 10.5px; color: var(--sn-muted-fg); }
.phx .kbd-hint kbd { font-family: "SF Mono", ui-monospace, Menlo, Consolas, monospace; font-size: 10.5px; }
.phx .kbd-sep { margin: 0 6px; }
.phx .disclaimer { margin: 5px 0 0; font-size: 10px; color: rgba(137, 138, 141, 0.7); }

@media (prefers-reduced-motion: reduce) {
  .phx .row { transition: none; }
  .phx .findings li { opacity: 1; transform: none; animation: none !important; }
  .phx .findings li .cite { animation: none !important; }
  .phx .msg.streaming::after, .phx .ci-caret { animation: none; }
}
@media (max-width: 640px) {
  .phx .chat-tools { display: none; }
  .phx .chat { height: 480px; }
}

/* Read-only Q&A: cited-source pills under the answer */
.src-row{display:flex;flex-wrap:wrap;gap:6px}
.src-pill{display:inline-flex;align-items:center;height:22px;padding:0 9px;border-radius:6px;font-size:12px;color:var(--sn-fg);border:1px solid var(--sn-border);background:var(--sn-subtle)}
