/* chat-view session viewer (vt-0392 v6 + vt-0530 T15 landing alignment).
 * Loaded after app.css. All selectors namespaced .cv-*. */

.cv-root {
  /* vt-0530 T15: align bg/fg to new landing-aligned token values */
  --cv-bg:        #0d1117;  /* matches --bg / --term-bg */
  --cv-bg-soft:   #161b22;  /* matches --bg-warm */
  --cv-line:      #21262d;  /* matches --panel-2 */
  --cv-line-bright: #30363d; /* matches --line */
  --cv-fg:        #e6edf3;  /* matches --text */
  --cv-fg-dim:    #c9d1d9;  /* matches --text-dim */
  --cv-fg-faint:  #8b949e;  /* matches --text-faint */
  --cv-phos:      #a3be8c;  /* --ok */
  --cv-phos-glow: rgba(163, 190, 140, 0.3);
  --cv-cyan:      #88c0d0;  /* matches --accent */
  --cv-cyan-glow: rgba(136, 192, 208, 0.3);
  --cv-amber:     #ebcb8b;  /* matches --warn */
  --cv-amber-glow: rgba(235, 203, 139, 0.3);
  --cv-danger:    #f85149;  /* matches --danger */
  --cv-scan:      rgba(136, 192, 208, 0.012); /* softer cyan tint */
  --cv-mono:      "JetBrains Mono", "Berkeley Mono", ui-monospace, monospace;

  font-family: var(--cv-mono);
  font-feature-settings: "ss01", "ss02", "calt", "liga";
  background: var(--cv-bg);
  color: var(--cv-fg);
  display: flex; flex-direction: column;
  position: relative; overflow: hidden;
  min-height: 0; height: 100%;
}

.cv-wrap {
  position: relative;
  flex: 1; display: flex; flex-direction: column;
  min-height: 0;
}

.cv-scanlines {
  position: absolute; inset: 0; pointer-events: none;
  z-index: 1;
  background: repeating-linear-gradient(
    to bottom, transparent 0, transparent 3px,
    var(--cv-scan) 3px, var(--cv-scan) 4px);
  mix-blend-mode: screen; opacity: 0.85;
  animation: cv-scandrift 32s linear infinite;
}
@keyframes cv-scandrift {
  from { background-position: 0 0; }
  to   { background-position: 0 4px; }
}

.cv-scroller {
  position: relative; z-index: 2;
  flex: 1; min-height: 0;
  overflow-y: auto; overflow-x: hidden;
  padding: 16px 0 8px;
  scroll-behavior: smooth;
  scrollbar-width: thin;
  scrollbar-color: var(--cv-line-bright) transparent;
}
.cv-scroller::-webkit-scrollbar { width: 8px; }
.cv-scroller::-webkit-scrollbar-track { background: transparent; }
.cv-scroller::-webkit-scrollbar-thumb { background: var(--cv-line-bright); }
.cv-scroller::-webkit-scrollbar-thumb:hover { background: var(--cv-fg-faint); }

.cv-list { display: flex; flex-direction: column; gap: 4px; }

/* vt-0397 DOM virtualization affordance: tiny invisible anchor at the top
   of the list; IntersectionObserver fires loadOlder when it re-enters.
   Fallback button is shown only when there are evicted (unmounted) nodes. */
.cv-load-older-sentinel { min-height: 1px; }

.cv-load-older-btn {
  align-self: center;
  margin: 6px auto 4px;
  padding: 4px 12px;
  background: transparent;
  color: var(--cv-fg-faint);
  border: 1px dashed var(--cv-line-bright);
  border-radius: 2px;
  font: inherit; font-size: 11px; letter-spacing: 0.04em;
  cursor: pointer;
  opacity: 0.7;
  transition: opacity 120ms, border-color 120ms, color 120ms;
}
.cv-load-older-btn:hover {
  opacity: 1;
  border-color: var(--cv-accent);
  color: var(--cv-accent);
}

