/* ═══════════════════════════════════════════════════════════════════════
   NEXUS Chat — Stage C
   
   Full-screen chat view that takes over when user taps "Ask NEXUS" on the
   home dashboard. Replaces the old bottom-drawer chat-hud.
   
   Design: uses the existing NEXUS brand fonts throughout — Outfit for
   display, DM Sans for body, JetBrains Mono for sender labels and
   metadata. No outside serif. The editorial feel comes from typography
   hierarchy, hairline rules, and generous vertical rhythm — not from
   a typeface that would clash with the rest of the app.
   ═══════════════════════════════════════════════════════════════════════ */

/* ─── View shell — FULL TAKEOVER (v283) ───────────────────────────
   Alfredo, 2026-07-12: "allow the window to fully take over the
   screen." The sheet-below-the-masthead treatment is retired: when
   Ask NEXUS opens it owns the whole viewport. Home remains the
   landing view — this is only what happens once you enter chat. */
.chatview {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  /* Pin chatview height to the dynamic viewport so it tracks keyboard
     state correctly. Without this, on mobile Chrome when the keyboard
     opens, the layout viewport stays full-height while the visual
     viewport shrinks — the chatview's top edge ends up above the
     visible area, hiding the cv-top toolbar. dvh tracks the live
     visible viewport, so cv-top stays put. Fallback to vh for older
     browsers. */
  height: 100vh;
  height: 100dvh;
  z-index: 200;               /* above masthead + bottom-nav — a true takeover */
  background: var(--bg);
  display: flex;
  flex-direction: column;
  color: var(--text);
  font-family: 'DM Sans', system-ui, sans-serif;
  overflow: hidden;
  transform: translateY(100%);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.32s cubic-bezier(0.2, 0.75, 0.2, 1),
              opacity 0.2s ease-out;
}
.chatview.open {
  transform: translateY(0);
  opacity: 1;
  pointer-events: auto;
}

/* Hide the legacy chat-hud while the new chat view is open */
body.chatview-open .chat-hud { display: none !important; }

/* v283 — the ☰ sections toggle (next to history, left side): one tap
   tucks every section away (voice chips, house chips, the gods' pinned
   words, Orion's strip) so the conversation owns the whole screen; tap
   again to bring them back and switch voices. Persists per device. */
.chatview.cv-hide-sections .cv-who,
.chatview.cv-hide-sections .cv-house,
.chatview.cv-hide-sections .cv-god-strip,
.chatview.cv-hide-sections .cv-orion-strip { display: none !important; }
#cvSections.is-on { color: var(--nx-gold, #d4a44e); }

/* Lock scroll while chat is open. Without this, mobile Chrome's
   "scroll input into view on focus" reflex pushes the page up to
   bring the input center-of-screen — taking the masthead and chat
   top bar out of the visible area when the keyboard opens.
   Just `overflow: hidden` (NOT `position: fixed`) preserves the
   positioning context for absolute-positioned descendants like
   .cv-input-wrap. Earlier attempts using position:fixed broke the
   input's bottom anchor on Android Chrome. */
body.chatview-open {
  overflow: hidden;
}

/* ─── Top bar — 52px, editorial and quiet ────────────────────────── */
.cv-top {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 14px;
  height: 52px;
  flex-shrink: 0;
  border-bottom: 1px solid var(--nx-gold-mist);
  background: var(--bg);
  position: relative;
  z-index: 2;
}
.cv-back,
.cv-icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 16px;
  border: none;
  background: transparent;
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.15s, color 0.15s;
}
.cv-back:active, .cv-icon-btn:active {
  background: var(--nx-gold-faint);
  color: var(--accent);
}
.cv-back svg,
.cv-icon-btn svg {
  width: 20px;
  height: 20px;
  stroke-width: 1.75;
}

/* Top-bar spacer — fills the gap between the back arrow on the left
   and the clock icon on the right. The center used to hold the NEXUS
   brand area; now the masthead at the top of the screen carries that
   identity, so the chat top bar can be deliberately spare. */
.cv-top-spacer {
  flex: 1;
}
/* Phase 1 — small persona marker just right of the back button. Tells
   the user at a glance whether they're talking to Providentia or
   Trajan. Color stays neutral gold; persona switching is the gesture
   of the masthead coin, not this label. */
