/* The AiPe demo (showcase/chapters/_aipe.html, aipe-demo.js) on /how-it-works/ (#aipe).
   One window: an EZPZ tool page on the left and the AiPe drawer docked on the right, stacked on
   narrow screens (the drawer's bottom dock). Drawer colours are AiPe's own
   (intrinio_options/templates/intrinio/components/_aipe_chatbot.html); page colours are the host
   pages' own (feed-redis.html, option_chain_with_chart.html, netflow-redis.html). The section
   around it uses landing.css. Everything is ap-* and scoped under .ap so it beats landing.css's
   element reset. Only transform and opacity animate; all of it stops under reduced motion
   (landing.css section 13, plus .ap-still) and while the demo is paused (.is-paused). */

.ap {
  --ap-p: #6759d1; --ap-p2: #a78bfa;
  --ap-pg-bg: #12101f; --ap-card: #19162d; --ap-line: rgba(255, 255, 255, .07);
  --ap-text: #dcd9f2; --ap-muted: #a29ec4; --ap-bright: #f1effc;
  --ap-call: #4cbc9a; --ap-put: #ef5a68; --ap-cyan: #38bdf8;
  --ap-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --ap-h: 640px;
}
html:not(.js) .ap-js, .ap.ap-nodata .ap-js { display: none !important; }

/* ---- head ---- */
.ap-head-logo { display: inline-flex; }
.ap .ap-head-logo img {
  width: 48px; height: 48px; border-radius: var(--lp-r-sm); border: 1px solid var(--lp-border-strong); background: #fff;
  box-shadow: 0 0 24px color-mix(in srgb, var(--ap-p) 45%, transparent);
}

/* ---- host page tabs ---- */
.ap-hosts {
  display: flex; flex-wrap: wrap; justify-content: center; gap: var(--lp-sp-2);
  margin: 0 auto var(--lp-sp-4); padding: var(--lp-sp-1); width: fit-content; max-width: 100%;
  border: 1px solid var(--lp-border); border-radius: var(--lp-r-pill); background: var(--lp-surface-2);
}
.ap .ap-host {
  display: inline-flex; align-items: center; gap: var(--lp-sp-2); min-height: 40px; padding: 0 var(--lp-sp-4);
  border: 1px solid transparent; border-radius: var(--lp-r-pill); background: none; cursor: pointer;
  color: var(--lp-muted); font: 600 var(--lp-fs-sm)/1.2 var(--lp-font); white-space: nowrap;
}
.ap .ap-host:hover { color: var(--lp-text); }
.ap .ap-host[aria-selected="true"] {
  color: var(--lp-text); border-color: var(--lp-primary);
  background: color-mix(in srgb, var(--lp-primary) 24%, transparent);
}
.ap-host-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--lp-g-flow); }
.ap-host-dot--chain { background: var(--lp-g-analytics); }
.ap-host-dot--netflow { background: var(--lp-g-stocks); }