.cv-msg {
  position: relative;
  display: grid;
  grid-template-columns: 28px 1fr;
  align-items: start;
  padding: 7px 18px 7px 0;
  border-left: 2px solid transparent;
  transition: background 140ms ease;
}
.cv-msg:hover { background: rgba(255, 255, 255, 0.012); }
.cv-msg::before {
  content: var(--cv-glyph, '·');
  grid-column: 1;
  align-self: start; justify-self: center;
  padding-top: 1px;
  font-size: 13px; line-height: 1.4;
  color: var(--cv-glyph-color, var(--cv-fg-dim));
  text-shadow: 0 0 var(--cv-glyph-spread, 0px) var(--cv-glyph-color, transparent);
}
.cv-msg .cv-body { grid-column: 2; min-width: 0; }

.cv-user {
  --cv-glyph: '❯';
  --cv-glyph-color: var(--cv-cyan);
  --cv-glyph-spread: 8px;
  border-left-color: var(--cv-cyan);
  background: linear-gradient(90deg,
    color-mix(in srgb, var(--cv-cyan) 4%, transparent) 0%,
    transparent 24%);
}
/* vt-0428: assistant lives on the RIGHT side — chat-style flow.
   Grid flipped: body | glyph. Accent rail + gradient mirrored. */
.cv-assistant {
  --cv-glyph: '◆';
  --cv-glyph-color: var(--cv-phos);
  --cv-glyph-spread: 10px;
  grid-template-columns: 1fr 28px;
  padding: 7px 0 7px 18px;
  border-left: 2px solid transparent;
  border-right: 2px solid var(--cv-phos);
  background: linear-gradient(270deg,
    color-mix(in srgb, var(--cv-phos) 3%, transparent) 0%,
    transparent 26%);
}
.cv-assistant::before { grid-column: 2; }
.cv-assistant .cv-body {
  grid-column: 1;
  /* Keep readable width; push toward the right rail. */
  max-width: 78%;
  margin-left: auto;
  text-align: left;
}

/* vt-0430: chain-level collapse — ALL tool calls + results across the
   entire agent processing chain (from first tool_use to terminal
   end_turn) wrap into ONE <details>. Replaces vt-0428 per-turn grouping
   which still produced N collapsibles for N-step chains. */