.cv-persona-name {
  font-family: var(--font-display, 'Outfit'), sans-serif;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  opacity: 0.78;
  padding: 2px 8px 2px 4px;
  white-space: nowrap;
  /* Subtle tone shift so each persona reads slightly differently
     without becoming a button. Trajan a touch warmer/brassier;
     Providentia a touch cooler/paler. */
}
.cv-persona-name[data-persona="trajan"] {
  color: #e6b157;
}
.cv-persona-name[data-persona="providentia"] {
  color: #d6b380;
}
.cv-brand {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.cv-brand-mark {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 5px;
  color: var(--accent);
}
.cv-brand-galaxy {
  width: 18px;
  height: 18px;
}
.cv-brand-galaxy canvas {
  display: block;
  border-radius: 50%;
}

/* ─── Transcript container ───────────────────────────────────────── */
.cv-transcript {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding: 28px 20px calc(160px + env(safe-area-inset-bottom));    /* leaves room above input pill, accounting for iPhone home indicator */
  scroll-behavior: smooth;
  /* Constrain line length on tablets/desktop */
  display: flex;
  flex-direction: column;
}
.cv-transcript::-webkit-scrollbar { display: none; }
.cv-transcript-inner {
  width: 100%;
  max-width: 640px;
  margin: 0 auto;
}

/* ─── Day divider — thin rule with small-cap label ──────────────── */
.cv-day {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 16px 0 28px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 9.5px;
  letter-spacing: 2px;
  color: var(--faint);
  text-transform: uppercase;
}
.cv-day::before, .cv-day::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--nx-gold-mist);
}
.cv-day:first-child { margin-top: 0; }

/* ─── Message turn — sender label + body, no bubble ─────────────── */
.cv-turn {
  margin-bottom: 26px;
  animation: cvTurnIn 0.28s cubic-bezier(0.3, 0.7, 0.2, 1);
}
@keyframes cvTurnIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.cv-turn-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 9.5px;
  font-weight: 500;
  letter-spacing: 2.2px;
  color: var(--faint);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
  text-transform: uppercase;
}
.cv-turn-label-name {
  color: var(--muted);
}
.cv-turn.is-user .cv-turn-label-name {
  color: var(--accent);
}
.cv-turn-time {
  color: var(--faint);
  opacity: 0.6;
}
.cv-turn-body {
  font-size: 15.5px;
  line-height: 1.65;
  color: var(--text);
  white-space: pre-wrap;
  word-wrap: break-word;
  letter-spacing: 0.05px;
}
/* User turns are visually identical but their label color distinguishes */
.cv-turn.is-user .cv-turn-body {
  color: var(--text);
}

/* Thinking state — assistant is still working */
.cv-turn.is-thinking .cv-turn-body {
  color: var(--faint);
  font-style: italic;
}
.cv-thinking-dots {
  display: inline-flex;
  gap: 4px;
  margin-left: 8px;
  vertical-align: middle;
}
.cv-thinking-dots span {
  width: 4px; height: 4px;
  border-radius: 50%;
  background: var(--accent);
  opacity: 0.4;
  animation: cvDot 1.2s ease-in-out infinite;
}
.cv-thinking-dots span:nth-child(2) { animation-delay: 0.15s; }
.cv-thinking-dots span:nth-child(3) { animation-delay: 0.3s; }
@keyframes cvDot {
  0%, 100% { opacity: 0.2; transform: translateY(0); }
  50%      { opacity: 1;   transform: translateY(-2px); }
}

/* Tool note — tiny reasoning trail line */
.cv-tool-note {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.8px;
  color: var(--faint);
  margin: -14px 0 18px;
  opacity: 0.65;
  padding-left: 2px;
}

/* Inline action chips — "Yes call them" / "No just log it" */
.cv-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}
.cv-action-chip {
  padding: 9px 14px;
  border-radius: 2px;
  border: 1px solid var(--nx-gold-aura);
  background: transparent;
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.2px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
}
.cv-action-chip:hover  { border-color: var(--accent); color: var(--accent); }
.cv-action-chip:active { transform: scale(0.97); }
.cv-action-chip.is-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #101626;
  font-weight: 600;
}

/* Inline data cards — equipment, tickets, contacts */
.cv-inline-card {
  margin-top: 14px;
  padding: 14px 16px;
  border: 1px solid var(--nx-gold-soft);
  border-radius: 2px;
  background: var(--nx-gold-tint);
}
.cv-inline-card-kicker {
  font-family: 'JetBrains Mono', monospace;
  font-size: 9.5px;
  font-weight: 500;
  letter-spacing: 2px;
  color: var(--accent);
  text-transform: uppercase;
  margin-bottom: 6px;
}
.cv-inline-card-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
}
.cv-inline-card-meta {
  font-size: 12.5px;
  color: var(--muted);
  letter-spacing: 0.2px;
}

