/* DirtyMinds — Conversations module stylesheet
 *
 * Phase 1 (conversations-build-plan §Phase 1). The visual layer for the
 * standalone component js/conversations-ui.js. Visual SoT is the mockup
 * _Other/mockups/conversations-mockup.html — these classes are the BEM-lite
 * `conversation-*` re-expression of that mockup (CLAUDE.md CSS rules).
 *
 * Token discipline: every colour/space references a base.css token by name,
 * but always with a STANDALONE FALLBACK — `var(--color-bg, #0d0d0f)`. base.css
 * defines the exact tokens the mockup uses, so this sheet is correct inside the
 * app AND self-sufficient in the dev harness (which has no base.css). The two
 * marker colours the module owns (branch 🧵 / spin-off →) are not platform
 * tokens, so they're declared module-scoped on `.conversation` below.
 *
 * No release bump: this file is loaded only by the dev harness in Phase 1
 * (outside dist/, worker dark); it gets wired into the app in Phase 5.
 *
 * Dependencies: none (optionally layered over css/base.css in the app).
 */

/* ─── module-scoped tokens (branch / spin-off marker language) ─────── */
.conversation {
  --conv-branch:      #b574ff;
  --conv-branch-dim:  rgba(181, 116, 255, 0.16);
  --conv-spinoff:     #4cc9f0;
  --conv-spinoff-dim: rgba(76, 201, 240, 0.16);
  --conv-sel:         rgba(249, 115, 22, 0.30);   /* harvested-span highlight (Phase 2b) */

  display: flex;
  flex-direction: column;
  min-height: 0;
  height: 100%;
  position: relative;
  background: var(--color-bg, #0d0d0f);
  color: var(--color-text, #e8e6e0);
  font-family: var(--font-body, 'DM Sans', system-ui, -apple-system, sans-serif);
  -webkit-font-smoothing: antialiased;
}
.conversation *, .conversation *::before, .conversation *::after { box-sizing: border-box; }

/* ─── header (title + presence) ────────────────────────────────────── */
.conversation-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px 10px;
  border-bottom: 1px solid var(--color-border, #2a2a33);
  flex: 0 0 auto;
}
/* ‹ up-one-level — shown only when nested (Phase 2c) */
.conversation-header__back {
  flex: 0 0 auto;
  background: none; border: none;
  color: var(--color-text-muted, #888);
  font-size: 22px; line-height: 1; cursor: pointer;
  padding: 0 4px 0 0; margin-right: 2px;
}
.conversation-header__back:hover { color: var(--color-accent, #fb923c); }

.conversation-header__title { flex: 1; min-width: 0; }
.conversation-header__name {
  font-size: 15px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* collapsing breadcrumb (Phase 2c): root › … › parent › courant */
.conversation-header__crumbs {
  font-size: 10.5px;
  color: var(--color-text-muted, #888);
  margin-top: 2px;
  white-space: nowrap;
  overflow-x: auto;
  scrollbar-width: none;
}
.conversation-header__crumbs:empty { display: none; }
.conversation-header__crumbs::-webkit-scrollbar { height: 0; }
.conversation-crumb { cursor: pointer; }
.conversation-crumb:hover { color: var(--color-accent, #fb923c); }
.conversation-crumb--more { font-weight: 700; padding: 0 2px; }
.conversation-crumb__sep { color: var(--color-text-faint, #55555c); margin: 0 4px; }

/* path sheet — "…" opens the full level list (Phase 2c) */
.conversation-pathsheet-backdrop {
  position: absolute; inset: 0; z-index: 66;
  background: rgba(0, 0, 0, .45);
}
.conversation-pathsheet {
  margin: 54px 14px 0;
  background: var(--color-surface3, #28282f);
  border: 1px solid var(--color-border, #2a2a33);
  border-radius: 14px; padding: 8px;
  box-shadow: 0 12px 34px rgba(0, 0, 0, .6);
}
.conversation-pathsheet__title {
  font-size: 10px; text-transform: uppercase; letter-spacing: .08em;
  color: var(--color-text-muted, #888); padding: 4px 8px 6px;
}
.conversation-pathsheet__row {
  display: block; width: 100%; text-align: left;
  background: none; border: none; color: var(--color-text, #e8e6e0);
  font-family: inherit; font-size: 12.5px; padding: 8px 10px;
  border-radius: 8px; cursor: pointer;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.conversation-pathsheet__row:hover { background: var(--color-primary-dim, rgba(249, 115, 22, .13)); }
.conversation-pathsheet__row.is-current { color: var(--color-accent, #fb923c); font-weight: 600; }

/* presence — overlapping avatars w/ online dots */
.conversation-presence { display: flex; align-items: center; flex: 0 0 auto; }
.conversation-presence__avatar {
  width: 24px; height: 24px; border-radius: 50%;
  font-size: 11px; font-weight: 700; color: #fff;
  display: flex; align-items: center; justify-content: center;
  position: relative; border: 2px solid var(--color-bg, #0d0d0f);
  margin-left: -6px; background: var(--color-surface3, #28282f);
}
.conversation-presence__avatar:first-child { margin-left: 0; }
.conversation-presence__dot {
  position: absolute; right: -1px; bottom: -1px;
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--status-done, #52c77a);
  border: 1.5px solid var(--color-bg, #0d0d0f);
}

/* ─── timeline ─────────────────────────────────────────────────────── */
.conversation-timeline {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 10px 12px 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  scrollbar-width: none;
}
.conversation-timeline::-webkit-scrollbar { width: 0; height: 0; }

.conversation-daysep {
  text-align: center;
  font-size: 10px;
  color: var(--color-text-faint, #55555c);
  margin: 10px 0 6px;
}

/* ─── grouped message rows ─────────────────────────────────────────── */
.conversation-group { display: flex; gap: 8px; margin-top: 10px; }
.conversation-group--mine { flex-direction: row-reverse; }
.conversation-group__avatar {
  width: 30px; height: 30px; border-radius: 50%; flex: 0 0 30px;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; color: #fff; margin-top: 2px;
  background: var(--color-surface3, #28282f); overflow: hidden;
}
.conversation-group--cont .conversation-group__avatar { visibility: hidden; height: 0; margin: 0; }
.conversation-group__col { display: flex; flex-direction: column; gap: 3px; max-width: 78%; min-width: 0; }
.conversation-group--mine .conversation-group__col { align-items: flex-end; }
.conversation-group__who { font-size: 10.5px; color: var(--color-text-muted, #888); margin: 0 4px 1px; }
.conversation-group--mine .conversation-group__who { display: none; }

/* ─── bubble ───────────────────────────────────────────────────────── */
.conversation-bubble {
  background: var(--color-surface-raised, #1c1c22);
  border: 1px solid var(--color-border, #2a2a33);
  padding: 7px 11px; border-radius: 14px;
  font-size: 13.5px; line-height: 1.45; color: #fff;   /* text always white (sender + receiver, #1) */
  position: relative; cursor: default;
  word-wrap: break-word; overflow-wrap: anywhere;
  touch-action: pan-y;            /* horizontal pointer drag = swipe-to-reply */
  transition: transform .18s ease;
}
.conversation-bubble--mine {
  /* #4 decision B + H1: own bubbles share the received palette (grey) with a THIN
     orange outline; text stays white. The orange selection highlight now reads on
     this grey background, so no per-bubble highlight override is needed. */
  background: var(--color-surface-raised, #1c1c22);
  border-color: var(--color-primary, #f97316);
  color: #fff;
}
.conversation-group:not(.conversation-group--mine) .conversation-bubble { border-top-left-radius: 5px; }
.conversation-group--mine .conversation-bubble { border-top-right-radius: 5px; }
.conversation-group--cont:not(.conversation-group--mine) .conversation-bubble { border-top-left-radius: 14px; }
.conversation-group--cont.conversation-group--mine .conversation-bubble { border-top-right-radius: 14px; }

.conversation-bubble--deleted { opacity: .6; font-style: italic; }
.conversation-bubble--editing { width: 230px; }

/* optimistic send (Phase 4.2): pending dims until acked, failed gets a red edge */
.conversation-bubble--pending { opacity: .62; }
.conversation-bubble--failed {
  border-color: var(--color-danger, #e23b5a);
  box-shadow: inset 0 0 0 1px var(--color-danger, #e23b5a);
}
.conversation-bubble__status { font-style: normal; opacity: .9; }
.conversation-bubble__status--failed { color: var(--color-danger, #e23b5a); opacity: 1; }
.conversation-group--mine .conversation-bubble--failed .conversation-bubble__status--failed { color: #ffe1e6; }

.conversation-failed {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  margin-top: 6px; font-size: 11px;
}
.conversation-failed__label { color: var(--color-danger, #e23b5a); }
.conversation-group--mine .conversation-failed__label { color: #ffe1e6; }
.conversation-failed__retry, .conversation-failed__discard {
  border: 1px solid currentColor; background: transparent; color: inherit;
  border-radius: 8px; padding: 2px 9px; font-size: 11px; cursor: pointer;
}
.conversation-failed__retry { font-weight: 600; }
.conversation-failed__retry:hover, .conversation-failed__discard:hover { opacity: .8; }

.conversation-bubble.is-flash { animation: conversation-flash 1.1s ease; }
@keyframes conversation-flash {
  0%, 100% { box-shadow: 0 0 0 0 transparent; }
  25%      { box-shadow: 0 0 0 3px var(--color-primary-glow, rgba(249,115,22,.30)); }
}

.conversation-bubble__text { white-space: pre-wrap; }
.conversation-bubble__meta {
  font-size: 9.5px; color: var(--color-text-faint, #55555c);
  margin-top: 3px; display: flex; gap: 6px; align-items: center;
}
.conversation-group--mine .conversation-bubble__meta { color: rgba(255,255,255,.7); justify-content: flex-end; }
.conversation-bubble__edited { font-style: italic; }
.conversation-bubble__sendertime { font-style: normal; opacity: .9; }
/* only the time text reveals the sender's local send-time (not the whole row) */
.conversation-bubble__time--tap { cursor: pointer; }
.conversation-bubble__time--tap:hover { text-decoration: underline; text-underline-offset: 2px; }

/* swipe-to-reply affordance */
.conversation-group__swipehint {
  align-self: center;
  flex: 0 0 auto;
  font-size: 15px;
  color: var(--color-accent, #fb923c);
  opacity: 0;
  transition: opacity .12s ease;
  margin: 0 2px;
}
.conversation-group.is-swiping .conversation-group__swipehint { opacity: 1; }
.conversation-group.is-swiping .conversation-bubble { transition: none; }

/* reply quote inside a bubble */
.conversation-quote {
  border-left: 2px solid var(--color-accent, #fb923c);
  padding: 2px 8px; margin-bottom: 5px;
  background: rgba(255,255,255,.04); border-radius: 5px; cursor: pointer;
}
.conversation-quote__who { font-size: 10px; font-weight: 600; color: var(--color-accent, #fb923c); }
.conversation-quote__txt {
  /* quoted text = off-white + smaller — the only non-white bubble text (#1) */
  font-size: 11.5px; color: rgba(255,255,255,.72);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* inline edit */
.conversation-edit__field {
  width: 100%; resize: none;
  background: rgba(0,0,0,.18); color: inherit;
  border: 1px solid var(--color-border, #2a2a33); border-radius: 8px;
  font-family: inherit; font-size: 13.5px; line-height: 1.4; padding: 6px 8px;
  scrollbar-width: none;
}
.conversation-edit__field:focus { outline: none; border-color: var(--color-accent, #fb923c); }
.conversation-edit__row { display: flex; gap: 6px; justify-content: flex-end; margin-top: 6px; }
.conversation-edit__btn {
  font-family: inherit; font-size: 11.5px; padding: 4px 10px;
  border-radius: 7px; cursor: pointer; border: 1px solid var(--color-border, #2a2a33);
  background: transparent; color: inherit;
}
.conversation-edit__btn--save {
  background: var(--color-bg, #0d0d0f); color: var(--color-text, #e8e6e0);
  border-color: var(--color-accent, #fb923c); font-weight: 600;
}

/* photo bubble (media) */
.conversation-photo { width: 200px; }
.conversation-photo__img {
  width: 100%; height: 130px; border-radius: 10px;
  background: linear-gradient(135deg, #2b3a4a, #3b5f5a 60%, #14b8a6);
  display: flex; align-items: flex-end; padding: 6px;
}
.conversation-photo__cap { font-size: 12px; line-height: 1.4; margin-top: 6px; white-space: pre-wrap; }

/* system message */
.conversation-system {
  text-align: center; font-size: 10.5px; color: var(--color-text-muted, #888);
  margin: 8px auto;
  background: var(--color-surface, #141418); border: 1px solid var(--color-border, #2a2a33);
  padding: 4px 12px; border-radius: 20px; max-width: 84%;
}
.conversation-system b { color: var(--color-text, #e8e6e0); font-weight: 600; }

/* read receipts */
.conversation-receipts {
  display: flex; align-items: center; gap: 3px;
  justify-content: flex-end; padding: 1px 6px 2px;
}
.conversation-receipts__label { font-size: 9px; color: var(--color-text-faint, #55555c); margin-right: 2px; }
.conversation-receipts__avatar {
  width: 14px; height: 14px; border-radius: 50%;
  font-size: 8px; font-weight: 700; color: #fff;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--color-bg, #0d0d0f); overflow: hidden;
  background: var(--color-surface3, #28282f);
}

/* tap-menu (action bar) */
.conversation-actions {
  position: absolute; top: calc(100% - 2px); right: 0;
  display: flex; flex-direction: column; min-width: 138px;
  background: var(--color-surface3, #28282f);
  border: 1px solid var(--color-border, #2a2a33); border-radius: 10px;
  padding: 3px; box-shadow: 0 6px 20px rgba(0,0,0,.55); z-index: 8;
}
.conversation-group--mine .conversation-actions { right: auto; left: 0; }
.conversation-actions button {
  background: none; border: none; color: var(--color-text, #e8e6e0);
  font-family: inherit; font-size: 12.5px; text-align: left;
  padding: 8px 12px; cursor: pointer; border-radius: 7px; white-space: nowrap;
}
.conversation-actions button:hover { background: var(--color-primary-dim, rgba(249,115,22,.13)); }
.conversation-actions button[disabled] { color: var(--color-text-faint, #55555c); cursor: default; }
.conversation-actions button[disabled]:hover { background: none; }
.conversation-actions__soon {
  font-size: 8.5px; color: var(--conv-branch, #b574ff);
  font-family: var(--font-mono, ui-monospace, monospace); margin-left: 6px;
}

/* permanent phrase branch marker (Phase 2c): underline + 🧵-colour + reply count.
   The count rides on ::after (data-count) so it stays OUT of the text projection —
   a marked phrase still selects to clean offsets. */
.conversation-branch-mark {
  background: var(--conv-branch-dim, rgba(181,116,255,.16));
  color: inherit;
  border-bottom: 2px solid var(--conv-branch, #b574ff);
  border-radius: 3px 3px 0 0; padding: 0 1px; cursor: pointer;
}
.conversation-branch-mark[data-count]::after {
  content: attr(data-count);
  font-size: 9px; font-weight: 700; color: #fff;
  background: var(--conv-branch, #b574ff);
  border-radius: 8px; padding: 0 5px; margin-left: 3px; vertical-align: middle;
  -webkit-user-select: none; user-select: none;     /* never harvested into a selection */
}
/* Orphaned branches drop their inline marker entirely (they surface in the
   .conversation-orphanstrip, below) — there is deliberately no faded inline state. */
/* (own bubbles now share the received grey palette → the default violet branch
   marker reads fine; no --mine override needed.) */

/* permanent phrase SPIN-OFF marker (Phase 2e): → cyan underline, deliberately
   DISTINCT from the violet 🧵 branch so a message can carry both on different
   spans with a clear visual language (spec §14). No count badge — tapping opens
   the captured host object. */
.conversation-spinoff-mark {
  background: var(--conv-spinoff-dim, rgba(76,201,240,.16));
  color: inherit;
  border-bottom: 2px solid var(--conv-spinoff, #4cc9f0);
  border-radius: 3px 3px 0 0; padding: 0 1px; cursor: pointer;
}

/* whole-message branch chip (🧵 Discussion · N) under the bubble (Phase 2c) /
   spin-off (→) chip placeholder, wired in Phase 2e */
.conversation-branchchip {
  margin-top: 5px; font-size: 11px; color: #d9bcff;
  background: var(--conv-branch-dim, rgba(181,116,255,.16)); border: 1px solid var(--conv-branch, #b574ff);
  border-radius: 8px; padding: 3px 8px; display: inline-block; cursor: pointer;
}
.conversation-spinoffchip {
  margin-top: 5px; font-size: 11px; color: #bfe9fb;
  background: var(--conv-spinoff-dim, rgba(76,201,240,.16)); border: 1px solid var(--conv-spinoff, #4cc9f0);
  border-radius: 8px; padding: 3px 8px; display: inline-block; cursor: pointer;
}

/* orphan strip (Phase 2d): branches whose source phrase/message vanished — their
   inline marker is dropped, so they live here at the top of the parent thread.
   Dashed branch outline echoes the orphaned-mark language (mockup .orphan-strip). */
.conversation-orphanstrip { display: flex; flex-direction: column; gap: 6px; }
.conversation-orphanstrip:not(:empty) { padding: 8px 14px 0; }
.conversation-orphan {
  width: 100%; text-align: left; cursor: pointer;
  font-family: inherit; font-size: 11px; line-height: 1.4; color: #d9bcff;
  background: var(--conv-branch-dim, rgba(181,116,255,.16));
  border: 1px dashed var(--conv-branch, #b574ff); border-radius: 10px; padding: 8px 10px;
}
.conversation-orphan:hover { background: rgba(181,116,255,.24); }
.conversation-orphan__why { color: var(--color-text-muted, #888); font-style: italic; }
/* capture-source orphan (Phase 2e): the → trace survives, the marker dropped —
   cyan to match the spin-off language. */
.conversation-orphan--spin {
  color: #bfe9fb;
  background: var(--conv-spinoff-dim, rgba(76,201,240,.16));
  border-color: var(--conv-spinoff, #4cc9f0);
}
.conversation-orphan--spin:hover { background: rgba(76,201,240,.24); }

/* ─── provenance header (Phase 2e, captured-topic target side) ─────── */
/* shown only when this conversation is a captured topic — taps back to source. */
.conversation-provslot:not(:empty) { padding: 10px 14px 0; }
.conversation-prov {
  width: 100%; text-align: left; cursor: pointer;
  font-family: inherit; font-size: 11.5px; line-height: 1.4;
  color: #bfe9fb;
  background: var(--conv-spinoff-dim, rgba(76,201,240,.16));
  border: 1px solid var(--conv-spinoff, #4cc9f0); border-radius: 10px;
  padding: 8px 10px;
}
.conversation-prov:hover { background: rgba(76,201,240,.24); }

/* empty state */
.conversation-empty {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 8px;
  color: var(--color-text-muted, #888); text-align: center; padding: 24px;
}
.conversation-empty__icon { font-size: 36px; }
.conversation-empty__title { font-weight: 700; color: var(--color-text, #e8e6e0); }
.conversation-empty__sub { font-size: 12px; }

.conversation-error { color: #fca5a5; font-size: 0.85em; padding: 12px; }

/* ─── typing indicator ─────────────────────────────────────────────── */
.conversation-typing {
  display: flex; align-items: center; gap: 8px;
  padding: 4px 14px 6px; flex: 0 0 auto;
}
.conversation-typing__avatar {
  width: 24px; height: 24px; border-radius: 50%;
  font-size: 11px; font-weight: 700; color: #fff;
  display: flex; align-items: center; justify-content: center;
  background: var(--color-surface3, #28282f); overflow: hidden;
}
.conversation-typing__bubble {
  background: var(--color-surface-raised, #1c1c22); border: 1px solid var(--color-border, #2a2a33);
  border-radius: 12px; padding: 7px 10px; display: flex; gap: 3px;
}
.conversation-typing__bubble span {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--color-text-muted, #888);
  animation: conversation-typingdot 1.2s infinite ease-in-out;
}
.conversation-typing__bubble span:nth-child(2) { animation-delay: .2s; }
.conversation-typing__bubble span:nth-child(3) { animation-delay: .4s; }
@keyframes conversation-typingdot {
  0%, 60%, 100% { transform: translateY(0); opacity: .4; }
  30%           { transform: translateY(-4px); opacity: 1; }
}
.conversation-typing__label { font-size: 11px; color: var(--color-text-muted, #888); }

/* ─── composer ─────────────────────────────────────────────────────── */
.conversation-composer {
  border-top: 1px solid var(--color-border, #2a2a33);
  padding: 8px 10px; background: var(--color-surface, #141418);
  flex: 0 0 auto;
}
/* Read-only banner (D5): replaces the composer when the host topic is archived. */
.conversation-readonly {
  flex: 0 0 auto;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  border-top: 1px solid var(--color-border, #2a2a33);
  padding: 10px 12px; background: var(--color-surface, #141418);
  color: var(--color-text-muted, #888);
  font-size: 12.5px;
}
.conversation-readonly__icon { font-size: 14px; opacity: .85; }
.conversation-readonly__text { line-height: 1.3; }
.conversation-reply-chip {
  display: flex; align-items: center; gap: 8px;
  background: var(--color-surface-raised, #1c1c22);
  border-left: 2px solid var(--color-accent, #fb923c);
  padding: 5px 8px; border-radius: 8px; margin-bottom: 6px;
}
.conversation-reply-chip--branch { border-left-color: var(--conv-branch, #b574ff); }
.conversation-reply-chip__txt { flex: 1; min-width: 0; }
.conversation-reply-chip__who { font-size: 10px; color: var(--color-accent, #fb923c); font-weight: 600; }
.conversation-reply-chip--branch .conversation-reply-chip__who { color: var(--conv-branch, #b574ff); }
.conversation-reply-chip__q {
  font-size: 11.5px; color: var(--color-text-muted, #888);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.conversation-reply-chip__x {
  background: none; border: none; color: var(--color-text-muted, #888);
  cursor: pointer; font-size: 14px; padding: 0 2px;
}

.conversation-composer__row { display: flex; align-items: flex-end; gap: 8px; }
/* attach 📎 + expand ⤢ stacked OUTSIDE the text box (spec §9) */
.conversation-composer__side {
  display: flex; flex-direction: column; gap: 1px;
  flex: 0 0 auto; justify-content: center;
}
.conversation-composer__side button {
  width: 28px; height: 18px; background: none; border: none;
  color: var(--color-text-muted, #888); cursor: pointer; padding: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; border-radius: 6px;
}
.conversation-composer__side button:hover {
  color: var(--color-accent, #fb923c); background: var(--color-primary-dim, rgba(249,115,22,.13));
}
/* grows to ~4 lines then caret-follow; NO visible scrollbars (spec §9) */
.conversation-input {
  flex: 1; resize: none;
  background: var(--color-surface-raised, #1c1c22);
  border: 1px solid var(--color-border, #2a2a33);
  color: var(--color-text, #e8e6e0);
  font-family: inherit; font-size: 13.5px; line-height: 1.4;
  padding: 8px 10px; border-radius: 14px; max-height: 92px;
  scrollbar-width: none;
}
.conversation-input:focus { outline: none; border-color: var(--color-primary, #f97316); }
.conversation-input::-webkit-scrollbar { width: 0; height: 0; }
.conversation-send {
  background: var(--color-primary, #f97316); border: none; color: #fff;
  width: 36px; height: 36px; border-radius: 50%;
  font-size: 16px; cursor: pointer; flex: 0 0 36px;
}

/* ─── full-screen editor (long-form composing) ─────────────────────── */
.conversation-fseditor {
  position: absolute; inset: 0; z-index: 60;
  background: var(--color-bg, #0d0d0f);
  display: flex; flex-direction: column;
}
.conversation-fseditor__bar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px; border-bottom: 1px solid var(--color-border, #2a2a33);
}
.conversation-fseditor__bar > span { font-size: 13px; font-weight: 600; color: var(--color-text-muted, #888); }
.conversation-fseditor__send {
  background: none; border: none; color: var(--color-primary, #f97316);
  font-family: inherit; font-size: 14px; font-weight: 700; cursor: pointer;
}
/* formatting toolbar — visual placeholders in Phase 1; rich text = Phase 6.
   Only the RTL/LTR toggle is live. */
.conversation-fseditor__tools {
  display: flex; gap: 2px; padding: 8px 12px;
  border-bottom: 1px solid var(--color-border, #2a2a33);
}
.conversation-fseditor__tools button {
  background: none; border: none; color: var(--color-text-muted, #888);
  font-size: 13px; width: 28px; height: 26px; border-radius: 6px;
  cursor: pointer; line-height: 1;
}
.conversation-fseditor__tools button:hover {
  background: var(--color-primary-dim, rgba(249,115,22,.13)); color: var(--color-accent, #fb923c);
}
.conversation-fseditor__tools .conversation-swatch {
  display: inline-block; width: 13px; height: 13px; border-radius: 50%;
  background: conic-gradient(#e05a8a, #8b5cf6, #fb923c, #14b8a6, #60a5fa, #e05a8a);
}
.conversation-fseditor__tools button[data-dir] { width: auto; padding: 0 8px; }
.conversation-fseditor__field { position: relative; flex: 1; display: flex; min-height: 0; }
.conversation-fseditor__field textarea {
  flex: 1; resize: none;
  background: var(--color-bg, #0d0d0f); border: none; color: var(--color-text, #e8e6e0);
  font-family: inherit; font-size: 15px; line-height: 1.5;
  padding: 16px 16px 44px; scrollbar-width: none;
}
.conversation-fseditor__field textarea:focus { outline: none; }
.conversation-fseditor__field textarea::-webkit-scrollbar { width: 0; height: 0; }
.conversation-fseditor__min {
  position: absolute; left: 12px; bottom: 12px;
  width: 26px; height: 26px; border-radius: 7px;
  background: var(--color-surface-raised, #1c1c22);
  border: 1px solid var(--color-border, #2a2a33); color: var(--color-text-muted, #888);
  display: flex; align-items: center; justify-content: center; cursor: pointer; padding: 0;
}
.conversation-fseditor__min:hover { color: var(--color-accent, #fb923c); border-color: var(--color-primary, #f97316); }

/* ─── annotation selection layer (Phase 2b) ────────────────────────── */
/* Annotatable surfaces carry NO native selection in the normal state, so
   tapping / swiping a bubble never summons the OS callout. Selection is entered
   deliberately from the tap-menu ("Sélectionner"), which flips THIS surface to
   natively selectable — real OS handles + loupe — for the refine step; "tap
   outside = done" then harvests it. (Selection model revised 2026-06-20:
   borrow the native selection instead of emulating it.) */
.conversation-annotatable {
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
}
.conversation-annotatable.is-selecting {
  -webkit-user-select: text !important; user-select: text !important;
  -webkit-touch-callout: default !important;
  cursor: text; touch-action: auto;
  border-radius: 7px;
  box-shadow: 0 0 0 2px var(--color-accent, #fb923c),
              0 0 0 6px var(--color-primary-dim, rgba(249,115,22,.13));
}
/* (own bubbles now share the received grey palette → the default orange selecting
   ring above reads fine; no --mine override needed.) */

/* our highlight on the harvested span, painted after the native selection is
   cleared. The ::highlight() pseudo can't reliably resolve module CSS vars, so
   its colour is literal (kept in sync with --conv-sel); the <mark> fallback
   (no Custom Highlight API) uses the token. */
::highlight(conv-sel) { background: rgba(249, 115, 22, 0.30); }
.conversation-bubble mark.conversation-sel {
  background: var(--conv-sel, rgba(249,115,22,.30)); color: inherit; border-radius: 3px;
}

/* span menu — ONE native-LOOKING bar (horizontal), never the OS sheet */
.conversation-selmenu {
  position: absolute; z-index: 64; display: flex; align-items: stretch;
  background: var(--color-surface3, #28282f);
  border: 1px solid var(--color-border, #2a2a33);
  border-radius: 12px; padding: 2px;
  box-shadow: 0 8px 26px rgba(0,0,0,.6);
}
.conversation-selmenu button {
  background: none; border: none; color: var(--color-text, #e8e6e0);
  font-family: inherit; font-size: 13.5px; white-space: nowrap;
  padding: 9px 13px; border-radius: 9px; cursor: pointer;
}
.conversation-selmenu button:hover { background: var(--color-primary-dim, rgba(249,115,22,.13)); }
.conversation-selmenu__div { width: 1px; background: var(--color-border, #2a2a33); margin: 5px 0; flex: 0 0 auto; }
.conversation-selmenu__more { font-size: 17px; line-height: 1; padding: 6px 12px; }
.conversation-selmenu__caret {
  position: absolute; bottom: -6px; left: 50%; transform: translateX(-50%);
  width: 0; height: 0; border-left: 7px solid transparent; border-right: 7px solid transparent;
  border-top: 7px solid var(--color-surface3, #28282f);
}
.conversation-selmenu--flip .conversation-selmenu__caret {
  bottom: auto; top: -6px; border-top: none; border-bottom: 7px solid var(--color-surface3, #28282f);
}

/* selection-mode hint banner (bottom) */
.conversation-selhint {
  position: absolute; left: 10px; right: 10px; bottom: 10px; z-index: 62;
  background: var(--color-surface, #141418);
  border: 1px solid var(--color-accent, #fb923c);
  border-radius: 14px; padding: 10px 12px; box-shadow: 0 -6px 24px rgba(0,0,0,.5);
}
.conversation-selhint__t { font-size: 12.5px; color: var(--color-text, #e8e6e0); line-height: 1.45; }
.conversation-selhint__t b { color: var(--color-accent, #fb923c); }
.conversation-selhint__row { display: flex; gap: 8px; margin-top: 9px; }
.conversation-selhint__row button {
  flex: 1; font-family: inherit; font-size: 12.5px; padding: 8px; border-radius: 9px; cursor: pointer;
  border: 1px solid var(--color-border, #2a2a33); background: transparent; color: var(--color-text-muted, #888);
}
.conversation-selhint__row button:hover { color: var(--color-accent, #fb923c); border-color: var(--color-accent, #fb923c); }

/* ─── promote sheet (Phase 2e capture → "Créer un sujet") ──────────── */
/* bottom sheet: editable subject (≤80) + parent picker + read-only creator.
   Ported from the mockup `.sheet`. */
.conversation-promote-backdrop {
  position: absolute; inset: 0; z-index: 70;
  background: rgba(0,0,0,.55); display: flex; align-items: flex-end;
}
.conversation-promote {
  width: 100%; background: var(--color-surface, #141418);
  border-top: 1px solid var(--color-border, #2a2a33);
  border-radius: 18px 18px 0 0; padding: 16px 16px 18px;
  box-shadow: 0 -8px 30px rgba(0,0,0,.6);
}
.conversation-promote__title { font-size: 15px; font-weight: 700; margin-bottom: 2px; }
.conversation-promote__sub {
  font-size: 11px; color: var(--color-text-muted, #888); margin-bottom: 10px; line-height: 1.45;
}
.conversation-promote__label {
  font-size: 10px; text-transform: uppercase; letter-spacing: .08em;
  color: var(--color-text-muted, #888); margin: 10px 0 5px;
}
.conversation-promote__input {
  width: 100%; background: var(--color-surface-raised, #1c1c22);
  border: 1px solid var(--color-border, #2a2a33); color: var(--color-text, #e8e6e0);
  font-family: inherit; font-size: 13.5px; padding: 9px 11px; border-radius: 10px;
}
.conversation-promote__input:focus { outline: none; border-color: var(--color-primary, #f97316); }
.conversation-promote__count { font-size: 10px; color: var(--color-text-faint, #55555c); text-align: right; margin-top: 3px; }
.conversation-promote__parents {
  display: flex; flex-direction: column; gap: 4px;
  max-height: 132px; overflow-y: auto; scrollbar-width: none;
}
.conversation-promote__parents::-webkit-scrollbar { width: 0; }
.conversation-promote__parent {
  width: 100%; text-align: left; cursor: pointer;
  background: var(--color-surface-raised, #1c1c22);
  border: 1px solid var(--color-border, #2a2a33); color: var(--color-text, #e8e6e0);
  font-family: inherit; font-size: 12.5px; padding: 8px 10px; border-radius: 9px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.conversation-promote__parent.is-on {
  border-color: var(--color-primary, #f97316);
  background: var(--color-primary-dim, rgba(249,115,22,.13)); color: var(--color-accent, #fb923c);
}
.conversation-promote__creator { font-size: 11px; color: var(--color-text-muted, #888); margin-top: 12px; }
.conversation-promote__creator b { color: var(--color-text, #e8e6e0); }
.conversation-promote__row { display: flex; gap: 8px; margin-top: 16px; }
.conversation-promote__row button {
  flex: 1; font-family: inherit; font-size: 13px; padding: 10px;
  border-radius: 10px; cursor: pointer; border: 1px solid var(--color-border, #2a2a33);
}
.conversation-promote__cancel { background: transparent; color: var(--color-text-muted, #888); }
.conversation-promote__save {
  background: var(--color-primary, #f97316); border-color: var(--color-primary, #f97316);
  color: #fff; font-weight: 600;
}

/* tiny transient toast (stub-action feedback) */
.conversation-toast {
  position: absolute; left: 50%; bottom: 64px; transform: translateX(-50%);
  background: var(--color-surface3, #28282f); border: 1px solid var(--color-border, #2a2a33);
  color: var(--color-text, #e8e6e0); font-size: 12px; padding: 7px 14px;
  border-radius: 20px; box-shadow: 0 6px 20px rgba(0,0,0,.5);
  z-index: 80; pointer-events: none; opacity: 0; transition: opacity .2s ease;
}
.conversation-toast.is-shown { opacity: 1; }

/* ─── mount-level states (Phase 5.2) ────────────────────────────────
 * Rendered by app.js directly into the #conversations-view container (NOT
 * inside `.conversation`) for the cold-start / degrade paths: loading, no
 * active relation, needs-rekey, error, no-topic. Mirrors the Frisson degrade
 * sheets; every colour/space from a base.css token with a standalone fallback. */
.conversation-loading,
.conversation-notice {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  height: 100%; min-height: 0; padding: 32px 24px; gap: 12px; text-align: center;
  background: var(--color-bg, #0d0d0f); color: var(--color-text, #e8e6e0);
  font-family: var(--font-body, 'DM Sans', system-ui, -apple-system, sans-serif);
}
.conversation-loading { color: var(--color-text-muted, #888); }
.conversation-notice__icon { font-size: 44px; line-height: 1; }
.conversation-notice__title { margin: 0; font-size: 20px; font-weight: 700; }
.conversation-notice__body {
  margin: 0; max-width: 34ch; line-height: 1.5; color: var(--color-text-muted, #888);
}
.conversation-notice__actions {
  display: flex; flex-direction: column; gap: 10px; margin-top: 8px;
  width: 100%; max-width: 320px;
}

/* ─── host subject-text header (Phase 5.3) ───────────────────────────
 * The host topic's own text atop its conversation, rendered through
 * host.renderAnnotatable. `.conversation-annotatable` (above) owns the
 * user-select toggle; here we only style layout + typography. */
.conversation-hosttext {
  flex: 0 0 auto; padding: 10px 14px;
  border-bottom: 1px solid var(--color-border, #2a2a33);
  background: var(--color-surface, #18181d);
}
.conversation-hosttext__label {
  font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em;
  color: var(--color-text-faint, #55555c); margin-bottom: 3px;
}
.conversation-hosttext__body {
  font-size: 15px; font-weight: 600; line-height: 1.4;
  color: var(--color-text, #e8e6e0); cursor: text;
}
