/* 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;                     /* spawned a topic (cyan) */
  --conv-spinoff-dim: rgba(76, 201, 240, 0.16);
  --conv-camefrom:    #f4b740;                     /* came from a source (amber) — P6-A */
  --conv-both:        #e05a8a;                     /* both directions (magenta) — P6-A */
  --conv-reply:       #3ddc97;                     /* replied-to phrase (green) — §4d */
  --conv-new:         #f9b234;                     /* genesis topic — a brand-new thing (§4b) */
  --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;
}
/* Offline strip (audit L-9): a thin non-blocking band under the header while the
   live socket is down. Hidden until `.is-visible` is toggled on (onDisconnect),
   cleared on reconnect. Muted surface + accent under-rule reads "degraded,
   recovering" rather than an error — the timeline below stays fully usable. */
.conversation-offline {
  display: none;
  flex: 0 0 auto;
  text-align: center;
  padding: 5px 12px;
  font-size: 11.5px;
  line-height: 1.3;
  color: var(--color-text-muted, #888);
  background: var(--color-surface-raised, #1c1c22);
  border-bottom: 1px solid var(--color-accent, #fb923c);
}
.conversation-offline.is-visible { display: block; }
/* ‹ 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;
}

/* §12-P6 — "Garder comme sujet": promote a bare discussion → a tracked topic.
   A compact pill in the header (between the title and presence); becomes a muted
   read-only "✓ Sujet" chip once promoted. */
.conversation-header__promote {
  flex: 0 0 auto;
  margin: 0 6px;
  padding: 4px 10px;
  border: 1px solid color-mix(in srgb, var(--conv-spinoff, #4cc9f0) 55%, transparent);
  border-radius: 999px;
  background: color-mix(in srgb, var(--conv-spinoff, #4cc9f0) 14%, transparent);
  color: var(--conv-spinoff, #4cc9f0);
  font-size: 11.5px;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
}
.conversation-header__promote:hover {
  background: color-mix(in srgb, var(--conv-spinoff, #4cc9f0) 22%, transparent);
}
.conversation-header__promote.is-promoted {
  border-color: color-mix(in srgb, var(--color-text-muted, #888) 40%, transparent);
  background: transparent;
  color: var(--color-text-muted, #888);
  cursor: default;
}

/* §6g — read-only status chip in the thread header */
.conversation-status-chip {
  flex: 0 0 auto;
  margin: 0 6px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
  background: var(--color-surface-raised, #1c1c22);
  color: var(--color-text-muted, #888);
  border: 1px solid var(--color-border, #2a2a33);
}
.conversation-status-chip[data-status="open"]   { color: var(--status-open, #f9b234); }
.conversation-status-chip[data-status="paused"] { color: var(--status-paused, #fb923c); }
.conversation-status-chip[data-status="done"]   { color: var(--status-done, #4ade80); }
.conversation-status-chip[data-status="archived"] { color: var(--color-text-muted, #888); }

/* 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; }

/* Audit L-7/L-11 — visible keyboard-focus ring for the now-focusable navigation
   affordances (breadcrumb crumbs, branch/spin phrase markers, reply quotes, the
   trace badge). :focus-visible → ring only for keyboard nav, never on mouse tap. */
.conversation-crumb:focus-visible,
.conversation-branch-mark:focus-visible,
.conversation-spinoff-mark:focus-visible,
.conversation-quote:focus-visible,
.conversation-tracebadge:focus-visible {
  outline: 2px solid var(--color-accent, #fb923c);
  outline-offset: 2px;
  border-radius: 3px;
}

/* 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;
  overflow-x: hidden;          /* a bubble can never push the thread off-screen (#6) */
  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; min-width: 0; }
.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;
  max-width: 100%; min-width: 0;       /* stay inside the column; let a nowrap quote ellipsis-clip (#6) */
  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; }
/* Editing in place gets the full column width so messages up to the read-more cap
   are comfortable to edit; longer ones open full-screen instead (#3). */
.conversation-bubble--editing { width: 100%; box-sizing: border-box; }
.conversation-group__col:has(> .conversation-bubble--editing) { max-width: 100%; width: 100%; }

/* 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; }

/* §8a — multi-pulse arrival flash (~3 pulses over FLASH_MS = 1.8s) so a
 * cross-thread landing is unmistakable, not a single easy-to-miss blink. */
.conversation-bubble.is-flash { animation: conversation-flash 1.8s ease; }
@keyframes conversation-flash {
  0%, 100%      { box-shadow: 0 0 0 0 transparent; }
  8%, 42%, 75%  { box-shadow: 0 0 0 3px var(--color-primary-glow, rgba(249,115,22,.30)); }
  25%, 58%, 92% { box-shadow: 0 0 0 0 transparent; }
}
/* §8a — header / SUJET arrival flash (same cadence, soft background wash) used
 * when a navigation lands on a thread with no single message to point at. */
.conversation-header__name.is-flash,
.conversation-hosttext.is-flash { animation: conversation-flash-soft 1.8s ease; border-radius: 8px; }
@keyframes conversation-flash-soft {
  0%, 100%      { background: transparent; }
  8%, 42%, 75%  { background: var(--color-primary-glow, rgba(249,115,22,.18)); }
  25%, 58%, 92% { background: transparent; }
}

/* §8b — open-at-first-unread divider: a centred amber label between two rules,
 * inserted before the first unread message and kept for the session. */
.conversation-unreaddiv {
  display: flex; align-items: center; gap: 10px;
  margin: 12px 10px; padding: 0 2px;
}
.conversation-unreaddiv__rule {
  flex: 1; height: 1px;
  background: var(--conv-camefrom, #f4b740); opacity: .45;
}
.conversation-unreaddiv__label {
  font-size: 11px; font-weight: 700; letter-spacing: .03em; text-transform: uppercase;
  color: var(--conv-camefrom, #f4b740); white-space: nowrap;
}

.conversation-bubble__text { white-space: pre-wrap; }
/* P6-E — md+ rich text (B/I/U + lists). Inline marks use <strong>/<em>/<u>
 * (browser defaults). Lists need a hanging indent that fits inside the bubble. */
.conversation-md-list { margin: 4px 0; padding-left: 1.5em; }
.conversation-md-list li { margin: 1px 0; }
/* P6-C — long-message collapse toggle */
.conversation-readmore {
  display: inline-block; margin-top: 5px; padding: 0;
  background: none; border: none; cursor: pointer;
  font-size: 12px; font-weight: 600;
  color: var(--color-accent, #fb923c);
}
.conversation-readmore:hover { text-decoration: underline; text-underline-offset: 2px; }
.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;
}

/* copy-to-thread (§6c): a brought message — a REAL annotatable/deletable bubble
   (respects the font lens) carrying a dual-attribution header. A left accent +
   the 📎 header mark it as "issu des détails/du sujet"; the text below is the
   normal selectable .conversation-bubble__text surface. */
.conversation-bubble--brought { border-left: 2px solid var(--conv-spinoff, #4cc9f0); }
.conversation-brought {
  display: flex; align-items: baseline; gap: 5px;
  margin-bottom: 5px; padding-bottom: 4px;
  border-bottom: 1px solid rgba(255,255,255,.08);
  font-size: 10.5px; line-height: 1.35; color: rgba(255,255,255,.66);
}
.conversation-brought__icon { flex: 0 0 auto; opacity: .8; }
.conversation-brought__txt { min-width: 0; }
.conversation-brought__txt b { color: rgba(255,255,255,.82); font-weight: 600; }

/* 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--fs { margin-right: auto; }   /* ⤢ sits left of Annuler/Enregistrer (#3) */
.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; }
/* Floating variant (#11): JS positions it at the tap point relative to the
   conversation root, so it must not also pin to a bubble edge. */
.conversation-actions--float { right: auto; top: 0; z-index: 20; }
.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;
}

/* long-press reaction bar (P6-D): floats at the touch point, root-anchored.
   Placeholder — tapping a reaction just toasts (no persistence/sync). */
.conversation-reactions {
  position: absolute; z-index: 22;
  display: flex; align-items: center; gap: 2px; padding: 5px 8px;
  background: var(--color-surface3, #28282f);
  border: 1px solid var(--color-border, #2a2a33); border-radius: 999px;
  box-shadow: 0 8px 24px rgba(0,0,0,.55);
}
.conversation-reactions__btn {
  background: none; border: none; cursor: pointer; padding: 3px 5px;
  font-size: 21px; line-height: 1; border-radius: 999px;
  transition: transform .12s ease, background .12s ease;
}
.conversation-reactions__btn:hover {
  transform: scale(1.25); background: var(--color-primary-dim, rgba(249,115,22,.13));
}
.conversation-reactions__btn:active { transform: scale(1.1); }

/* 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 {
  /* Explicit colour (not the dim token) + text-fill reset so the reference
     highlight is unmistakable on every engine — it was invisible on Edge
     desktop where the faint token + UA <mark> styling washed it out (#12). */
  background-color: rgba(181,116,255,.30);
  color: inherit; -webkit-text-fill-color: currentColor;
  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-color: rgba(76,201,240,.30);
  color: inherit; -webkit-text-fill-color: currentColor;
  border-bottom: 2px solid var(--conv-spinoff, #4cc9f0);
  border-radius: 3px 3px 0 0; padding: 0 1px; cursor: pointer;
}

/* permanent phrase REPLY marker (§4d, #7): green underline on the phrase a reply
   quoted — distinct from branch 🧵 (violet) and spin-off → (cyan). Tapping jumps
   to the reply. No count badge. */
.conversation-reply-mark {
  background-color: rgba(61,220,151,.26);
  color: inherit; -webkit-text-fill-color: currentColor;
  border-bottom: 2px solid var(--conv-reply, #3ddc97);
  border-radius: 3px 3px 0 0; padding: 0 1px; cursor: pointer;
}

/* whole-message branch chip (🧵 Discussion · N) under the bubble (Phase 2c).
   Capture provenance no longer uses a chip — it rides the trace badge (P6-A). */
.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;
}

/* ─── provenance trace badge (P6-A) ────────────────────────────────── */
/* A morphing outline-SVG badge: shape + colour encode the trace relationship
   (spawned ↦ cyan / came-from ⇥ amber / both ⇄ magenta). On a message it FLOATS
   the top corner so the text wraps around it (placement A); on the subject header
   it pins absolute top-right. Tap → the 2-level traceability view. */
.conversation-tracebadge {
  width: 19px; height: 19px; flex: 0 0 auto;
  display: inline-flex; align-items: center; justify-content: center;
  background: none; border: none; padding: 0; cursor: pointer;
  position: relative; border-radius: 7px;
}
.conversation-tracebadge svg { width: 16px; height: 16px; display: block; }
.conversation-tracebadge--so { color: var(--conv-spinoff, #4cc9f0); }
.conversation-tracebadge--cf { color: var(--conv-camefrom, #f4b740); }
.conversation-tracebadge--bo { color: var(--conv-both, #e05a8a); }
.conversation-tracebadge--static { cursor: default; }
/* float on a message bubble — footprint ~1 line tall so lines below wrap full
   width; the badge is just a fingertip-sized tap target. §4c — ALWAYS top-right
   regardless of mine/other (the mine-dependent --float-mine corner is retired). */
.conversation-tracebadge--float { float: right; margin: 0 0 2px 6px; }
/* subject header — pinned top-right (the header has right padding) */
.conversation-tracebadge--subject { position: absolute; top: 8px; right: 10px; }

/* 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); }

/* ─── traceability — Level 1 sheet (P6-A) ──────────────────────────── */
/* Tapping a trace badge opens this bottom sheet (reuses the promote-sheet
   backdrop). "Provient de" (came-from) + "Sujets créés" (spawned), then a
   button into the full tree (Level 2). Section captions carry the coloured
   arrow badge, not per-line icons. */
.conversation-trace-backdrop {
  position: absolute; inset: 0; z-index: 70;
  background: rgba(0,0,0,.55); display: flex; align-items: flex-end;
}
.conversation-trace {
  width: 100%; background: var(--color-surface, #141418);
  border-top: 1px solid var(--color-border, #2a2a33);
  border-radius: 18px 18px 0 0; padding: 4px 0 10px;
  box-shadow: 0 -8px 30px rgba(0,0,0,.6);
  max-height: 76%; overflow-y: auto; scrollbar-width: none;
}
.conversation-trace::-webkit-scrollbar { width: 0; }
.conversation-trace__head {
  display: flex; align-items: center; gap: 9px;
  padding: 13px 16px; border-bottom: 1px solid var(--color-border, #2a2a33);
}
.conversation-trace__title { font-size: 15px; font-weight: 700; }
.conversation-trace__sec { padding: 12px 16px; border-bottom: 1px solid var(--color-border, #2a2a33); }
.conversation-trace__cap {
  display: flex; align-items: center; gap: 7px;
  font-size: 10px; text-transform: uppercase; letter-spacing: .06em;
  color: var(--color-text-muted, #888); margin-bottom: 8px;
}
.conversation-trace__cap .conversation-tracebadge { width: 17px; height: 17px; }
.conversation-trace__line {
  display: flex; gap: 9px; align-items: flex-start;
  padding: 8px 8px; border-radius: 9px;
}
.conversation-trace__line--tap { cursor: pointer; }
.conversation-trace__line--tap:hover { background: var(--color-primary-dim, rgba(249,115,22,.13)); }
.conversation-trace__body { flex: 1; min-width: 0; }
.conversation-trace__who { font-size: 13px; color: var(--color-text, #e8e6e0); }
.conversation-trace__who b { font-weight: 700; }
.conversation-trace__snip {
  font-size: 12px; color: var(--color-text-muted, #888); margin-top: 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.conversation-trace__when { font-size: 10.5px; color: var(--color-text-faint, #55555c); margin-top: 3px; }
.conversation-trace__open {
  margin-top: 8px; display: inline-block;
  font-family: inherit; font-size: 12px; cursor: pointer;
  color: var(--color-accent, #fb923c);
  border: 1px solid var(--color-accent, #fb923c); background: transparent;
  border-radius: 9px; padding: 5px 11px;
}
.conversation-trace__open:hover { background: var(--color-primary-dim, rgba(249,115,22,.13)); }
.conversation-trace__treebtn {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  width: calc(100% - 32px); margin: 12px 16px 4px;
  font-family: inherit; font-size: 13px; font-weight: 600; cursor: pointer;
  color: var(--color-text, #e8e6e0);
  background: var(--color-surface-raised, #1c1c22);
  border: 1px solid var(--color-border, #2a2a33); border-radius: 11px; padding: 11px;
}
.conversation-trace__treebtn:hover { border-color: var(--color-primary, #f97316); }
.conversation-trace__treesub { font-weight: 400; font-size: 11px; color: var(--color-text-muted, #888); }

/* ─── traceability — Level 2 full-screen tree (P6-A) ───────────────── */
/* The whole active Topics hierarchy (host placements), clean — NO arrows —
   with the current location highlighted "vous êtes ici". Tap a node to jump. */
.conversation-tracetree {
  position: absolute; inset: 0; z-index: 72;
  background: var(--color-bg, #0d0d0f);
  display: flex; flex-direction: column;
}
.conversation-tracetree__head {
  display: flex; align-items: center; gap: 10px;
  padding: 13px 14px; border-bottom: 1px solid var(--color-border, #2a2a33); flex: 0 0 auto;
}
.conversation-tracetree__back {
  background: none; border: none; color: var(--color-text-muted, #888);
  font-size: 22px; line-height: 1; cursor: pointer; padding: 0 4px 0 0;
}
.conversation-tracetree__back:hover { color: var(--color-accent, #fb923c); }
.conversation-tracetree__title { font-size: 14px; font-weight: 700; }
.conversation-tracetree__count { font-size: 12px; color: var(--color-text-muted, #888); margin-left: 4px; }
/* colour legend — a small row under the head so the origin-dot colours read at a glance */
.conversation-tracetree__legend {
  display: flex; flex-wrap: wrap; gap: 5px 14px;
  padding: 7px 14px 9px; border-bottom: 1px solid var(--color-border, #2a2a33); flex: 0 0 auto;
}
.conversation-tracetree__legenditem { display: inline-flex; align-items: center; gap: 5px; }
.conversation-tracetree__legenddot { width: 8px; height: 8px; flex: 0 0 8px; border-radius: 50%; }
.conversation-tracetree__legendlabel { font-size: 11px; color: var(--color-text-muted, #888); }
/* per-level collapse controls (§2b: per node + per level) */
.conversation-tracetree__levels { margin-left: auto; display: flex; gap: 6px; flex: 0 0 auto; }
.conversation-tracetree__levelbtn {
  background: none; border: 1px solid var(--color-border, #2a2a33); border-radius: 999px;
  color: var(--color-text-muted, #888); font-family: inherit; font-size: 11px;
  padding: 4px 10px; cursor: pointer; white-space: nowrap;
}
.conversation-tracetree__levelbtn:hover { color: var(--color-text, #e8e6e0); border-color: var(--color-text-muted, #888); }
.conversation-tracetree__tree {
  flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 8px 8px 16px; scrollbar-width: none;
}
.conversation-tracetree__tree::-webkit-scrollbar { width: 0; }
.conversation-tracetree__empty { color: var(--color-text-muted, #888); font-size: 12.5px; padding: 18px 10px; }
.conversation-tracetree__node {
  display: flex; align-items: center; gap: 7px; width: 100%;
  background: none; border: 1px solid transparent; border-radius: 9px;
  font-family: inherit; font-size: 13px; text-align: left; color: var(--color-text, #e8e6e0);
  padding: 7px 8px; cursor: pointer;
}
.conversation-tracetree__node:hover { background: var(--color-surface, #141418); }
.conversation-tracetree__caret { width: 14px; flex: 0 0 14px; text-align: center; font-size: 11px; color: var(--color-text-muted, #888); border-radius: 4px; }
/* a caret over a node WITH children is its own tap target (per-node collapse) */
.conversation-tracetree__caret.is-toggle { cursor: pointer; }
.conversation-tracetree__caret.is-toggle:hover { color: var(--color-text, #e8e6e0); background: var(--color-surface, #141418); }
.conversation-tracetree__dot { width: 7px; height: 7px; flex: 0 0 7px; border-radius: 50%; background: var(--color-accent, #fb923c); }
.conversation-tracetree__label { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* §5 — topic vs discussion text differentiation: a TOPIC (genesis / captured /
   promoted) reads slightly larger + semibold; a bare DISCUSSION reads italic + a
   touch smaller. Pairs with the origin-dot colour so kind AND origin are both legible. */
.conversation-tracetree__node.is-topic .conversation-tracetree__label { font-size: 13.5px; font-weight: 600; }
.conversation-tracetree__node.is-discussion .conversation-tracetree__label { font-style: italic; font-size: 12.5px; }
/* STATUS = visual tint only, never a structural filter (§2b). done = dimmed +
   struck; paused = muted. The node always stays so its live children persist. */
.conversation-tracetree__node.is-done { opacity: 0.5; }
.conversation-tracetree__node.is-done .conversation-tracetree__label { text-decoration: line-through; }
.conversation-tracetree__node.is-paused { opacity: 0.72; }
.conversation-tracetree__node.is-paused .conversation-tracetree__label { font-style: italic; }
.conversation-tracetree__node.is-here {
  background: var(--color-primary-dim, rgba(249,115,22,.13));
  border-color: var(--color-primary, #f97316);
}
.conversation-tracetree__node.is-here.is-done { opacity: 1; }   /* current node stays legible even if done */
/* #1 — a node with new (unread) messages: bold label + a count badge, so you can
   see WHICH branch has activity (the card's counter says how many across the tree). */
.conversation-tracetree__node.has-unread .conversation-tracetree__label { font-weight: 700; color: var(--color-text, #e8e6e0); }
.conversation-tracetree__unread {
  flex: 0 0 auto; margin-left: 6px;
  min-width: 16px; height: 16px; padding: 0 5px; border-radius: 999px;
  background: var(--color-primary, #f97316); color: #fff;
  font-size: 10px; font-weight: 700; line-height: 16px; text-align: center;
}
.conversation-tracetree__heretag {
  flex: 0 0 auto; margin-left: auto; font-size: 12px; color: var(--color-accent, #fb923c);
  border: 1px solid var(--color-accent, #fb923c); border-radius: 999px; padding: 2px 8px; white-space: nowrap;
}

/* 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);
  /* bottom inset clears the iOS home indicator (audit L-10) — matches Frisson */
  padding: 8px 10px calc(8px + var(--safe-bottom, 0px)); 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);
  /* bottom inset clears the iOS home indicator (audit L-10) */
  padding: 10px 12px calc(10px + var(--safe-bottom, 0px)); 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; }

/* §6g — reopen banner above the composer (réglé / en pause). The composer is
   disabled (.is-disabled) until the user taps Rouvrir. */
.conversation-reopen {
  flex: 0 0 auto;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  border-top: 1px solid var(--color-border, #2a2a33);
  padding: 8px 12px; background: var(--color-surface-raised, #1c1c22);
  font-size: 12.5px; color: var(--color-text-muted, #aaa);
}
.conversation-reopen__text { line-height: 1.3; }
.conversation-reopen__btn {
  flex: 0 0 auto;
  padding: 5px 14px; border-radius: 999px;
  border: 1px solid var(--status-open, #f9b234);
  background: color-mix(in srgb, var(--status-open, #f9b234) 16%, transparent);
  color: var(--status-open, #f9b234);
  font-size: 12px; font-weight: 700; cursor: pointer;
}
.conversation-reopen__btn:hover { background: color-mix(in srgb, var(--status-open, #f9b234) 26%, transparent); }
.conversation-composer.is-disabled { opacity: .5; pointer-events: none; }
.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: 3px; }
/* P6-B layout: 📎 attach + 😀 emoji inline at the left, then the text box, then
   ⤢ full-screen, then ➤ send (left-to-right). */
.conversation-composer__side {
  display: flex; flex-direction: row; gap: 0;
  flex: 0 0 auto; align-items: flex-end;
}
/* Height ~matches the collapsed textbox so 📎 / 😀 / ⤢ read as a matched set (#1);
   narrower width + zero/tight gaps hand the textbox more room while each button keeps
   a comfortable (30×34) finger target and the SVGs never overlap. */
.conversation-composer__side button,
.conversation-composer__expand {
  width: 30px; height: 34px; background: none; border: none;
  color: var(--color-text-muted, #888); cursor: pointer; padding: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; border-radius: 8px; flex: 0 0 auto;
}
.conversation-attach-icon, .conversation-expand-icon { display: block; }
.conversation-composer__side button:hover,
.conversation-composer__expand:hover {
  color: var(--color-accent, #fb923c); background: var(--color-primary-dim, rgba(249,115,22,.13));
}
/* outline-only smiley placeholder (B2) */
.conversation-emoji-icon { display: block; }
/* 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;
}
/* P6-F bar: ‹ back (keep draft) · heading · 🗑 discard · ➤ send */
.conversation-fseditor__bar {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-bottom: 1px solid var(--color-border, #2a2a33);
}
.conversation-fseditor__back {
  flex: 0 0 auto; background: none; border: none; cursor: pointer;
  color: var(--color-text-muted, #888); font-size: 22px; line-height: 1; padding: 0 4px 0 0;
}
.conversation-fseditor__back:hover { color: var(--color-accent, #fb923c); }
.conversation-fseditor__heading { flex: 1; font-size: 13px; font-weight: 600; color: var(--color-text-muted, #888); }
.conversation-fseditor__baractions { display: flex; align-items: center; gap: 6px; flex: 0 0 auto; }
.conversation-fseditor__discard {
  background: none; border: none; cursor: pointer; line-height: 1;
  font-size: 15px; padding: 4px 6px; border-radius: 7px; opacity: .85;
}
.conversation-fseditor__discard:hover { background: var(--color-danger-dim, rgba(226,59,90,.14)); opacity: 1; }
.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; }
/* P6-E — the B/I/U glyphs preview their own mark */
.conversation-fseditor__tools .conv-tool--b { font-weight: 800; }
.conversation-fseditor__tools .conv-tool--i { font-style: italic; }
.conversation-fseditor__tools .conv-tool--u { text-decoration: underline; }
.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; scrollbar-width: none;
}
.conversation-fseditor__field textarea:focus { outline: none; }
.conversation-fseditor__field textarea::-webkit-scrollbar { width: 0; height: 0; }

/* ─── 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);
  /* The sheet grows to fit its content; once it would exceed ~full screen it caps
     and scrolls (a visible scrollbar then handles the overflow) — #15. */
  max-height: calc(100% - 12px); overflow-y: auto; -webkit-overflow-scrolling: touch;
}
.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; }
/* §5 — the Emplacement parent picker is retired (capture position = origin); the
   parent-list styles (.conversation-promote__parents/__parent/__pindent/__pglyph/
   __plabel) are removed with it. */
.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;
  /* Stay reachable when the sheet is tall/scrolled so "Créer le sujet" is never
     pushed below the fold (#15). */
  position: sticky; bottom: 0;
  background: var(--color-surface, #141418); padding-top: 10px;
}
.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;
}

/* ─── discard-draft confirm dialog (P6-F) ──────────────────────────── */
/* Centred over everything (incl. the full-screen editor, z 60) when discarding
   a non-empty draft. */
.conversation-confirm-backdrop {
  position: absolute; inset: 0; z-index: 90;
  background: rgba(0,0,0,.6); display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.conversation-confirm {
  width: 100%; max-width: 320px;
  background: var(--color-surface, #141418);
  border: 1px solid var(--color-border, #2a2a33); border-radius: 16px;
  padding: 18px 18px 14px; box-shadow: 0 14px 40px rgba(0,0,0,.6);
}
.conversation-confirm__title { font-size: 15px; font-weight: 700; }
.conversation-confirm__sub {
  font-size: 12px; color: var(--color-text-muted, #888); margin-top: 5px; line-height: 1.45;
}
.conversation-confirm__row { display: flex; gap: 8px; margin-top: 16px; }
.conversation-confirm__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-confirm__cancel { background: transparent; color: var(--color-text-muted, #888); }
.conversation-confirm__delete {
  background: var(--color-danger, #e23b5a); border-color: var(--color-danger, #e23b5a);
  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);
  position: relative;             /* anchors the absolute subject trace badge (P6-A) */
}
.conversation-hosttext--badgeonly { padding-right: 40px; }
.conversation-hosttext--badgeonly .conversation-hosttext__label { margin-bottom: 0; }
.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;
}