.cv-chain {
  margin: 8px 14px;
  border: 1px dashed var(--cv-line-bright);
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.015);
}
.cv-chain[open] {
  background: rgba(255, 255, 255, 0.025);
}
.cv-chain-summary {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px;
  cursor: pointer;
  list-style: none;
  color: var(--cv-fg-faint);
  font-size: 11px; letter-spacing: 0.06em;
  text-transform: uppercase;
  user-select: none;
}
.cv-chain-summary::-webkit-details-marker { display: none; }
.cv-chain-chevron {
  display: inline-block;
  transition: transform 120ms ease;
  color: var(--cv-phos);
}
.cv-chain[open] .cv-chain-chevron { transform: rotate(90deg); }
.cv-chain-label {
  color: var(--cv-fg-dim);
  font-weight: 500;
  min-width: 6em;
}
.cv-chain-meta {
  color: var(--cv-fg-faint);
  opacity: 0.7;
  font-style: italic;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
/* Nested .cv-msg loses its outer padding/border so the chain looks
   like a cohesive log, not a list of message bubbles. */
.cv-chain > .cv-msg {
  padding-left: 14px; padding-right: 14px;
  border-left: 0; border-right: 0;
  background: none;
  display: block;
}
.cv-chain > .cv-msg::before { display: none; }
.cv-chain > .cv-msg .cv-body {
  margin: 0; max-width: none; text-align: left;
}
.cv-system-line {
  display: flex; gap: 8px;
  padding: 2px 18px 2px 30px;
  color: var(--cv-fg-faint);
  font-size: 10px;
  text-transform: lowercase; letter-spacing: 0.06em;
}
.cv-system-dot { color: var(--cv-fg-faint); }
.cv-sidechain {
  margin-left: 30px; border-left-style: dashed; opacity: 0.94;
}
.cv-sidechain::before { font-size: 11px; }

.cv-body { font-size: 13px; line-height: 1.55; }
.cv-text { white-space: normal; color: var(--cv-fg); }
.cv-text + .cv-text { margin-top: 6px; }
.cv-text :where(strong, b) { color: var(--cv-fg); font-weight: 600; }
.cv-text :where(em, i) { color: var(--cv-cyan); font-style: normal; }

.cv-inline-code {
  background: rgba(255, 255, 255, 0.04);
  color: var(--cv-phos);
  padding: 1px 5px;
  font-size: 12px;
  border-left: 1px solid var(--cv-phos);
  text-shadow: 0 0 4px var(--cv-phos-glow);
}
.cv-code {
  margin: 6px 0; padding: 8px 12px;
  background: #000;
  border-left: 2px solid var(--cv-line-bright);
  font: 12px/1.5 var(--cv-mono);
  overflow: auto; max-height: 480px;
  color: var(--cv-fg);
}
.cv-code code { background: none; padding: 0; color: var(--cv-fg); border: 0; text-shadow: none; }

/* vt-0438: clickable links in chat text. Phosphor underline only on hover
   so the conversation doesn't look painted. target=_blank set in renderer. */
.cv-link {
  color: var(--cv-cyan);
  text-decoration: none;
  border-bottom: 1px dotted color-mix(in srgb, var(--cv-cyan) 50%, transparent);
  transition: color 140ms, border-color 140ms, text-shadow 140ms;
  word-break: break-word;
}
.cv-link:hover, .cv-link:focus {
  color: var(--cv-phos);
  border-bottom-color: var(--cv-phos);
  text-shadow: 0 0 6px var(--cv-phos-glow);
  outline: none;
}

.cv-meta {
  position: absolute; top: 4px; right: 8px;
  font-size: 9px; line-height: 1;
}
.cv-meta-trigger {
  list-style: none; cursor: pointer;
  color: var(--cv-fg-faint);
  padding: 2px 6px;
  display: inline-block;
  transition: color 120ms;
}
.cv-meta-trigger::-webkit-details-marker { display: none; }
.cv-meta-trigger:hover { color: var(--cv-cyan); }
.cv-meta[open] .cv-meta-trigger { color: var(--cv-phos); }
.cv-meta-inner {
  position: absolute; right: 0; top: 100%;
  display: inline-flex; gap: 12px;
  padding: 4px 8px;
  background: var(--cv-bg-soft);
  border: 1px solid var(--cv-line);
  white-space: nowrap;
  color: var(--cv-fg-dim);
  letter-spacing: 0.04em;
  z-index: 10;
}
.cv-meta-model  { color: var(--cv-fg); }
.cv-meta-tokens { color: var(--cv-fg-dim); }
.cv-meta-stop   { color: var(--cv-amber); }

.cv-thought {
  font-size: 11px; color: var(--cv-fg-faint);
  margin: 4px 0;
}
.cv-thought summary {
  cursor: pointer; list-style: none; letter-spacing: 0.06em;
}
.cv-thought summary::-webkit-details-marker { display: none; }
.cv-thought summary:hover { color: var(--cv-cyan); }
.cv-thought-text {
  margin: 6px 0; padding: 8px 10px;
  background: rgba(0, 0, 0, 0.45);
  border-left: 1px solid var(--cv-line-bright);
  font: 11px/1.5 var(--cv-mono);
  color: var(--cv-fg-dim);
  max-height: 280px; overflow: auto;
  white-space: pre-wrap;
}

.cv-tool {
  margin: 6px 0;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--cv-line);
  font-size: 11px;
  transition: border-color 140ms;
}
.cv-tool:hover { border-color: var(--cv-line-bright); }
.cv-tool[open] { border-color: var(--cv-phos); }
.cv-tool > summary {
  list-style: none; cursor: pointer; user-select: none;
  padding: 5px 10px;
  display: flex; align-items: baseline; gap: 6px;
  font-family: var(--cv-mono);
  white-space: nowrap; overflow: hidden;
}
.cv-tool > summary::-webkit-details-marker { display: none; }
.cv-tool-bracket, .cv-tool-bracket-close { color: var(--cv-fg-faint); }
.cv-tool-glyph { color: var(--cv-phos); text-shadow: 0 0 6px var(--cv-phos-glow); }
.cv-tool-name { color: var(--cv-fg); font-weight: 600; }
.cv-tool-arrow { color: var(--cv-fg-faint); }
.cv-tool-args {
  color: var(--cv-fg-dim);
  overflow: hidden; text-overflow: ellipsis;
  flex: 1; font-size: 11px;
}
.cv-tool-result .cv-tool-glyph { color: var(--cv-amber); text-shadow: 0 0 6px var(--cv-amber-glow); }
.cv-tool-result .cv-tool-name  { color: var(--cv-amber); }
.cv-tool-error { border-color: var(--cv-danger); }
.cv-tool-error .cv-tool-glyph,
.cv-tool-error .cv-tool-name { color: var(--cv-danger); text-shadow: 0 0 6px var(--cv-danger); }
.cv-tool-input, .cv-tool-output {
  margin: 0; padding: 8px 12px;
  background: #000;
  border-top: 1px solid var(--cv-line);
  font: 11px/1.5 var(--cv-mono);
  color: var(--cv-fg);
  white-space: pre-wrap; word-wrap: break-word;
  max-height: 360px; overflow: auto;
}
.cv-toolresult-frame {
  grid-template-columns: 28px 1fr;
  padding-top: 2px; padding-bottom: 2px;
  --cv-glyph: '↳';
  --cv-glyph-color: var(--cv-amber);
  border-left-color: var(--cv-amber);
  background: linear-gradient(90deg,
    color-mix(in srgb, var(--cv-amber) 3%, transparent), transparent 30%);
}

