/* ══════════════════════════════════════════════════════
   Resource Agent — ASK block on /resources + chat view
   on /ai/answer/{id}.
   ══════════════════════════════════════════════════════ */

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ── ASK block on /resources ── */
.rsa {
  position: relative;
  margin: 0 0 1.75rem;
  padding: 1.1rem 1.25rem 1.1rem;
  background: linear-gradient(180deg, rgba(0,212,255,.03) 0%, rgba(0,212,255,0) 100%);
  border: 1px solid rgba(0,212,255,.3);
  border-radius: 2px;
}
/* Vivid L-shaped corner brackets (four spans positioned at each corner). */
.rsa-corner {
  position: absolute;
  width: 18px;
  height: 18px;
  pointer-events: none;
}
.rsa-corner-tl { top: -1px; left: -1px; border-top: 2px solid var(--cyan); border-left: 2px solid var(--cyan); }
.rsa-corner-tr { top: -1px; right: -1px; border-top: 2px solid var(--cyan); border-right: 2px solid var(--cyan); }
.rsa-corner-bl { bottom: -1px; left: -1px; border-bottom: 2px solid var(--cyan); border-left: 2px solid var(--cyan); }
.rsa-corner-br { bottom: -1px; right: -1px; border-bottom: 2px solid var(--cyan); border-right: 2px solid var(--cyan); }

/* Title bar — hex glyph + uppercase title, cyan line filling to the right. */
.rsa-head {
  display: flex;
  align-items: center;
  gap: .85rem;
  margin-bottom: .9rem;
}
.rsa-title {
  display: inline-flex;
  align-items: center;
  gap: .55rem;
  font-family: var(--heading);
  font-size: .78rem;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--cyan);
  margin: 0;
  white-space: nowrap;
}
.rsa-hex {
  flex-shrink: 0;
  color: var(--cyan);
}
.rsa-head-line {
  flex: 1;
  height: 1px;
  background: rgba(0,212,255,.18);
}
.rsa-form-row {
  position: relative;
}
/* Textarea: no bg, no left/right/top border — just a bottom cyan rule, like
   a terminal prompt line. */
.rsa-input {
  display: block;
  width: 100%;
  height: calc(1em * 1.55 * 3);
  min-height: calc(1em * 1.55 * 3);
  padding: 0 0 .5rem 1.2rem;
  overflow: hidden;
  font-family: var(--body);
  font-size: 1rem;
  line-height: 1.55;
  color: var(--white);
  background: transparent;
  border: none;
  border-bottom: 1px solid rgba(0,212,255,.1);
  border-radius: 0;
  resize: vertical;
  transition: border-color .2s;
}
.rsa-input:focus {
  outline: none;
  border-bottom-color: rgba(0,212,255,.35);
}
.rsa-input::placeholder { color: var(--mid); }
.rsa-form-row::before {
  content: '>';
  position: absolute;
  left: 0;
  top: .05rem;
  font-family: var(--mono);
  color: var(--cyan);
  font-weight: bold;
  pointer-events: none;
}

.rsa-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-top: .85rem;
}
.rsa-controls { justify-content: flex-end; }

.rsa-submit {
  display: inline-flex;
  align-items: center;
  gap: .55rem;
  font-family: var(--heading);
  font-size: .65rem;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--bg);
  background: var(--cyan);
  border: 1px solid var(--cyan);
  padding: .7rem 1.4rem;
  border-radius: 2px;
  cursor: pointer;
  transition: background .2s, color .2s, box-shadow .2s;
}
.rsa-submit-hex { flex-shrink: 0; }
.rsa-submit:hover {
  background: transparent;
  color: var(--cyan);
  box-shadow: 0 0 18px rgba(0,212,255,.25);
}
.rsa-submit:disabled {
  opacity: .55;
  cursor: wait;
}

.rsa-hint {
  display: block;
  margin-top: .75rem;
  font-family: var(--heading);
  font-size: .58rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--mid);
}
.rsa-hint[hidden] { display: none; }
.rsa-hint[data-state="error"] { color: var(--rose); }
.rsa-hint[data-state="loading"] { color: var(--cyan); }
.rsa-hint .rsa-dot {
  display: inline-block;
  width: .5em;
  animation: rsa-dot 1.2s infinite steps(4);
}
@keyframes rsa-dot {
  0%   { content: ''; }
  25%  { content: '.'; }
  50%  { content: '..'; }
  75%  { content: '...'; }
}