/* ─── Empty state — calm, generous, AI-interface inspired ────────
   Replaces the old hairline-rectangle prompt grid with the
   .nx-prompt design-system primitive: big tappable cards, soft
   shadows, generous spacing. Modeled after Claude.ai/ChatGPT empty
   states but in NEXUS gold language. */
.cv-empty {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 100%;
  padding-top: var(--nx-space-5);
}

/* Ambient gradient — subtle gold wash at top so screen isn't a flat void */
.cv-empty-ambient {
  position: absolute;
  top: -40px;
  left: -40px;
  right: -40px;
  height: 280px;
  pointer-events: none;
  background:
    radial-gradient(ellipse at 60% 20%, var(--nx-gold-mist) 0%, transparent 60%),
    radial-gradient(ellipse at 20% 0%, var(--nx-gold-tint) 0%, transparent 55%);
  z-index: 0;
}
.cv-empty-inner {
  position: relative;
  z-index: 1;
  padding-bottom: var(--nx-space-5);
}

/* Eyebrow above the lede — small monospace caption */
.cv-empty-eyebrow {
  font-family: var(--nx-font-mono);
  font-size: var(--nx-text-xs);
  letter-spacing: 2px;
  color: var(--nx-faint);
  text-transform: uppercase;
  margin-bottom: var(--nx-space-3);
}

/* Hero lede — "Morning, Alfredo. What do you need?" */
.cv-empty-h {
  font-family: var(--nx-font-display);
  font-weight: 300;
  font-size: clamp(36px, 9vw, 52px);
  line-height: 1.05;
  color: var(--nx-text);
  letter-spacing: -0.025em;
  margin-bottom: var(--nx-space-5);
}
.cv-empty-h em {
  color: var(--nx-gold);
  font-style: normal;
  font-weight: 400;
  letter-spacing: -0.03em;
}

/* Situation line — one-sentence "what's happening" status */
.cv-empty-situation {
  font-size: var(--nx-text-md);
  line-height: 1.55;
  color: var(--nx-muted);
  margin-bottom: var(--nx-space-9);
  max-width: 44ch;
  letter-spacing: 0.05px;
}
.cv-empty-situation strong {
  color: var(--nx-gold);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

/* Section labels above prompt grids and recents — same hierarchy as
   .nx-section but inline-feel since they're inside the empty state */
.cv-empty-section-label {
  font-family: var(--nx-font-display);
  font-size: var(--nx-text-md);
  font-weight: 500;
  letter-spacing: -0.005em;
  color: var(--nx-text);
  margin: 0 0 var(--nx-space-4);
}
.cv-empty-section-label:first-of-type { margin-top: 0; }

/* Prompts grid — single column on phones (more vertical room per card)
   2 columns on wider screens. Spacing is generous; the cards themselves
   are the focus. */
.cv-empty-prompts {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--nx-space-3);
  margin-bottom: var(--nx-space-9);
}
@media (min-width: 520px) {
  .cv-empty-prompts {
    grid-template-columns: 1fr 1fr;
    gap: var(--nx-space-3);
  }
}

/* Each prompt card uses the .nx-prompt primitive language. */
.cv-prompt {
  display: flex;
  flex-direction: column;
  gap: var(--nx-space-2);
  padding: var(--nx-space-5);
  min-height: 92px;
  background: var(--nx-surface-1);
  border: 1px solid var(--nx-highlight-faint);
  border-radius: var(--nx-radius-card);
  color: var(--nx-text);
  font-family: var(--nx-font-body);
  text-align: left;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition:
    background var(--nx-press),
    border-color var(--nx-press),
    transform var(--nx-press),
    box-shadow var(--nx-press);
  box-shadow: var(--nx-shadow-soft);
  width: 100%;
}
.cv-prompt:hover {
  background: var(--nx-surface-3);
  border-color: var(--nx-gold-line);
  transform: translateY(-1px);
}
.cv-prompt:active {
  transform: translateY(0) scale(0.99);
  border-color: var(--nx-gold-line-2);
  background: var(--nx-surface-3);
}
.cv-prompt-kicker {
  font-family: var(--nx-font-mono);
  font-size: var(--nx-text-xs);
  font-weight: 600;
  letter-spacing: 1.6px;
  color: var(--nx-gold);
  text-transform: uppercase;
}
.cv-prompt-text {
  font-size: var(--nx-text-md);
  line-height: 1.4;
  color: var(--nx-text);
  font-weight: 400;
  letter-spacing: 0.05px;
}

/* Skeleton placeholder while prompts populate */
.cv-prompt-skeleton {
  min-height: 92px;
  background: var(--nx-surface-1);
  border-radius: var(--nx-radius-card);
  animation: cvPromptShimmer 2s ease-in-out infinite;
}
@keyframes cvPromptShimmer {
  0%, 100% { opacity: 0.4; }
  50%      { opacity: 0.7; }
}