.cv-perm {
  position: relative;
  margin: 12px 18px 12px 30px;
  padding: 14px 14px 12px;
  background: linear-gradient(180deg,
    color-mix(in srgb, var(--cv-amber) 10%, var(--cv-bg)) 0%,
    color-mix(in srgb, var(--cv-amber) 3%, var(--cv-bg)) 100%);
  border: 1px solid var(--cv-amber);
  box-shadow:
    inset 0 0 20px color-mix(in srgb, var(--cv-amber) 8%, transparent),
    0 0 24px color-mix(in srgb, var(--cv-amber) 10%, transparent);
  animation: cv-perm-arrive 320ms cubic-bezier(0.2, 0.6, 0.2, 1);
}
.cv-perm-badge {
  position: absolute; top: -1px; left: 12px;
  transform: translateY(-50%);
  background: var(--cv-bg);
  padding: 0 8px;
  font-size: 9px; line-height: 1; letter-spacing: 0.2em;
  color: var(--cv-amber);
  text-shadow: 0 0 8px var(--cv-amber-glow);
  font-weight: 600;
}
.cv-perm-context {
  margin: 0 0 12px; padding: 8px 10px;
  background: rgba(0, 0, 0, 0.5);
  border-left: 2px solid var(--cv-amber);
  font: 11px/1.5 var(--cv-mono);
  color: var(--cv-fg);
  max-height: 200px; overflow: auto;
  white-space: pre-wrap;
}
.cv-perm-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.cv-perm-btn {
  display: inline-flex; align-items: baseline; gap: 6px;
  padding: 6px 12px;
  background: transparent;
  border: 1px solid var(--cv-fg-faint);
  color: var(--cv-fg);
  font: 11px/1 var(--cv-mono);
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: all 140ms;
}
.cv-perm-btn:hover { border-color: var(--cv-fg); color: var(--cv-cyan); }
.cv-perm-num { color: var(--cv-fg-faint); font-weight: 600; }
.cv-perm-label { font-weight: 600; }
.cv-perm-allow { border-color: var(--cv-phos); color: var(--cv-phos); }
.cv-perm-allow:hover { background: var(--cv-phos); color: var(--cv-bg); }
.cv-perm-allow .cv-perm-num { color: var(--cv-phos); }
.cv-perm-deny { border-color: var(--cv-danger); color: var(--cv-danger); }
.cv-perm-deny:hover { background: var(--cv-danger); color: var(--cv-bg); }
.cv-perm-deny .cv-perm-num { color: var(--cv-danger); }
@keyframes cv-perm-arrive {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.cv-compact {
  display: grid; grid-template-columns: 1fr auto 1fr;
  gap: 12px; align-items: center;
  padding: 18px 18px 14px;
  color: var(--cv-fg-faint);
  font-size: 9px; letter-spacing: 0.18em;
  text-transform: lowercase;
}
.cv-compact-line {
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--cv-line-bright), transparent);
}
.cv-compact-label { display: inline-flex; gap: 6px; align-items: center; }
.cv-compact-glyph {
  color: var(--cv-phos);
  text-shadow: 0 0 8px var(--cv-phos-glow);
}