/* ── Anonymous CTA variant ── */
.rsa-anon {
  text-align: center;
  padding: 2rem 1rem;
}
.rsa-anon-title {
  font-family: var(--heading);
  font-size: .85rem;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--white);
  margin-bottom: .9rem;
}
.rsa-anon-sub {
  font-family: var(--body);
  font-size: .95rem;
  color: var(--light);
  margin-bottom: 1.5rem;
}
.rsa-anon-btn {
  display: inline-block;
  font-family: var(--heading);
  font-size: .68rem;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--bg);
  background: var(--cyan);
  text-decoration: none;
  padding: .8rem 1.6rem;
  border-radius: 2px;
  transition: background .2s, color .2s, box-shadow .2s;
}
.rsa-anon-btn:hover {
  background: transparent;
  color: var(--cyan);
  box-shadow: 0 0 18px rgba(0,212,255,.25);
}

/* ── OR-TRY cards ── */
/* Override the framework's global section { padding } so the OR-TRY content
   and the directory grid align with the .rsa bordered box's outer edges. */
.rsa-or-try,
.vc-section { padding: 0; }
.rsa-or-try {
  margin: 0 0 2.5rem;
}
.rsa-or-try-label {
  font-family: var(--heading);
  font-size: .62rem;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--cyan);
  margin: 0 0 .85rem;
}
.rsa-or-try-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: .85rem;
}
@media (max-width: 640px) {
  .rsa-or-try-grid { grid-template-columns: 1fr; }
}
.rsa-try-card {
  display: flex;
  align-items: flex-start;
  gap: .85rem;
  padding: 1rem 1.1rem;
  font-family: var(--body);
  font-size: .9rem;
  line-height: 1.5;
  color: var(--light);
  background: rgba(2,4,8,.5);
  border: 1px solid rgba(0,212,255,.1);
  border-radius: 2px;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  transition: border-color .2s, color .2s, background .2s;
}
.rsa-try-card:hover {
  border-color: rgba(0,212,255,.4);
  background: rgba(0,212,255,.04);
  color: var(--white);
}
.rsa-try-tag {
  flex-shrink: 0;
  min-width: 4.5rem;
  text-align: center;
  font-family: var(--heading);
  font-size: .55rem;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--cyan);
  padding: .3rem .55rem;
  border: 1px solid rgba(0,212,255,.35);
  border-radius: 2px;
}

/* ══════════════════════════════════════════════════════
   Chat view — /ai/answer/{id}
   ══════════════════════════════════════════════════════ */

/* Answer pages benefit from more reading width than the default 880px hero
   container — the inline sdanswer card grids need room for 3 cards. Override
   .vc-wrap's horizontal padding too so the thread doesn't sit inside a thick
   left/right gutter on phones. */
.ai-answer.vc-wrap {
  max-width: 1200px;
  padding-left: clamp(.85rem, 3vw, 2.5rem);
  padding-right: clamp(.85rem, 3vw, 2.5rem);
  padding-top: clamp(2.25rem, 5vw, 5rem);
}

.ai-answer-hero { margin-bottom: 2.5rem; }
.ai-answer-eyebrow {
  font-family: var(--heading);
  font-size: .58rem;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--cyan);
  margin-bottom: .9rem;
}
.ai-answer-title {
  font-size: clamp(1.8rem, 4vw, 2.8rem);
}
.ai-answer-sub {
  margin-top: 1rem;
  font-size: .92rem;
  color: var(--light);
}
.ai-answer-sub a {
  color: var(--cyan);
  text-decoration: none;
  margin-left: .5rem;
}
.ai-answer-sub a:hover { text-decoration: underline; }

.ai-thread {
  display: flex;
  flex-direction: column;
  gap: 2.25rem;
}

/* Turns flow as plain blocks — no card border. The visual rhythm comes from
   the header strip, a faint left rail, and the `+` boundary marker between
   adjacent user/assistant turns. */
.ai-turn {
  position: relative;
  padding: 0 0 0 1.1rem;
  border-left: 1px solid rgba(0,212,255,.12);
}
.ai-turn-assistant { border-left-color: rgba(0,212,255,.28); }

/* Boundary marker — a `+` hex centered on the rail, sitting above any
   assistant turn that follows a user turn. */