/* Recents — last few conversations as a quiet list. Single row each,
   no card chrome. Date on left, title on right. */
.cv-empty-recents-wrap {
  margin-top: var(--nx-space-7);
}
.cv-empty-recents {
  display: flex;
  flex-direction: column;
  gap: 0;
}
.cv-recent {
  display: flex;
  align-items: center;
  gap: var(--nx-space-4);
  padding: var(--nx-space-3) 0;
  min-height: var(--nx-touch-min);
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--nx-gold-faint);
  color: var(--nx-muted);
  cursor: pointer;
  font-family: inherit;
  text-align: left;
  -webkit-tap-highlight-color: transparent;
  transition: color var(--nx-press), padding-left var(--nx-press);
  width: 100%;
}
.cv-recent:last-child { border-bottom: none; }
.cv-recent:hover {
  color: var(--nx-text);
  padding-left: var(--nx-space-2);
}
.cv-recent:active { transform: scale(0.99); }
.cv-recent-time {
  flex-shrink: 0;
  font-family: var(--nx-font-mono);
  font-size: var(--nx-text-xs);
  letter-spacing: 1px;
  color: var(--nx-faint);
  width: 64px;
}
.cv-recent-title {
  flex: 1;
  min-width: 0;
  font-size: var(--nx-text-base);
  color: var(--nx-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 400;
}
.cv-recent:hover .cv-recent-title { color: var(--nx-gold); }


/* ─── Input bar — pinned bottom, pill-language ──────────────────── 
   Replaces the hairline-rectangle frame with a pill-radius surface
   that matches the .nx-pill design language. Soft shadow lifts it
   off the background. The send button is the only thing that goes
   solid gold — that's the action, everything else is interface. */
.cv-input-wrap {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: var(--nx-space-4) var(--nx-space-4) calc(var(--nx-space-4) + env(safe-area-inset-bottom));
  background:
    linear-gradient(180deg, transparent 0%, var(--nx-bg) 35%);
  z-index: 3;
}
.cv-input-wrap-inner {
  max-width: 640px;
  margin: 0 auto;
  display: flex;
  align-items: flex-end;
  gap: var(--nx-space-2);
  padding: 8px 8px 8px 12px;
  border: 1px solid var(--nx-highlight-faint);
  border-radius: 28px;
  background: var(--nx-surface-3);
  box-shadow: var(--nx-shadow-card);
  transition: border-color var(--nx-press);
  position: relative;
}
.cv-input-wrap-inner:focus-within {
  border-color: var(--nx-gold-line-2);
}

/* Plus / attach button — quiet, secondary */
.cv-plus {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  border-radius: var(--nx-radius-pill);
  border: none;
  background: transparent;
  color: var(--nx-faint);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: color var(--nx-press), background var(--nx-press);
}
.cv-plus:active { background: var(--nx-gold-faint); color: var(--nx-gold); }
.cv-plus svg { width: 20px; height: 20px; stroke-width: 2; }
.cv-plus.is-open {
  color: var(--nx-gold);
  background: var(--nx-gold-faint);
}

/* Text input — clean, no chrome of its own */
.cv-input {
  flex: 1;
  min-height: 32px;
  max-height: 140px;
  padding: 10px 6px;
  border: none;
  background: transparent;
  color: var(--nx-text);
  font-family: var(--nx-font-body);
  font-size: var(--nx-text-base);
  line-height: 1.45;
  resize: none;
  outline: none;
  letter-spacing: 0.1px;
}
.cv-input::placeholder {
  color: var(--nx-faint);
  font-family: inherit;
  font-size: var(--nx-text-base);
  letter-spacing: 0.1px;
}

/* Send button — solid gold pill when active, faded when empty */
.cv-send {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  border-radius: var(--nx-radius-pill);
  border: none;
  background: linear-gradient(180deg, var(--nx-gold) 0%, var(--nx-gold-deep) 100%);
  color: var(--nx-gold-on);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: opacity var(--nx-press), transform var(--nx-press), background var(--nx-press);
  box-shadow: var(--nx-shadow-pill);
}
.cv-send:disabled {
  opacity: 0.35;
  cursor: default;
  background: var(--nx-surface-1);
  color: var(--nx-faint);
  box-shadow: none;
}
.cv-send:not(:disabled):active {
  transform: scale(0.94);
  background: linear-gradient(180deg, var(--nx-gold-deep) 0%, var(--nx-gold-darker) 100%);
}
.cv-send svg { width: 18px; height: 18px; stroke-width: 2; }

/* The inline .cv-mic button between textarea and send was removed —
   mic functionality lives in the plus (+) menu only. Old styles for
   .cv-mic / .cv-mic.is-listening / .cv-mic.is-recording deleted to
   keep the file lean. */

/* Mic recording state */
.cv-plus.recording {
  color: var(--nx-red);
  animation: cvRecPulse 1s ease-in-out infinite;
}
@keyframes cvRecPulse {
  0%, 100% { box-shadow: 0 0 0 0 var(--nx-red-line); }
  50%      { box-shadow: 0 0 0 6px rgba(212, 88, 88, 0); }
}

/* ─── Plus menu — popup above input ──────────────────────────────── */
.cv-plus-menu {
  position: absolute;
  left: 14px;
  bottom: calc(100% + 10px);
  background: var(--surface);
  border: 1px solid var(--nx-gold-aura);
  border-radius: 2px;
  padding: 6px;
  display: none;
  flex-direction: column;
  gap: 2px;
  min-width: 180px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.45);
  animation: cvMenuIn 0.15s ease-out;
}
.cv-plus-menu.is-open { display: flex; }
@keyframes cvMenuIn {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}
.cv-plus-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border: none;
  background: transparent;
  color: var(--muted);
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  letter-spacing: 0.1px;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.12s, color 0.12s;
  text-align: left;
  border-radius: 2px;
}
.cv-plus-item:hover  { background: var(--nx-gold-faint); color: var(--text); }
.cv-plus-item.active { color: var(--accent); }
.cv-plus-item svg { width: 16px; height: 16px; stroke-width: 1.8; flex-shrink: 0; }
.cv-plus-item-dot {
  margin-left: auto;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--accent);
  opacity: 0;
  transition: opacity 0.15s;
}
.cv-plus-item.active .cv-plus-item-dot { opacity: 1; }