/* ---- the window ---- */
.ap-window {
  position: relative; overflow: hidden;
  border: 1px solid var(--lp-border-strong); border-radius: var(--lp-r-lg); background: var(--ap-pg-bg);
  box-shadow: var(--lp-shadow), 0 0 80px color-mix(in srgb, var(--lp-primary) 10%, transparent);
}
.ap-bar {
  display: flex; align-items: center; gap: 12px; height: 40px; padding: 0 14px;
  background: #0c0a17; border-bottom: 1px solid var(--ap-line); white-space: nowrap; overflow: hidden;
}
.ap-lights { display: inline-flex; gap: 6px; }
.ap-lights i { width: 10px; height: 10px; border-radius: 50%; background: #ff5f57; }
.ap-lights i + i { background: #febc2e; }
.ap-lights i + i + i { background: #28c840; }
.ap-bar-tab {
  overflow: hidden; text-overflow: ellipsis; padding: 4px 12px; border-radius: 8px 8px 0 0;
  background: var(--ap-pg-bg); color: var(--ap-muted); font-size: 12px;
}
.ap-bar-tab b { color: var(--ap-bright); font-weight: 800; letter-spacing: -.01em; }

.ap-stage { display: grid; grid-template-columns: minmax(0, 1fr) minmax(320px, 420px); height: var(--ap-h); }

/* ---- the tool page ---- */
.ap-page { position: relative; min-width: 0; min-height: 0; overflow-y: auto; padding: 16px; scrollbar-width: thin; scrollbar-color: rgba(103, 89, 209, .3) transparent; }
.ap-pg { display: flex; flex-direction: column; gap: 12px; min-width: 0; color: var(--ap-text); font-size: 13px; }
.ap-pg.is-new { animation: ap-in .3s var(--lp-ease) both; }
.ap-pg-top { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.ap-pg-top .lp-sample { margin-left: auto; }
.ap-pg-name { color: var(--ap-bright); font: 700 15px/1.3 var(--lp-font); }
.ap-pg-tick { color: var(--ap-bright); font: 800 20px/1.2 var(--lp-font); letter-spacing: -.01em; }
.ap-price {
  padding: 3px 10px; border-radius: 8px; font: 700 13px/1.4 var(--ap-mono);
  color: #fff; background: rgba(103, 89, 209, .35); border: 1px solid rgba(167, 139, 250, .4);
}
.ap-pg-exp { color: var(--ap-muted); font-size: 12px; }

/* toolbar look-alike (decorative) */
.ap-tb { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.ap-tb-btn, .ap-tb-search, .ap-tb-live {
  display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 11px; border-radius: 8px;
  background: rgba(255, 255, 255, .05); border: 1px solid rgba(255, 255, 255, .1); color: var(--ap-muted); font-size: 12px;
}
.ap-tb-search { min-width: 150px; }
.ap-tb-live { margin-left: auto; }
.ap-tb-live i { width: 26px; height: 14px; border-radius: 8px; background: rgba(255, 255, 255, .14); position: relative; }
.ap-tb-live i::after { content: ""; position: absolute; top: 2px; left: 2px; width: 10px; height: 10px; border-radius: 50%; background: #c9c5e6; }

/* the filter panel's state, as pills */
.ap .ap-fstrip { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; list-style: none; }
.ap .ap-fp {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px;
  font-size: 11.5px; font-weight: 600; color: var(--ap-text);
  background: rgba(102, 126, 234, .16); border: 1px solid rgba(102, 126, 234, .45);
}
.ap .ap-fp[data-on="false"] { color: var(--ap-muted); background: transparent; border-color: rgba(255, 255, 255, .12); text-decoration: line-through; text-decoration-color: rgba(255, 255, 255, .35); }
.ap .ap-fp--val[data-on="false"] { text-decoration: none; }
.ap .ap-fp b { color: var(--ap-bright); font-weight: 700; }
.ap .ap-fp.is-changed { animation: ap-pop .45s var(--lp-ease); }
.ap-fp-dot { width: 7px; height: 7px; border-radius: 50%; background: #22c55e; }
.ap-fp-dot--put { background: #ef4444; }
.ap-fp-dot--neutral { background: #94a3b8; }
.ap-fp[data-on="false"] .ap-fp-dot { opacity: .45; }

/* tables: scroll inside their card */
.ap-twrap {
  position: relative; overflow-x: auto; border: 1px solid var(--ap-line); border-radius: 10px; background: var(--ap-card);
  scrollbar-width: thin; scrollbar-color: rgba(103, 89, 209, .3) transparent;
}
.ap-tin { position: relative; width: max-content; min-width: 100%; }
.ap .ap-t { width: 100%; border-collapse: collapse; font-size: 12.5px; font-variant-numeric: tabular-nums; }
.ap .ap-t th {
  padding: 8px 10px; text-align: left; white-space: nowrap; color: var(--ap-muted);
  font: 700 10.5px/1.3 var(--ap-mono); letter-spacing: .04em; background: rgba(255, 255, 255, .03);
  border-bottom: 1px solid var(--ap-line);
}
.ap .ap-t td { padding: 7px 10px; white-space: nowrap; border-bottom: 1px solid rgba(255, 255, 255, .04); color: var(--ap-text); }
.ap .ap-t tbody tr:last-child td, .ap .ap-t tbody tr:last-child th { border-bottom: 0; }
.ap-mono { font-family: var(--ap-mono); font-size: 11.5px; color: var(--ap-muted); }
.ap .ap-t td.ap-mono { color: var(--ap-muted); }
.ap .ap-t .ap-tk { color: var(--ap-bright); font-weight: 700; }
.ap .ap-t .ap-prem { color: var(--ap-bright); font-weight: 600; font-family: var(--ap-mono); font-size: 12px; }
.ap-side { font-weight: 700; font-size: 11.5px; }
.ap-side--ASK { color: #a996ff; }
.ap-side--BID { color: #ffc107; }
.ap-side--MID { color: #3dd5f3; }
.ap-cp { font-weight: 700; font-size: 11.5px; }
.ap-cp--call { color: var(--ap-call); }
.ap-cp--put { color: var(--ap-put); }
.ap-dir { display: inline-block; padding: 2px 8px; border-radius: 15px; color: #fff; font-size: 11px; font-weight: 600; background: #5a4fc4; }
.ap-dir--BULLISH { background: #237a60; }
.ap-dir--BEARISH { background: #c42b3a; }
.ap-flag { display: inline-block; padding: 2px 9px; border-radius: 12px; color: #fff; font-size: 11px; font-weight: 600; }
.ap-flag--SWEEP { background: #f59e0b; color: #1d1300; }
.ap-flag--FLOOR { background: #7c4fe0; }
.ap-flag--BLOCK { background: #2f6fe0; }
.ap .ap-t tr.is-leaving { opacity: 0; transform: translateX(14px); transition: opacity .28s var(--lp-ease), transform .28s var(--lp-ease); }
.ap .ap-t tr.is-entering { animation: ap-row-in .4s var(--lp-ease) both; }
.ap .ap-t tbody.is-reload { animation: ap-reload .45s var(--lp-ease); }
.ap .ap-count { margin: 0; color: var(--ap-muted); font-size: 12px; }

/* option chain */
.ap-mgrid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.ap-mg { min-width: 0; padding: 8px 10px; border-radius: 10px; background: var(--ap-card); border: 1px solid var(--ap-line); }
.ap .ap-mg-hd { margin: 0 0 4px; color: var(--ap-muted); font: 700 10px/1.3 var(--ap-mono); letter-spacing: .05em; text-transform: uppercase; }
.ap .ap-mg dl { margin: 0; }
.ap-mg-row { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; line-height: 1.6; }
.ap .ap-mg-row dt { color: var(--ap-muted); margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ap .ap-mg-row dd { margin: 0; color: var(--ap-bright); font: 600 12px/1.6 var(--ap-mono); white-space: nowrap; }
.ap .ap-mg-row dd.is-cyan { color: var(--ap-cyan); }
.ap .ap-t--chain th, .ap .ap-t--chain td { text-align: right; }
.ap .ap-t--chain th.ap-sidehd { text-align: center; color: var(--ap-bright); }
.ap .ap-t--chain th.ap-sidehd--c { color: #4ade80; }
.ap .ap-t--chain th.ap-sidehd--p { color: #f87171; }
.ap .ap-t--chain .ap-strike {
  position: relative; text-align: center; color: var(--ap-bright); font: 700 12.5px/1.3 var(--ap-mono);
  background: rgba(103, 89, 209, .12); border-bottom: 1px solid rgba(255, 255, 255, .04);
}
.ap .ap-t--chain td.ap-itm { background: #292d4a; }
.ap-hls { position: absolute; inset: 0; pointer-events: none; }
.ap-rowhl { position: absolute; left: 0; right: 0; border-radius: 3px; transform-origin: left center; }
.ap-rowhl--green { background: rgba(16, 185, 129, .18); outline: 1px solid rgba(16, 185, 129, .5); }
.ap-rowhl--red { background: rgba(239, 68, 68, .18); outline: 1px solid rgba(239, 68, 68, .5); }
.ap-rowhl--yellow { background: rgba(250, 204, 21, .18); outline: 1px solid rgba(250, 204, 21, .5); }
.ap-rowhl--blue { background: rgba(59, 130, 246, .18); outline: 1px solid rgba(59, 130, 246, .5); }
.ap-rowhl--purple { background: rgba(167, 139, 250, .18); outline: 1px solid rgba(167, 139, 250, .5); }
.ap-rowhl.is-in { animation: ap-hl-in .5s var(--lp-ease) both; }
.ap-rowhl.is-in::after {   /* one soft pulse as it lands */
  content: ""; position: absolute; inset: -3px; border-radius: 5px; box-shadow: 0 0 0 2px currentColor; opacity: 0;
  animation: ap-hl-pulse 1.1s .35s var(--lp-ease) 2;
}
.ap-rowhl--green { color: rgba(16, 185, 129, .6); }
.ap-rowhl--red { color: rgba(239, 68, 68, .6); }
.ap-rowhl--yellow { color: rgba(250, 204, 21, .6); }
.ap-rowhl--blue { color: rgba(59, 130, 246, .6); }
.ap-rowhl--purple { color: rgba(167, 139, 250, .6); }

/* net flow chart */
.ap .ap-chart { margin: 0; padding: 12px 12px 8px; border-radius: 12px; background: var(--ap-card); border: 1px solid var(--ap-line); }
.ap .ap-chart-t { margin: 0 0 6px; color: var(--ap-bright); font: 700 13px/1.3 var(--lp-font); }
.ap .ap-legend { display: flex; flex-wrap: wrap; gap: 4px 14px; margin: 0 0 8px; padding: 0; list-style: none; color: var(--ap-muted); font-size: 11.5px; }
.ap .ap-legend li { display: inline-flex; align-items: center; gap: 6px; }
.ap-legend i { width: 14px; height: 2px; border-radius: 1px; background: rgba(51, 184, 144, 1); }
.ap-legend .ap-lg-put { background: rgba(236, 75, 94, 1); }
.ap-legend .ap-lg-px { background: #fff; height: 1.5px; }
.ap-chart-stage { position: relative; height: 300px; }
.ap-chart-stage canvas { position: absolute; inset: 0; display: block; width: 100%; height: 100%; }
.ap .ap-chart-foot { margin: 6px 0 0; color: var(--ap-muted); font-size: 11.5px; }

/* the page's "⚙ …" filter toast (#aipe-filter-toast) */
.ap-toast {
  position: absolute; right: 16px; bottom: 16px; z-index: 3; max-width: calc(100% - 32px);
  padding: 8px 16px; border-radius: 8px; pointer-events: none;
  background: rgba(84, 104, 214, .95); color: #fff; font-size: 13px; font-weight: 500;   /* the page's rgba(102,126,234,.92), a shade darker for AA */
  box-shadow: 0 4px 16px rgba(0, 0, 0, .35);
  opacity: 0; transform: translateY(6px); transition: opacity .3s, transform .3s var(--lp-ease);
}
.ap-toast.is-on { opacity: 1; transform: none; }

/* ---- the AiPe drawer (#nf-ai-panel) ---- */
.ap-drawer {
  position: relative; display: flex; flex-direction: column; min-width: 0; min-height: 0;
  background: #0e0a22;
  background-image:
    radial-gradient(ellipse 70% 45% at 85% 0%, rgba(91, 79, 207, .28) 0%, transparent 60%),
    radial-gradient(ellipse 50% 35% at 15% 100%, rgba(124, 58, 237, .2) 0%, transparent 55%);
  border-left: 1px solid rgba(103, 89, 209, .3);
  font-family: 'Inter', var(--lp-font);
}
.ap-dh { position: relative; flex: none; background: rgba(103, 89, 209, .08); border-bottom: 1px solid rgba(103, 89, 209, .2); }
.ap-dh::before {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 1.5px;
  background: linear-gradient(90deg, transparent 0%, rgba(91, 79, 207, .7) 25%, rgba(167, 139, 250, .9) 50%, rgba(236, 72, 153, .7) 75%, transparent 100%);
}
.ap-dh-in { display: flex; align-items: center; gap: 12px; padding: 12px 14px; }
.ap-dh-logo { position: relative; flex: none; width: 44px; height: 44px; }
.ap-dh-ring { position: absolute; inset: -4px; border-radius: 16px; background: conic-gradient(from 0deg, #5b4fcf, #a78bfa, #ec4899, #a78bfa, #5b4fcf); opacity: .75; }
.ap-dh-ring::after { content: ""; position: absolute; inset: 3px; border-radius: 12px; background: rgba(10, 8, 26, .85); }
.ap-dh-img { position: relative; z-index: 1; display: flex; width: 44px; height: 44px; overflow: hidden; border-radius: 12px; background: #fff; }
.ap .ap-dh-img img { width: 100%; height: 100%; object-fit: cover; }
.ap-dh-text { flex: 1; min-width: 0; }
.ap-dh-title { display: block; color: #e2e0ff; font-size: 15px; font-weight: 700; letter-spacing: .2px; }
.ap-dh-sub { display: block; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #9f9cc0; font-size: 11.5px; letter-spacing: .3px; }
.ap-dh-meta { display: flex; align-items: center; gap: 8px; }
.ap-dh-live { width: 8px; height: 8px; border-radius: 50%; background: #10b981; box-shadow: 0 0 8px rgba(16, 185, 129, .8); animation: ap-pulse 2s ease infinite; }
.ap-dh-badge {
  padding: 3px 9px; border-radius: 6px; font: 700 12px/1.3 monospace; letter-spacing: .5px;
  color: #10b981; background: rgba(16, 185, 129, .1); border: 1px solid rgba(16, 185, 129, .25);
}
.ap-dh-btns { display: flex; gap: 6px; }
.ap-dh-btns i {
  display: flex; align-items: center; justify-content: center; width: 28px; height: 28px; border-radius: 8px;
  background: rgba(255, 255, 255, .07); border: 1px solid rgba(255, 255, 255, .12); color: #7d7d9e; font-size: 12px; font-style: normal;
}
.ap-progress { position: relative; height: 3px; overflow: hidden; opacity: 0; transition: opacity .25s; box-shadow: 0 0 8px rgba(167, 139, 250, .6); }
.ap-progress::before {   /* #nf-ai-progress: the gradient runs left to right while AiPe works */
  content: ""; position: absolute; top: 0; bottom: 0; left: 0; width: 200%;
  background: linear-gradient(90deg, #5b4fcf, #a78bfa, #ec4899, #a78bfa, #5b4fcf, #a78bfa, #ec4899, #a78bfa, #5b4fcf);
}
.ap-progress.is-on { opacity: 1; }
.ap-progress.is-on::before { animation: ap-progress 1.8s linear infinite; }

.ap-msgs {
  position: relative; flex: 1; min-height: 0; overflow-y: auto; padding: 14px 14px 10px;
  background: rgba(103, 89, 209, .03); scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, .12) transparent;
}
.ap-wm {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  display: flex; flex-direction: column; align-items: center; gap: 12px; opacity: .07; pointer-events: none;
}
.ap-wm-ring { display: flex; align-items: center; justify-content: center; width: 96px; height: 96px; overflow: hidden; border-radius: 50%; border: 1.5px solid rgba(167, 139, 250, .55); background: rgba(103, 89, 209, .1); }
.ap .ap-wm-ring img { width: 78%; height: 78%; object-fit: contain; border-radius: 50%; }
.ap-wm-l { color: #c4b5fd; font-size: 12px; font-weight: 800; letter-spacing: 3px; text-transform: uppercase; }
.ap-log { position: relative; z-index: 1; display: flex; flex-direction: column; gap: 16px; }
.ap-msg { display: flex; flex-direction: column; gap: 5px; animation: ap-in .3s var(--lp-ease) both; }
.ap-msg--user { align-items: flex-end; }
.ap-msg--ai { align-items: flex-start; }
.ap-meta { display: flex; align-items: center; gap: 8px; padding: 0 3px; }
.ap-role { display: flex; align-items: center; gap: 5px; color: #a99ce6; font-size: 10px; font-weight: 700; letter-spacing: .8px; text-transform: uppercase; }
.ap-role::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: linear-gradient(135deg, #5b4fcf, #a78bfa); }
.ap-time { color: #8a88b0; font-size: 10px; letter-spacing: .3px; }
.ap-bubble { max-width: 95%; padding: 12px 15px; border-radius: 16px; color: #ccc9ee; font-size: 13.5px; line-height: 1.7; overflow-wrap: anywhere; }
.ap-msg--user .ap-bubble {
  background: rgba(103, 89, 209, .25); border: 1px solid rgba(167, 139, 250, .3); border-top-color: rgba(255, 255, 255, .15);
  border-radius: 16px 16px 4px 16px; color: #eceaff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .12), 0 4px 18px rgba(103, 89, 209, .18);
}
.ap-msg--ai .ap-bubble {
  width: 100%; max-width: 100%; border-radius: 0 14px 14px 14px;
  background: rgba(103, 89, 209, .1); border: 1px solid rgba(103, 89, 209, .22);
  border-left: 2px solid rgba(167, 139, 250, .65); border-top-color: rgba(255, 255, 255, .1);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .07), 0 2px 16px rgba(103, 89, 209, .08);
}
.ap .ap-bubble p { margin: 0 0 10px; }
.ap .ap-bubble p:last-child { margin-bottom: 0; }
.ap .ap-bubble strong { color: #d4c6ff; font-weight: 700; }
.ap .ap-bubble h3 { margin: 10px 0 4px; color: #c4b5fd; font: 700 13px/1.4 'Inter', var(--lp-font); letter-spacing: 0; }
.ap .ap-bubble h3:first-child { margin-top: 0; }
.ap .ap-bubble ul { margin: 4px 0 10px; padding: 0; list-style: none; }
.ap .ap-bubble li { position: relative; margin-bottom: 5px; padding-left: 18px; color: #c6c2ea; font-size: 13px; line-height: 1.65; }
.ap .ap-bubble li::before { content: "\203A"; content: "\203A" / ""; position: absolute; left: 0; top: 0; color: #8e7ef0; font-size: 16px; font-weight: 700; line-height: 1.4; }
.ap-caret { display: inline-block; width: 2px; height: 13px; margin-left: 2px; vertical-align: -2px; border-radius: 1px; background: var(--ap-p2); animation: ap-blink .7s steps(1) infinite; }
/* the pages' markdown transforms: badges and dollar values */
.ap-bdg { display: inline-flex; align-items: center; gap: 3px; padding: 1px 8px; border-radius: 4px; font-size: 11px; font-weight: 700; letter-spacing: .4px; vertical-align: middle; }
.ap-bdg--bull { background: rgba(16, 185, 129, .14); color: #10b981; border: 1px solid rgba(16, 185, 129, .25); }
.ap-bdg--bear { background: rgba(239, 68, 68, .14); color: #f26d6d; border: 1px solid rgba(239, 68, 68, .25); }
.ap-bdg--neutral { background: rgba(250, 204, 21, .1); color: #fbbf24; border: 1px solid rgba(250, 204, 21, .2); }
.ap-val { padding: 0 4px; border-radius: 3px; color: #c4b5fd; background: rgba(103, 89, 209, .1); font: 600 12.5px/1 monospace; }
.ap-val-pos { color: #10b981; font: 600 12.5px/1 monospace; }
.ap-val-neg { color: #f26d6d; font: 600 12.5px/1 monospace; }
.ap-oc-bull { color: #10b981; font-weight: 700; }
.ap-oc-bear { color: #f26d6d; font-weight: 700; }
.ap-oc-neutral { color: #fbbf24; font-weight: 700; }

/* "Analyzing… / reading data" (.nf-thinking) and "Generating…" (.nf-stream-wait) */
.ap-thinking {
  display: flex; align-items: center; gap: 12px; padding: 12px 15px; border-radius: 12px;
  background: rgba(103, 89, 209, .1); border: 1px solid rgba(103, 89, 209, .22); border-top-color: rgba(255, 255, 255, .1);
  color: #a3a3c8; font-size: 12px; animation: ap-in .2s var(--lp-ease) both;
}
.ap-thinking-i { display: inline-block; font-size: 16px; animation: ap-spin 3s linear infinite; }
.ap-thinking-t { flex: 1; }
.ap-thinking-t strong { display: block; margin-bottom: 2px; color: #b8aaf0; font-size: 12.5px; }
.ap-thinking-s { display: flex; align-items: center; gap: 5px; margin-top: 3px; color: #8d8dc0; font-size: 11px; }
.ap-wait { display: flex; align-items: center; gap: 6px; padding: 4px 0; color: #8d8dc0; font-size: 11px; }
.ap-dots { display: inline-flex; gap: 4px; align-items: center; }
.ap-dots i { width: 6px; height: 6px; border-radius: 50%; background: linear-gradient(135deg, #5b4fcf, #a78bfa); animation: ap-dot .9s ease-in-out infinite; }
.ap-dots i:nth-child(2) { animation-delay: .18s; }
.ap-dots i:nth-child(3) { animation-delay: .36s; }

/* highlight-suggestion chips (Net Flow's .nf-hl-chip) */
.ap-hlwrap { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.ap .ap-hlchip {
  display: inline-flex; align-items: center; gap: 4px; padding: 4px 10px; border-radius: 20px; cursor: pointer;
  border: 1px solid rgba(99, 167, 254, .35); background: rgba(99, 167, 254, .08); color: #93c5fd;
  font: 500 12px/1.4 'Inter', var(--lp-font); animation: ap-in .3s var(--lp-ease) both;
  transition: transform .15s var(--lp-ease);
}
.ap .ap-hlchip:hover { background: rgba(99, 167, 254, .18); border-color: rgba(99, 167, 254, .6); }
.ap .ap-hlchip[aria-pressed="true"] { background: rgba(99, 167, 254, .22); border-color: rgba(99, 167, 254, .7); color: #bfdbfe; }
.ap .ap-hlchip.is-press { transform: scale(.94); }
.ap-hlx { margin-left: 2px; font-size: 10px; opacity: .55; }

/* footer: chips, input, hint, footer action */
.ap-df { flex: none; padding: 12px 14px 14px; border-top: 1px solid rgba(103, 89, 209, .2); background: rgba(103, 89, 209, .07); }
.ap-chips { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 10px; }
.ap .ap-chip {
  position: relative; padding: 5px 13px; border-radius: 20px; cursor: pointer; white-space: nowrap; max-width: 100%;
  overflow: hidden; text-overflow: ellipsis;
  color: #bcaef0; border: 1px solid rgba(103, 89, 209, .3); background: rgba(103, 89, 209, .14);
  font: 500 11.5px/1.5 'Inter', var(--lp-font);
  transition: transform .2s var(--lp-ease);
}
.ap .ap-chip:hover { background: rgba(103, 89, 209, .22); border-color: rgba(167, 139, 250, .4); color: #d2c8fd; transform: translateY(-1px); }
.ap .ap-chip[aria-current="true"] { color: #fff; background: rgba(103, 89, 209, .32); border-color: rgba(167, 139, 250, .65); }
.ap .ap-chip.is-press { transform: scale(.95); }
.ap .ap-chip::after {   /* the "pick me" glow once an answer has played (.ap-nudge) */
  content: ""; position: absolute; inset: -1px; border-radius: inherit; pointer-events: none; opacity: 0;
  box-shadow: 0 0 0 1px rgba(167, 139, 250, .6), 0 0 18px rgba(103, 89, 209, .45);
}
.ap.ap-nudge .ap-chip:not([aria-current="true"])::after { animation: ap-glow 2.8s ease-in-out infinite; }
.ap.ap-nudge .ap-chip:nth-child(2)::after { animation-delay: .5s; }
.ap.ap-nudge .ap-chip:nth-child(3)::after { animation-delay: 1s; }

.ap .ap-form { margin: 0; }
.ap-inrow {
  display: flex; align-items: flex-end; gap: 10px; padding: 7px 7px 7px 14px; border-radius: 16px;
  background: rgba(103, 89, 209, .12); border: 1px solid rgba(103, 89, 209, .28); border-top-color: rgba(255, 255, 255, .12);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .08);
}
.ap-inrow:focus-within { border-color: rgba(167, 139, 250, .6); box-shadow: 0 0 0 3px rgba(103, 89, 209, .2), inset 0 1px 0 rgba(255, 255, 255, .1); }
.ap-field { position: relative; flex: 1; min-width: 0; }
.ap .ap-input {
  display: block; width: 100%; min-height: 26px; max-height: 96px; margin: 0; padding: 6px 0; resize: none;
  border: 0; outline: none; background: transparent; color: #e2e0ff; font: 14px/1.55 'Inter', var(--lp-font);
}
.ap .ap-input::placeholder { color: #8c8cbc; }
.ap .ap-input:focus-visible { outline: none; }   /* the row shows focus */
.ap-field.has-typed .ap-input::placeholder { color: transparent; }
.ap-typed { display: none; min-height: 26px; padding: 6px 0; color: #e2e0ff; font: 14px/1.55 'Inter', var(--lp-font); overflow-wrap: anywhere; }
.ap-field.has-typed:not(.has-value):not(:focus-within) .ap-typed { display: block; }
.ap-field.has-typed:not(.has-value):not(:focus-within) .ap-input { position: absolute; inset: 0; height: 100%; max-height: none; }
.ap-field.has-typed .ap-typed::after { content: ""; display: inline-block; width: 2px; height: 1em; margin-left: 1px; vertical-align: -2px; background: #c4b5fd; animation: ap-blink .7s steps(1) infinite; }
.ap .ap-send {
  display: flex; align-items: center; justify-content: center; flex: none; width: 38px; height: 38px; margin: 0; padding: 0;
  border: 0; border-radius: 12px; cursor: pointer; color: #fff;
  background: linear-gradient(135deg, #5b4fcf 0%, #7c3aed 100%); box-shadow: 0 2px 12px rgba(91, 79, 207, .45);
  transition: transform .2s var(--lp-ease);
}
.ap .ap-send:hover { transform: scale(1.06) rotate(-5deg); }
.ap .ap-send.is-press { transform: scale(.9); }
.ap .ap-hint { margin: 8px 0 0; color: #8a88b8; font-size: 10.5px; }
.ap-acts { display: flex; gap: 12px; margin-top: 4px; }
.ap .ap-act { padding: 2px 0; border: 0; background: none; cursor: pointer; color: #9393c4; font: 500 11px/1.5 'Inter', var(--lp-font); }
.ap .ap-act:hover { color: #a78bfa; }
.ap .ap-note { margin: 8px 0 0; color: #b3b0d6; font-size: 12px; line-height: 1.45; transition: opacity .25s var(--lp-ease); }
.ap-note b { color: #c4b5fd; font-weight: 600; }
.ap-ready .ap-note { opacity: 0; }
.ap-ready .ap-note.is-on { opacity: 1; }

/* ---- controls and footer ---- */
.ap-controls { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--lp-sp-3) var(--lp-sp-5); margin-top: var(--lp-sp-4); }
.ap-play { display: flex; gap: var(--lp-sp-2); }
.ap-ico-play, .is-paused .ap-ico-pause { display: none; }
.is-paused .ap-ico-play { display: inline; }
.ap .ap-sample-note { display: inline-flex; flex-wrap: wrap; align-items: center; gap: var(--lp-sp-2); color: var(--lp-muted); font-size: var(--lp-fs-xs); }
.ap-foot { display: flex; flex-direction: column; align-items: center; gap: var(--lp-sp-4); margin-top: var(--lp-sp-6); text-align: center; }
.ap-ctas { display: flex; flex-wrap: wrap; justify-content: center; gap: var(--lp-sp-3); }
.ap .ap-foot-note { max-width: 62ch; color: var(--lp-muted); font-size: var(--lp-fs-sm); }
.ap .ap-foot-note a { color: var(--lp-accent); font-weight: 600; }
.ap .ap-foot-note a:hover { color: var(--lp-text); text-decoration: underline; }

/* ---- motion ---- */
@keyframes ap-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes ap-row-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes ap-reload { 0% { opacity: .45; } 100% { opacity: 1; } }
@keyframes ap-pop { 0% { transform: scale(1); } 40% { transform: scale(1.08); } 100% { transform: scale(1); } }
@keyframes ap-hl-in { from { opacity: 0; transform: scaleX(.6); } to { opacity: 1; transform: none; } }
@keyframes ap-hl-pulse { 0% { opacity: 0; transform: scale(1); } 40% { opacity: 1; } 100% { opacity: 0; transform: scale(1.02, 1.25); } }
@keyframes ap-pulse { 0%, 100% { opacity: 1; } 50% { opacity: .4; } }
@keyframes ap-progress { from { transform: translateX(-50%); } to { transform: translateX(0); } }
@keyframes ap-spin { to { transform: rotate(360deg); } }
@keyframes ap-dot { 0%, 80%, 100% { transform: scale(.35); opacity: .3; } 40% { transform: scale(1); opacity: 1; } }
@keyframes ap-blink { 50% { opacity: 0; } }
@keyframes ap-glow { 0%, 100% { opacity: 0; } 50% { opacity: 1; } }
.ap.is-paused *, .ap.is-paused *::before, .ap.is-paused *::after { animation-play-state: paused !important; }
.ap-still .ap-msg, .ap-still .ap-pg, .ap-still .ap-progress::before, .ap-still .ap-thinking, .ap-still .ap-hlchip, .ap-still .ap-rowhl,
.ap-still .ap-rowhl::after, .ap-still .ap-t tr, .ap-still .ap-t tbody, .ap-still .ap-fp { animation: none !important; }

/* ---- narrower: the drawer docks below the page ---- */
@media (max-width: 999px) {
  .ap-stage { grid-template-columns: minmax(0, 1fr); height: auto; }
  .ap-page { overflow: visible; }
  .ap-drawer { height: 560px; border-left: 0; border-top: 1px solid rgba(103, 89, 209, .3); }
  .ap-chart-stage { height: 260px; }
}
@media (max-width: 640px) {
  .ap-page { padding: 12px; }
  .ap-mgrid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ap-tb-wide, .ap-tb-search { display: none; }
  .ap-dh-in { gap: 10px; padding: 10px 12px; }
  .ap-dh-logo, .ap-dh-img { width: 38px; height: 38px; }
  .ap-dh-btns i:nth-child(-n+2) { display: none; }
  .ap-msgs { padding: 12px 10px 8px; }
  .ap-df { padding: 10px 10px 12px; }
  .ap-drawer { height: 540px; }
  .ap-chart-stage { height: 220px; }
  .ap-controls { justify-content: center; }
  .ap-sample-note { justify-content: center; text-align: center; }
  .ap .ap-host { padding: 0 var(--lp-sp-3); }
}
@media (max-width: 479.98px) {
  .ap-ctas, .ap-ctas .lp-btn { width: 100%; }
  .ap-hosts { border-radius: var(--lp-r); }
  .ap .ap-chip { white-space: normal; text-align: left; }
}