.ai-turn-user + .ai-turn-assistant::before {
  content: "+";
  position: absolute;
  top: -1.55rem;
  left: -0.55rem;
  width: 1.1rem;
  height: 1.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--mono);
  font-size: .85rem;
  font-weight: 600;
  line-height: 1;
  color: var(--cyan);
  background: var(--bg, #04060c);
  border: 1px solid rgba(0,212,255,.45);
  border-radius: 2px;
}

/* Header row: role label on the left, timestamp on the right. */
.ai-turn-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  margin: 0 0 .65rem;
  min-height: 1.2rem;
}
.ai-turn-role {
  display: inline-flex;
  align-items: baseline;
  gap: .5rem;
  margin: 0;
  font-family: var(--heading);
  font-size: .58rem;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--cyan);
  flex-wrap: wrap;
}
.ai-turn-marker {
  display: inline-block;
  width: .35rem;
  height: .8rem;
  background: var(--cyan);
  transform: translateY(.1rem);
  flex-shrink: 0;
}
.ai-turn-role-label { color: var(--cyan); }
.ai-turn-user .ai-turn-role-label { color: var(--cyan); }
.ai-turn-assistant .ai-turn-role-label { color: var(--cyan); }

.ai-turn-model {
  font-family: var(--mono);
  font-size: .62rem;
  letter-spacing: .14em;
  color: rgba(0,212,255,.55);
  margin-left: .4rem;
}
.ai-turn-model-name {
  font-family: var(--mono);
  font-size: .62rem;
  letter-spacing: .12em;
  text-transform: lowercase;
  color: var(--mid);
}
.ai-turn-time {
  font-family: var(--mono);
  font-size: .62rem;
  letter-spacing: .14em;
  color: var(--mid);
  white-space: nowrap;
}

/* ── Bottom-of-turn actions row (COPY / SHARE) ─────────────────────── */
.ai-turn-actions {
  display: flex;
  gap: .5rem;
  margin-top: 1.1rem;
  padding-top: .85rem;
  border-top: 1px dashed rgba(0,212,255,.12);
}
.ai-turn-action {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  padding: .3rem .65rem;
  font-family: var(--heading);
  font-size: .55rem;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--mid);
  background: transparent;
  border: 1px solid rgba(0,212,255,.18);
  border-radius: 2px;
  cursor: pointer;
  transition: color .15s, border-color .15s, background .15s;
}
.ai-turn-action:hover,
.ai-turn-action:focus-visible {
  color: var(--cyan);
  border-color: rgba(0,212,255,.55);
  background: rgba(0,212,255,.05);
  outline: none;
}
.ai-turn-action.is-copied {
  color: var(--cyan);
  border-color: rgba(0,212,255,.55);
  background: rgba(0,212,255,.06);
}
.ai-turn-action-label[hidden] { display: none; }

/* Header-level share button on /ai/answer */
.ai-answer-actions {
  display: flex;
  gap: .5rem;
  margin-top: 1rem;
  justify-content: center;
}
.ai-answer-share { padding: .4rem .85rem; font-size: .58rem; }

/* Hide the <template> if a UA ever decides to render it. */
.ai-turn-markdown { display: none; }

.ai-turn-question {
  font-family: var(--body);
  font-size: 1.02rem;
  line-height: 1.6;
  color: var(--white);
}
.ai-turn-question p { margin: 0 0 .6rem; }
.ai-turn-question p:last-child { margin-bottom: 0; }
.ai-turn-question a {
  color: var(--cyan);
  text-decoration: none;
  border-bottom: 1px solid rgba(0,212,255,.3);
}
.ai-turn-question a:hover { border-bottom-color: var(--cyan); }

.ai-turn-answer {
  font-family: var(--body);
  font-size: 1.02rem;
  line-height: 1.75;
  color: var(--white);
}
.ai-turn-answer p {
  margin: 0 0 1rem;
}
.ai-turn-answer p:last-child { margin-bottom: 0; }
.ai-turn-answer a {
  color: var(--cyan);
  text-decoration: none;
  border-bottom: 1px solid rgba(0,212,255,.3);
}
.ai-turn-answer a:hover { border-bottom-color: var(--cyan); }
.ai-turn-answer code {
  font-family: var(--mono);
  font-size: .92em;
  background: rgba(0,212,255,.08);
  padding: .1em .35em;
  border-radius: 2px;
}
.ai-turn-answer ul,
.ai-turn-answer ol {
  margin: 0 0 1rem;
  padding-left: 1.5rem;
}
.ai-turn-answer li { margin: .25rem 0; }
.ai-turn-answer strong { color: var(--white); font-weight: 600; }