/* ─── Conversations drawer — from left edge ─────────────────────── */
.cv-drawer-scrim {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 121;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}
.cv-drawer-scrim.is-open {
  opacity: 1;
  pointer-events: auto;
}
.cv-drawer {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: min(320px, 85vw);
  z-index: 122;
  background: var(--surface);
  border-right: 1px solid var(--nx-gold-mist);
  display: flex;
  flex-direction: column;
  transform: translateX(-100%);
  transition: transform 0.28s cubic-bezier(0.3, 0.75, 0.2, 1);
}
.cv-drawer.is-open { transform: translateX(0); }
.cv-drawer-header {
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--nx-gold-mist);
  flex-shrink: 0;
}
.cv-drawer-title {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  letter-spacing: 2.4px;
  color: var(--accent);
  text-transform: uppercase;
}
.cv-drawer-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
}
.cv-drawer-new {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border: none;
  background: transparent;
  color: var(--accent);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.2px;
  cursor: pointer;
  width: 100%;
  text-align: left;
  -webkit-tap-highlight-color: transparent;
  border-bottom: 1px solid var(--nx-gold-mist);
}
.cv-drawer-new svg { width: 16px; height: 16px; stroke-width: 2; }
.cv-drawer-item {
  display: block;
  padding: 12px 16px;
  border: none;
  background: transparent;
  color: var(--text);
  font-family: inherit;
  font-size: 13.5px;
  line-height: 1.4;
  cursor: pointer;
  width: 100%;
  text-align: left;
  -webkit-tap-highlight-color: transparent;
  border-left: 2px solid transparent;
  transition: background 0.12s, border-left-color 0.12s;
}
.cv-drawer-item:hover {
  background: var(--nx-gold-tint);
}
.cv-drawer-item.is-active {
  background: var(--nx-gold-faint);
  border-left-color: var(--accent);
}
.cv-drawer-item-title {
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  line-height: 1.35;
  margin-bottom: 4px;
}
.cv-drawer-item-meta {
  font-family: 'JetBrains Mono', monospace;
  font-size: 9.5px;
  color: var(--faint);
  letter-spacing: 1.2px;
  text-transform: uppercase;
}
/* Phase 1 — persona badge inside drawer row meta. Inline with the
   timestamp + msg count, separated by a · already supplied in the
   markup. ⌬ glyph picks up the same gold accent so it reads as a
   sigil rather than a UI control. */