.cv-lifecycle {
  display: flex; gap: 8px; align-items: baseline;
  padding: 6px 18px 6px 30px;
  font-size: 10px; letter-spacing: 0.12em;
  color: var(--cv-fg-faint);
  text-transform: lowercase;
}
.cv-lifecycle-glyph { font-size: 11px; }
.cv-lifecycle-ready .cv-lifecycle-glyph {
  color: var(--cv-phos); text-shadow: 0 0 8px var(--cv-phos-glow);
}
.cv-lifecycle-exit  { color: var(--cv-fg-dim); }
.cv-lifecycle-exit .cv-lifecycle-glyph { color: var(--cv-fg-dim); }
.cv-lifecycle-crash { color: var(--cv-danger); }
.cv-lifecycle-crash .cv-lifecycle-glyph {
  color: var(--cv-danger); text-shadow: 0 0 8px var(--cv-danger);
}

.cv-msg.cv-pending {
  opacity: 0.72;
  border-left-style: dashed;
}
.cv-msg.cv-pending .cv-text { color: var(--cv-fg-dim); }
.cv-pending-tag {
  display: inline-block;
  margin-left: 8px;
  font-size: 9px; letter-spacing: 0.18em;
  color: var(--cv-fg-faint);
  text-transform: uppercase;
  animation: cv-pending-blink 1.6s ease-in-out infinite;
}
.cv-msg.cv-pending-stale {
  border-left-color: var(--cv-amber);
  opacity: 0.85;
}
.cv-msg.cv-pending-stale .cv-pending-tag {
  color: var(--cv-amber);
  animation: none;
}
@keyframes cv-pending-blink {
  0%, 100% { opacity: 0.35; }
  50% { opacity: 1; }
}

.cv-thinking {
  display: flex; gap: 8px; align-items: center;
  padding: 10px 18px 10px 30px;
  font: 10px/1 var(--cv-mono);
  color: var(--cv-fg-dim);
  letter-spacing: 0.08em;
}
.cv-thinking-glyph {
  color: var(--cv-phos);
  text-shadow: 0 0 8px var(--cv-phos-glow);
  animation: cv-thinking-rotate 3s linear infinite;
}
@keyframes cv-thinking-rotate {
  0%, 100% { transform: rotate(0); }
  50% { transform: rotate(180deg); }
}
.cv-thinking-dots { display: inline-flex; gap: 4px; padding: 1px 0; }
.cv-thinking-dots span {
  width: 4px; height: 4px; border-radius: 50%;
  background: var(--cv-phos);
  box-shadow: 0 0 6px var(--cv-phos-glow);
  animation: cv-pulse 1.2s ease-in-out infinite;
}
.cv-thinking-dots span:nth-child(2) { animation-delay: 0.16s; }
.cv-thinking-dots span:nth-child(3) { animation-delay: 0.32s; }
@keyframes cv-pulse {
  0%, 60%, 100% { opacity: 0.25; transform: scale(0.7); }
  30% { opacity: 1; transform: scale(1.15); }
}
.cv-thinking-timer {
  margin-left: auto;
  color: var(--cv-fg-faint);
  font-variant-numeric: tabular-nums;
}

.cv-empty {
  padding: 60px 24px;
  text-align: center;
  color: var(--cv-fg-faint);
  font-family: var(--cv-mono);
}
.cv-empty-glyph {
  font-size: 28px;
  color: var(--cv-phos);
  text-shadow: 0 0 18px var(--cv-phos-glow);
  margin-bottom: 12px;
  animation: cv-breathing 3.2s ease-in-out infinite;
}
.cv-empty-title {
  font-size: 11px; letter-spacing: 0.4em;
  color: var(--cv-fg);
  text-transform: uppercase;
}
.cv-empty-sub {
  margin-top: 6px;
  font-size: 10px; letter-spacing: 0.1em;
  color: var(--cv-fg-faint);
}

.cv-status {
  position: relative; z-index: 3;
  display: flex; gap: 10px; align-items: center;
  padding: 6px 14px;
  border-top: 1px solid var(--cv-line);
  background: var(--cv-bg);
  font: 9px/1.4 var(--cv-mono);
  color: var(--cv-fg-faint);
  letter-spacing: 0.15em;
  text-transform: uppercase;
}
.cv-status-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--cv-fg-faint);
}
.cv-status[data-state="live"] .cv-status-dot {
  background: var(--cv-phos);
  box-shadow: 0 0 8px var(--cv-phos-glow);
  animation: cv-breathing 2.4s ease-in-out infinite;
}
.cv-status[data-state="loading"] .cv-status-dot {
  background: var(--cv-amber);
  box-shadow: 0 0 8px var(--cv-amber-glow);
  animation: cv-breathing 1.4s ease-in-out infinite;
}
.cv-status[data-state="exited"] .cv-status-dot { background: var(--cv-fg-faint); }
.cv-status[data-state="live"] .cv-status-label {
  color: var(--cv-phos); text-shadow: 0 0 4px var(--cv-phos-glow);
}
.cv-status[data-state="loading"] .cv-status-label { color: var(--cv-amber); }
@keyframes cv-breathing {
  0%, 100% { opacity: 0.55; transform: scale(0.85); }
  50% { opacity: 1; transform: scale(1.15); }
}