/* ── Citation cards ── */
.ai-citations {
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px dashed rgba(0,212,255,.12);
}
.ai-citations-label {
  font-family: var(--heading);
  font-size: .55rem;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--mid);
  margin-bottom: .75rem;
}
.ai-citation-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: .75rem;
}
.ai-citation-card {
  padding: .9rem 1rem;
  background: rgba(2,4,8,.55);
  border: 1px solid rgba(0,212,255,.08);
  border-radius: 2px;
  transition: border-color .2s, background .2s;
}
.ai-citation-card:hover {
  border-color: rgba(0,212,255,.25);
  background: rgba(0,212,255,.04);
}
.ai-citation-link {
  display: block;
  text-decoration: none;
}
.ai-citation-title {
  font-family: var(--heading);
  font-size: .85rem;
  letter-spacing: .04em;
  color: var(--white);
  margin: 0 0 .35rem;
  line-height: 1.35;
}
.ai-citation-link:hover .ai-citation-title { color: var(--cyan); }
.ai-citation-meta {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  margin: 0 0 .4rem;
  font-family: var(--heading);
  font-size: .52rem;
  letter-spacing: .15em;
  text-transform: uppercase;
  color: var(--mid);
}
.ai-citation-type { color: var(--cyan); }
.ai-citation-blurb {
  font-family: var(--body);
  font-size: .85rem;
  line-height: 1.55;
  color: var(--light);
  margin: 0;
}

/* ── Follow-up form ── */
.ai-followup {
  margin-top: 1rem;
  padding: 1.25rem 1.5rem;
  border: 1px solid rgba(0,212,255,.08);
  border-radius: 2px;
  background: rgba(2,4,8,.4);
}
.ai-followup textarea {
  width: 100%;
  min-height: 4rem;
  padding: .75rem 1rem;
  font-family: var(--body);
  font-size: .95rem;
  line-height: 1.55;
  color: var(--white);
  background: rgba(2,4,8,.7);
  border: 1px solid rgba(0,212,255,.12);
  border-radius: 2px;
  resize: vertical;
  transition: border-color .2s, box-shadow .2s;
}
.ai-followup textarea:focus {
  outline: none;
  border-color: var(--cyan);
  box-shadow: 0 0 0 1px var(--cyan);
}
.ai-followup-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-top: .75rem;
  flex-wrap: wrap;
}
.ai-followup-hint {
  font-family: var(--heading);
  font-size: .58rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--mid);
  min-height: 1.2em;
}
.ai-followup-hint[data-state="error"] { color: var(--rose); }
.ai-followup-hint[data-state="loading"] { color: var(--cyan); }
.ai-followup-btn {
  font-family: var(--heading);
  font-size: .65rem;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--bg);
  background: var(--cyan);
  border: 1px solid var(--cyan);
  padding: .65rem 1.3rem;
  border-radius: 2px;
  cursor: pointer;
  transition: background .2s, color .2s, box-shadow .2s;
}
.ai-followup-btn:hover {
  background: transparent;
  color: var(--cyan);
  box-shadow: 0 0 18px rgba(0,212,255,.25);
}
.ai-followup-btn:disabled { opacity: .55; cursor: wait; }

.ai-followup-closed {
  margin-top: 1.25rem;
  padding: 1rem 1.25rem;
  font-family: var(--body);
  font-size: .9rem;
  color: var(--light);
  border: 1px dashed rgba(0,212,255,.12);
  border-radius: 2px;
  text-align: center;
}
.ai-followup-closed a {
  color: var(--cyan);
  text-decoration: none;
  margin-left: .5rem;
}
.ai-followup-closed a:hover { text-decoration: underline; }

@media (max-width: 600px) {
  .rsa-submit { width: 100%; }
}

/* ── Recent answers history (gated on sudo-r+) ────────────────────────────
   Always a fixed left-rail sidebar — never inline. Below the wide
   breakpoint it collapses into a drawer that slides in over the page
   when the user clicks the `.rsa-history-toggle` tab on the left edge.
   When open it has an opaque glassy backdrop so the page text isn't
   readable underneath. */