.cv-drawer-item-persona {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 9.5px;
  letter-spacing: 1.2px;
}
.cv-drawer-item-persona.is-providentia { color: #d6b380; }
.cv-drawer-item-persona.is-trajan      { color: #e6b157; }
.cv-drawer-item-persona.is-legacy      { color: var(--faint); opacity: 0.55; }
.cv-drawer-empty {
  padding: 40px 20px;
  text-align: center;
  color: var(--faint);
  font-size: 12.5px;
  line-height: 1.5;
}

/* ─── Persona sheet — bottom sheet from tapping brand ───────────── */
.cv-persona-scrim {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 130;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}
.cv-persona-scrim.is-open {
  opacity: 1;
  pointer-events: auto;
}
.cv-persona-sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 131;
  background: var(--surface);
  border-top: 1px solid var(--nx-gold-aura);
  border-radius: 2px 2px 0 0;
  padding: 18px 20px calc(20px + env(safe-area-inset-bottom));
  max-width: 640px;
  margin: 0 auto;
  transform: translateY(100%);
  transition: transform 0.28s cubic-bezier(0.3, 0.75, 0.2, 1);
}
.cv-persona-sheet.is-open { transform: translateY(0); }
.cv-persona-grip {
  width: 36px; height: 3px;
  background: var(--nx-gold-aura);
  border-radius: 2px;
  margin: -6px auto 14px;
}
.cv-persona-h {
  font-family: 'Outfit', 'DM Sans', sans-serif;
  font-weight: 500;
  font-size: 20px;
  color: var(--text);
  margin: 0 0 4px;
  letter-spacing: -0.01em;
}
.cv-persona-sub {
  font-size: 12.5px;
  color: var(--muted);
  margin-bottom: 18px;
  letter-spacing: 0.1px;
}
.cv-persona-section-title {
  font-family: 'JetBrains Mono', monospace;
  font-size: 9.5px;
  letter-spacing: 2px;
  color: var(--faint);
  text-transform: uppercase;
  margin: 18px 0 10px;
}
.cv-persona-section-title:first-of-type { margin-top: 0; }
.cv-persona-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.cv-persona-opt {
  padding: 12px 14px;
  border-radius: 2px;
  border: 1px solid var(--nx-gold-soft);
  background: transparent;
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.2px;
  cursor: pointer;
  text-align: left;
  -webkit-tap-highlight-color: transparent;
  transition: all 0.15s;
}
.cv-persona-opt-label {
  font-weight: 600;
  display: block;
  margin-bottom: 2px;
}
.cv-persona-opt-desc {
  font-size: 11px;
  color: var(--muted);
  font-weight: 400;
  letter-spacing: 0.1px;
}
.cv-persona-opt.is-active {
  border-color: var(--accent);
  background: var(--nx-gold-faint);
}
.cv-persona-opt.is-active .cv-persona-opt-label {
  color: var(--accent);
}
.cv-persona-voices {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}
.cv-persona-voice {
  padding: 7px 12px;
  border-radius: 2px;
  border: 1px solid var(--nx-gold-soft);
  background: transparent;
  color: var(--muted);
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.8px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: all 0.15s;
}
.cv-persona-voice.is-active {
  background: var(--accent);
  border-color: var(--accent);
  color: #101626;
  font-weight: 600;
}
.cv-persona-close {
  display: block;
  width: 100%;
  padding: 13px;
  margin-top: 20px;
  border: 1px solid var(--nx-gold-aura);
  background: transparent;
  color: var(--muted);
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 500;
  letter-spacing: 0.3px;
  border-radius: 2px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

/* ═══════════════════════════════════════════════════════════════════════
   LEGACY BUBBLE REMAP — brain-chat.js's addB() still creates
   .chat-bubble.chat-user / .chat-bubble.chat-ai elements. Inside our new
   transcript container we re-style them as editorial turns instead of
   iMessage bubbles. One container, two visual languages live side by
   side: legacy HUD keeps bubbles, chat view gets the transcript look.
   ═══════════════════════════════════════════════════════════════════════ */
.chatview #chatMessages .chat-bubble {
  background: transparent !important;
  border-radius: 0 !important;
  padding: 0 !important;
  margin: 0 0 26px !important;
  max-width: none !important;
  width: 100%;
  font-size: 15.5px !important;
  line-height: 1.65 !important;
  color: var(--text) !important;
  white-space: pre-wrap;
  word-wrap: break-word;
  position: relative;
  padding-top: 22px !important;   /* room for synthesized sender label */
  letter-spacing: 0.05px;
  animation: cvTurnIn 0.28s cubic-bezier(0.3, 0.7, 0.2, 1);
}
/* Synthesize "YOU" / "NEXUS" labels from the bubble class. Using
   ::before means we never touch the DOM that brain-chat.js owns. */
.chatview #chatMessages .chat-bubble::before {
  position: absolute;
  top: 0;
  left: 0;
  font-family: 'JetBrains Mono', monospace;
  font-size: 9.5px;
  font-weight: 500;
  letter-spacing: 2.2px;
  text-transform: uppercase;
  color: var(--muted);
}
.chatview #chatMessages .chat-bubble.chat-user::before {
  content: 'YOU';
  color: var(--accent);
}
.chatview #chatMessages .chat-bubble.chat-ai::before {
  content: 'NEXUS';
  color: var(--muted);
}
.chatview #chatMessages .chat-bubble.chat-thinking {
  color: var(--faint) !important;
  font-style: italic !important;
}
.chatview #chatMessages .chat-bubble.chat-thinking::before {
  content: 'NEXUS';
  color: var(--faint);
}
/* Hide the inline timestamp — we put time in the label if needed */
.chatview #chatMessages .chat-time {
  display: block;
  margin-top: 6px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 9px;
  letter-spacing: 1.2px;
  color: var(--faint);
  opacity: 0.5;
  text-transform: uppercase;
}
/* Inline action buttons that brain-chat.js renders for compound actions */
.chatview #chatMessages .chat-actions {
  margin-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.chatview #chatMessages .chat-action-btn {
  background: transparent !important;
  border: 1px solid var(--nx-gold-aura) !important;
  border-radius: 2px !important;
  padding: 10px 14px !important;
  font-size: 13px !important;
  color: var(--text) !important;
  text-align: left;
  font-family: inherit;
  cursor: pointer;
  letter-spacing: 0.2px;
  transition: border-color 0.15s, color 0.15s;
}
.chatview #chatMessages .chat-action-btn:hover {
  border-color: var(--accent) !important;
  color: var(--accent) !important;
}
/* Typing indicator — transform into three-dot pulse above */
.chatview #chatMessages .chat-typing {
  padding: 22px 0 26px !important;
  background: none !important;
  position: relative;
}
.chatview #chatMessages .chat-typing::before {
  content: 'NEXUS';
  position: absolute;
  top: 0;
  left: 0;
  font-family: 'JetBrains Mono', monospace;
  font-size: 9.5px;
  font-weight: 500;
  letter-spacing: 2.2px;
  color: var(--faint);
  text-transform: uppercase;
}
.chatview #chatMessages .chat-typing span {
  display: inline-block;
  width: 5px; height: 5px;
  margin-right: 5px;
  border-radius: 50%;
  background: var(--accent);
  opacity: 0.4;
  animation: cvDot 1.2s ease-in-out infinite;
}
.chatview #chatMessages .chat-typing span:nth-child(2) { animation-delay: 0.15s; }
.chatview #chatMessages .chat-typing span:nth-child(3) { animation-delay: 0.3s; }
/* Confidence marker becomes a tiny tag next to the last line */
.chatview #chatMessages .chat-confidence {
  display: inline-block;
  margin-left: 8px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 9px;
  letter-spacing: 1px;
  text-transform: uppercase;
  vertical-align: middle;
  opacity: 0.7;
}
/* Reasoning tool trail */
.chatview #chatMessages .chat-tool-note {
  font-family: 'JetBrains Mono', monospace !important;
  font-size: 10px !important;
  letter-spacing: 0.8px !important;
  color: var(--faint) !important;
  margin: -18px 0 18px !important;
  padding-left: 2px !important;
  opacity: 0.65;
}