/* vt-0438 round 3: composer styling now consumes the app theme vars
   (--bg, --text, --line, --accent, --font-mono) so it matches every
   other input on the site (.gd-body input, group/role modals, etc).
   The phosphor-terminal aesthetic stays in the message area; the
   input field reads as a normal site input. Theme switching (dark /
   light / solarized / nord) carries through automatically. */

.cv-composer {
  position: relative; z-index: 3;
  padding: 10px 14px 12px;
  background: var(--bg);
  border-top: 1px solid var(--line);
}
.cv-composer-busy {
  border-top-color: var(--magenta, var(--accent));
}

.cv-composer-frame {
  position: relative;
  /* vt-0990: composer was a single flex ROW (glyph · textarea · action
     buttons) so the textarea shared its line with esc/stop/send and ended
     up cramped (its placeholder wrapped to 3 lines). Allow wrapping and
     force the textarea to claim the full first row; the action buttons then
     drop to their own row underneath, giving the textarea full width. */
  display: flex; flex-wrap: wrap; align-items: flex-start;
  background: var(--bg);
  border: 1px solid var(--line);
  transition: border-color 140ms, box-shadow 140ms;
}
.cv-composer-frame:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 35%, transparent);
}
.cv-composer-busy .cv-composer-frame {
  border-color: var(--magenta, var(--accent));
}
.cv-composer-frame::before,
.cv-composer-frame::after { content: none; }  /* legacy corner brackets off */

.cv-prompt-glyph {
  flex: 0 0 auto;
  padding: 8px 10px 8px 12px;
  color: var(--text-dim);
  font: .9em/1.4 var(--font-mono);
  user-select: none;
  pointer-events: none;
  transition: color 140ms;
}
.cv-composer-frame:focus-within .cv-prompt-glyph { color: var(--accent); }
.cv-composer-busy .cv-prompt-glyph { color: var(--magenta, var(--accent)); }

.cv-composer-input {
  /* vt-0990: full-width composer textarea. flex-basis:0 + flex-grow keeps it
     filling the row next to the glyph; min-height bumped so the empty
     composer is a comfortable multi-line box instead of a 1-line sliver. */
  flex: 1 1 0; min-width: 0;
  background: transparent;
  color: var(--text);
  border: 0; outline: 0; resize: vertical;
  padding: 10px 12px 10px 0;
  min-height: 56px; max-height: 240px;
  font: .9em/1.5 var(--font-mono);
  caret-color: var(--accent);
}
.cv-composer-input::placeholder {
  color: var(--text-faint);
  font-style: italic;
}
.cv-composer-input:disabled { opacity: 0.45; cursor: not-allowed; }

/* vt-0438 r3: actions row uses app theme — same look as btn-ghost
   buttons elsewhere on the site. */
.cv-composer-actions {
  /* vt-0990: actions drop to their own full-width row below the textarea
     (flex-wrap on the frame). Right-align so esc/stop/send sit at the
     bottom-right of the composer. */
  flex: 1 1 100%;
  display: flex; gap: 6px; align-items: center; justify-content: flex-end;
  padding: 6px 0 2px 0;
}
.cv-action-btn {
  background: transparent;
  color: var(--text-dim);
  border: 1px solid var(--line);
  padding: .35em .75em;
  font: .8em/1 var(--font-mono);
  letter-spacing: .08em; text-transform: lowercase;
  cursor: pointer;
  transition: color 140ms, border-color 140ms, background 140ms;
}
.cv-action-btn:hover:not(:disabled) {
  color: var(--text);
  border-color: var(--text-dim);
}
.cv-action-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.cv-action-send {
  color: var(--accent);
  border-color: var(--accent);
  margin-left: auto;
  font-weight: 600;
}
.cv-action-send:hover:not(:disabled) {
  background: color-mix(in srgb, var(--accent) 14%, transparent);
}
.cv-action-stop:hover { color: var(--magenta, var(--accent)); border-color: var(--magenta, var(--accent)); }
.cv-action-cancel:hover { color: var(--text); }