.rsa-history {
  position: fixed;
  top: 7.5rem;
  left: 1.25rem;
  width: 15rem;
  max-height: calc(100vh - 9rem);
  margin: 0;
  padding: .9rem 1rem;
  background: rgba(2,4,8,.95);
  border: 1px solid rgba(0,212,255,.18);
  border-radius: 2px;
  overflow-y: auto;
  z-index: 60;
  backdrop-filter: blur(8px);
}
.rsa-history-head {
  font-family: var(--heading);
  font-size: .6rem;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--cyan);
  margin: 0 0 .65rem;
}
.rsa-history-list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.rsa-history-item {
  padding: .35rem 0;
  border-bottom: 1px solid rgba(0,212,255,.05);
}
.rsa-history-item:last-child { border-bottom: none; }
.rsa-history-link {
  color: var(--light);
  text-decoration: none;
  font-size: .9rem;
  line-height: 1.4;
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  transition: color .15s;
}
.rsa-history-link:hover { color: var(--cyan); }

/* ── Drawer behavior on narrow viewports ──────────────────────────────────
   Below 1800px the rail would overlap the centered content if always
   visible. So default to closed (slid off-screen). The toggle tab on
   the left edge opens it; the backdrop catches clicks to close. */
.rsa-history-toggle {
  position: fixed;
  top: 50%;
  left: 0;
  transform: translateY(-50%);
  padding: 0;
  margin: 0;
  background: transparent;
  border: none;
  cursor: pointer;
  z-index: 50;
  display: block;
}
.rsa-history-toggle-tab {
  display: inline-block;
  padding: .85rem .55rem;
  font-family: var(--heading);
  font-size: .55rem;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--cyan);
  background: rgba(2,4,8,.85);
  border: 1px solid rgba(0,212,255,.3);
  border-left: none;
  border-radius: 0 4px 4px 0;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  transition: background .15s, color .15s, border-color .15s;
}
.rsa-history-toggle:hover .rsa-history-toggle-tab {
  background: rgba(0,212,255,.08);
  color: var(--white);
  border-color: var(--cyan);
}
.rsa-history-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(2,4,8,.55);
  backdrop-filter: blur(3px);
  z-index: 55;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s ease;
}

/* Closed state (default): drawer hidden to the left, backdrop inert,
   toggle tab visible. */
.rsa-history {
  transform: translateX(calc(-100% - 1.5rem));
  transition: transform .35s cubic-bezier(.4,.0,.2,1);
}
.rsa-history.is-open {
  transform: translateX(0);
}
body.rsa-history-open .rsa-history-backdrop {
  opacity: 1;
  pointer-events: auto;
}
body.rsa-history-open { overflow: hidden; }

/* Wide viewports (≥ 1800px): drawer is always open, no toggle/backdrop. */
@media (min-width: 1800px) {
  .rsa-history {
    transform: translateX(0);
  }
  .rsa-history-toggle,
  .rsa-history-backdrop {
    display: none;
  }
  body.rsa-history-open { overflow: auto; }
}

/* ══════════════════════════════════════════════════════
   Live answer mode — /resources morphs into /ai/answer
   on ASK submit. The scaffold renders before the API
   response and gets hydrated by sk:notification events.
   ══════════════════════════════════════════════════════ */

.ai-answer-live {
  display: flex;
  flex-direction: column;
}

/* Blinking caret used as the title placeholder until
   `agent_title_updated` types the real title in. */
.ai-title-caret {
  display: inline-block;
  width: .6ch;
  height: 1.05em;
  background: var(--cyan);
  vertical-align: -0.1em;
  margin-left: .15em;
  animation: ai-caret-blink 1.05s steps(2, end) infinite;
}
@keyframes ai-caret-blink {
  0%, 49% { opacity: 1; }
  50%, 100% { opacity: 0; }
}

/* Reframer preface — transient message above the tool stream. Lands
   on `agent_reframe_ready`, collapses alongside `.ai-tools-stream` on
   `agent_run_complete`. Reads like normal message text, just slightly
   muted with a thin cyan accent so it doesn't compete with the final
   answer prose. Not persisted — never appears on reload. */
.ai-reframe-preface[hidden] { display: none; }
.ai-reframe-preface {
  font-family: var(--body);
  font-size: .98rem;
  line-height: 1.7;
  color: var(--light);
  border-left: 2px solid var(--cyan);
  padding: .35rem 0 .35rem .85rem;
  margin: 0 0 .9rem;
  white-space: pre-wrap;
  overflow: hidden;
}