/* ─── Tiny screens safeguard ─────────────────────────────────────── */
@media (max-width: 360px) {
  .cv-transcript { padding: 22px 16px calc(150px + env(safe-area-inset-bottom)); }
  .cv-turn-body { font-size: 15px; }
  .cv-persona-grid { grid-template-columns: 1fr; }
}

/* ════════════════════════════════════════════════════════════════════
   v259 — WHO row: talk to NEXUS · Clippy · Orion ✶ · Trajan · Providentia
   (Alfredo moved Orion out of the home card and into Ask NEXUS.)
   ──────────────────────────────────────────────────────────────────── */
.cv-who {
  display: flex; gap: 6px; padding: 8px 14px 6px; overflow-x: auto;
  scrollbar-width: none; flex: 0 0 auto;
}
.cv-who::-webkit-scrollbar { display: none; }
.cv-who-chip {
  flex: 0 0 auto; padding: 6px 13px; border-radius: 999px; cursor: pointer;
  background: rgba(255,255,255,.04); border: 1px solid rgba(255,255,255,.10);
  color: var(--nx-muted, #9aa3b2);
  font-family: 'Outfit', 'DM Sans', system-ui, sans-serif; font-size: 12px; font-weight: 600;
  transition: all .15s; white-space: nowrap;
}
.cv-who-chip.is-active {
  background: rgba(212,164,78,.14); border-color: var(--nx-gold, #d4a44e);
  color: var(--nx-gold, #d4a44e);
}
/* Orion's living strip — his voice + latest trail, right inside the chat */
.cv-orion-strip {
  flex: 0 0 auto; margin: 0 14px 6px; padding: 9px 12px; border-radius: 12px;
  background: linear-gradient(160deg, rgba(22,32,60,.72), rgba(11,16,32,.72));
  border: 1px solid rgba(159,227,201,.18);
}
.cv-orion-line {
  font-family: 'Outfit', 'DM Sans', system-ui, sans-serif; font-size: 12px;
  color: rgba(232,238,252,.82); line-height: 1.5; padding: 1px 0;
}
.cv-orion-line.is-voice { color: #eef4ff; font-size: 13px; }
.cv-orion-line.is-dim { color: rgba(255,255,255,.38); font-size: 10.5px; letter-spacing: .03em; }

/* ── v278 THE PANTHEON — the chosen god's latest word, pinned. Gold for
   Trajan (the present), silver for Providentia (foresight) — the two faces
   of the NEXUS coin. ── */
.cv-god-strip {
  flex: 0 0 auto; margin: 0 14px 6px; padding: 9px 12px; border-radius: 12px;
  background: linear-gradient(160deg, rgba(22,32,60,.72), rgba(11,16,32,.72));
  border: 1px solid rgba(255,255,255,.14);
}
.cv-god-strip.is-trajan { border-color: rgba(212,164,78,.38); }
.cv-god-strip.is-providentia { border-color: rgba(196,204,216,.38); }
.cv-god-head {
  font-family: 'JetBrains Mono', ui-monospace, monospace; font-size: 10px;
  letter-spacing: .12em; text-transform: uppercase; margin-bottom: 4px;
}
.is-trajan .cv-god-head { color: #d4a44e; }
.is-providentia .cv-god-head { color: #c4ccd8; }
.cv-god-when { opacity: .55; text-transform: none; letter-spacing: .03em; margin-left: 6px; }
.cv-god-line {
  font-family: 'Outfit', 'DM Sans', system-ui, sans-serif; font-size: 12.5px;
  color: rgba(232,238,252,.88); line-height: 1.55; white-space: pre-wrap;
}
.cv-god-line.is-dim { color: rgba(255,255,255,.38); font-size: 10.5px; letter-spacing: .03em; }

/* ── WALK WITH ME (clippy-buddy) — house chips + the house brief bubble ── */
.cv-house {
  display: flex; align-items: center; gap: 6px;
  padding: 4px 14px 8px; flex-wrap: wrap;
}
.cv-house-label { font-size: 12px; opacity: .7; }
.cv-house-chip {
  background: rgba(255,255,255,.05); border: 1px solid rgba(255,255,255,.14);
  color: rgba(232,238,252,.85); border-radius: 999px; padding: 4px 12px;
  font-family: 'Outfit', 'DM Sans', system-ui, sans-serif; font-size: 12px;
  cursor: pointer; transition: all 140ms ease;
}
.cv-house-chip.is-walking {
  background: var(--nx-gold, #d4a44e); color: #1d1405;
  border-color: var(--nx-gold, #d4a44e); font-weight: 700;
}
.cv-house-chip:disabled { opacity: .5; }
.cv-buddy-brief {
  margin: 10px 14px; padding: 12px 14px; border-radius: 14px;
  background: rgba(212,164,78,.07); border: 1px solid rgba(212,164,78,.25);
}
.cv-bb-head {
  font-family: 'Outfit', 'DM Sans', system-ui, sans-serif;
  font-size: 13.5px; font-weight: 700; color: var(--nx-gold, #e9c88a);
  margin-bottom: 6px;
}
.cv-bb-sub { font-size: 12px; color: rgba(232,238,252,.75); margin-bottom: 8px; }
.cv-bb-line {
  display: flex; align-items: center; gap: 6px; width: 100%; text-align: left;
  background: rgba(255,255,255,.04); border: 1px solid rgba(255,255,255,.1);
  color: rgba(232,238,252,.9); border-radius: 10px; padding: 8px 10px;
  margin: 4px 0; font-size: 13px; cursor: pointer; line-height: 1.4;
}
.cv-bb-line:hover { border-color: var(--nx-gold, #d4a44e); }
.cv-bb-go { margin-left: auto; color: var(--nx-gold, #d4a44e); font-weight: 700; }
.cv-bb-note { font-size: 10.5px; color: rgba(255,255,255,.45); margin-top: 6px; font-style: italic; }