.cv-fresh {
  animation: cv-msg-arrive 380ms cubic-bezier(0.2, 0.6, 0.2, 1);
}
@keyframes cv-msg-arrive {
  from {
    opacity: 0;
    transform: translateY(6px);
    filter: brightness(1.35) saturate(1.15);
  }
  to {
    opacity: 1;
    transform: translateY(0);
    filter: brightness(1) saturate(1);
  }
}
.cv-text.cv-cascading .cv-w {
  display: inline-block; opacity: 0;
  animation: cv-word-fade 220ms cubic-bezier(0.2, 0.7, 0.2, 1) forwards;
  animation-delay: calc(var(--i, 0) * 28ms);
}
@keyframes cv-word-fade { to { opacity: 1; } }

@media (prefers-reduced-motion: reduce) {
  .cv-scanlines, .cv-fresh, .cv-thinking-glyph, .cv-empty-glyph,
  .cv-status-dot, .cv-pending-tag, .cv-thinking-dots span { animation: none; }
  .cv-text.cv-cascading .cv-w { opacity: 1; animation: none; }
}

.viewer-raw-toggle {
  display: inline-flex; align-items: center; gap: 6px;
  background: transparent;
  border: 1px solid var(--cv-line-bright, #2a2a32);
  color: var(--cv-fg-dim, #8c867d);
  padding: 5px 10px;
  font: 10px/1 var(--cv-mono, "JetBrains Mono", monospace);
  letter-spacing: 0.12em; text-transform: lowercase;
  cursor: pointer;
  transition: all 140ms;
}
.viewer-raw-toggle:hover {
  border-color: var(--cv-phos, #5cf08c);
  color: var(--cv-phos, #5cf08c);
  text-shadow: 0 0 6px var(--cv-phos-glow, rgba(92, 240, 140, 0.4));
}
.viewer-raw-toggle[aria-pressed="true"] {
  border-color: var(--cv-phos, #5cf08c);
  background: color-mix(in srgb, var(--cv-phos, #5cf08c) 8%, transparent);
  color: var(--cv-phos, #5cf08c);
}
.viewer-raw-toggle .icon { font-size: 11px; }

/* vt-0398: slash-command autocomplete */
.cv-slash-dropdown {
  position: absolute;
  bottom: calc(100% + 4px); left: 12px; right: 12px;
  max-height: 220px; overflow-y: auto;
  background: var(--cv-bg-soft);
  border: 1px solid var(--cv-phos);
  box-shadow: 0 0 24px -8px var(--cv-phos-glow);
  z-index: 50;
  font: 11px/1 var(--cv-mono);
}
.cv-composer { position: relative; }
.cv-slash-item {
  display: flex; gap: 12px; align-items: baseline;
  padding: 5px 10px;
  cursor: pointer;
  color: var(--cv-fg);
  border-bottom: 1px solid var(--cv-line);
}
.cv-slash-item:last-child { border-bottom: 0; }
.cv-slash-item:hover, .cv-slash-active {
  background: color-mix(in srgb, var(--cv-phos) 12%, transparent);
  color: var(--cv-phos);
}
.cv-slash-name {
  font-weight: 600; color: var(--cv-phos);
  text-shadow: 0 0 6px var(--cv-phos-glow);
  min-width: 12ch;
}
.cv-slash-active .cv-slash-name { color: var(--cv-bg); text-shadow: none; background: var(--cv-phos); padding: 0 4px; }
.cv-slash-desc {
  color: var(--cv-fg-dim); font-size: 10px;
  flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* vt-1092: portal .app-term frame wrapping the live chat-view. Preserves the
 * existing fill chain (.viewer-body flex column → frame fills → #chat-view fills
 * → .cv-root height:100%). The static-transcript sibling keeps its own layout. */
.viewer-body > .app-term { flex: 1; min-height: 0; margin: var(--space-3, 12px); }
.viewer-body > .app-term > #chat-view { flex: 1; min-height: 0; height: 100%; }