/* Tools stream — vertical list of `agent_tool_event` chips that fill
   the assistant turn body while the run is in flight, then collapse
   when `agent_run_complete` lands. */
.ai-tools-stream {
  display: flex;
  flex-direction: column;
  gap: .5rem;
  margin: 0 0 .25rem;
  overflow: hidden;
}
.ai-tools-stream:empty { display: none; }

.ai-tool-chip {
  display: grid;
  grid-template-columns: 1.4rem auto 1fr auto;
  align-items: baseline;
  gap: .55rem;
  padding: .55rem .8rem;
  font-family: var(--mono);
  font-size: .82rem;
  line-height: 1.4;
  color: var(--light);
  background: rgba(0,212,255,.04);
  border: 1px solid rgba(0,212,255,.18);
  border-left: 2px solid var(--cyan);
  border-radius: 2px;
  opacity: 0;
  transform: translateY(4px);
  animation: ai-chip-in .35s ease forwards;
}
@keyframes ai-chip-in {
  to { opacity: 1; transform: translateY(0); }
}
.ai-tool-chip[data-status="active"] {
  border-color: rgba(0,212,255,.5);
  box-shadow: 0 0 18px rgba(0,212,255,.12) inset;
}
.ai-tool-chip[data-status="active"] .ai-tool-chip-icon {
  animation: ai-chip-pulse 1.4s ease-in-out infinite;
}
.ai-tool-chip[data-status="done"] {
  opacity: .55;
  border-left-color: rgba(0,212,255,.35);
  background: transparent;
}
@keyframes ai-chip-pulse {
  0%, 100% { opacity: .55; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.12); }
}
.ai-tool-chip-icon {
  color: var(--cyan);
  font-size: 1rem;
  line-height: 1;
}
.ai-tool-chip-label {
  font-family: var(--heading);
  font-size: .58rem;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--cyan);
  white-space: nowrap;
}
.ai-tool-chip-arg {
  color: var(--white);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ai-tool-chip-summary {
  font-family: var(--heading);
  font-size: .56rem;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--mid);
  white-space: nowrap;
}

.ai-answer-prose {
  font-family: var(--body);
  font-size: 1.02rem;
  line-height: 1.75;
  color: var(--white);
}
.ai-answer-prose p { margin: 0 0 1rem; }
.ai-answer-prose p:last-child { margin-bottom: 0; }
.ai-answer-prose a {
  color: var(--cyan);
  text-decoration: none;
  border-bottom: 1px solid rgba(0,212,255,.3);
}
.ai-answer-prose a:hover { border-bottom-color: var(--cyan); }
.ai-answer-prose code {
  font-family: var(--mono);
  font-size: .92em;
  background: rgba(0,212,255,.08);
  padding: .1em .35em;
  border-radius: 2px;
}
.ai-answer-prose strong { color: var(--white); font-weight: 600; }

.ai-live-error {
  font-family: var(--body);
  font-size: .92rem;
  color: var(--rose, #ff9b9b);
}
.ai-live-error a {
  color: var(--cyan);
  border-bottom: 1px solid rgba(0,212,255,.3);
  text-decoration: none;
}

/* While live, the body locks the original page from scrolling away
   under the morph. */
body.ai-live .vc-hero,
body.ai-live .rsa,
body.ai-live .rsa-or-try,
body.ai-live .vc-section { pointer-events: none; }

/* ── Quota indicators ── */
.rsa-quota-counter,
.ai-followup-counter {
  font-family: var(--heading);
  font-size: .55rem;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--mid);
}

.rsa-quota-block {
  padding: 1rem 1.25rem 1.1rem;
  margin-top: .5rem;
  border: 1px dashed rgba(0,212,255,.18);
  border-radius: 2px;
  background: rgba(2,4,8,.5);
}
.rsa-quota-head {
  font-family: var(--heading);
  font-size: .58rem;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--cyan);
  margin: 0 0 .55rem;
}
.rsa-quota-msg {
  font-family: var(--body);
  font-size: .92rem;
  line-height: 1.55;
  color: var(--light);
  margin: 0;
}
.rsa-quota-msg strong { color: var(--white); font-weight: 600; }
.rsa-quota-msg a {
  color: var(--cyan);
  text-decoration: none;
  border-bottom: 1px solid rgba(0,212,255,.3);
}
.rsa-quota-msg a:hover { border-bottom-color: var(--cyan); }
