/* ==========================================================================
   Messagerie — conversation, pas liste

   La version précédente empilait des cartes titrées « Vous » / « Support », ce
   qui se lit comme un journal d'événements. Une conversation se reconnaît à
   trois choses : des bulles, un côté par interlocuteur, et la zone d'écriture
   en bas — là où l'œil arrive après avoir lu.
   ========================================================================== */

.conversation { display: flex; flex-direction: column; }

.conversation__fil {
  display: flex;
  flex-direction: column;
  gap: .5rem;
  max-height: 58vh;
  overflow-y: auto;
  padding-right: .25rem;
  /* Le défilement s'ancre en bas : un nouveau message ne fait pas sauter la
     lecture vers le haut. */
  overflow-anchor: auto;
}

.conversation__jour {
  align-self: center;
  margin: .6rem 0 .2rem;
}

.conversation__jour span {
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-muted);
  background: var(--bg);
  padding: .2rem .6rem;
  border-radius: 999px;
}

/* --- Les bulles ----------------------------------------------------------- */

.bulle {
  max-width: min(80%, 34rem);
  align-self: flex-start;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 14px 14px 14px 4px;
  padding: .55rem .8rem .35rem;
  display: grid;
  gap: .15rem;
}

/* Ses propres messages à droite, dans la couleur d'accent : le côté suffit à
   savoir qui parle, sans lire l'étiquette. */
.bulle--mienne {
  align-self: flex-end;
  background: color-mix(in srgb, var(--accent, #1a7f5a) 14%, var(--surface));
  border-color: color-mix(in srgb, var(--accent, #1a7f5a) 30%, var(--border));
  border-radius: 14px 14px 4px 14px;
}

.bulle__auteur {
  font-size: .72rem;
  font-weight: 600;
  color: var(--text-muted);
}

.bulle__texte {
  margin: 0;
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.bulle__heure {
  font-size: .68rem;
  color: var(--text-muted);
  justify-self: end;
  font-variant-numeric: tabular-nums;
}

/* --- La zone d'écriture --------------------------------------------------- */

.composeur {
  display: flex;
  align-items: flex-end;
  gap: .5rem;
  padding: .75rem 1.1rem 1.1rem;
  border-top: 1px solid var(--border);
}

.composeur textarea {
  flex: 1;
  resize: none;
  min-height: 2.6rem;
  max-height: 12rem;
  line-height: 1.5;
  padding: .6rem .8rem;
}

.composeur .btn { flex-shrink: 0; }

/* --- Boîte du support ----------------------------------------------------- */

.msg-support {
  display: grid;
  grid-template-columns: minmax(14rem, 20rem) 1fr;
  gap: 1rem;
  align-items: start;
}

.msg-support__fils {
  display: grid;
  gap: .35rem;
  max-height: 72vh;
  overflow-y: auto;
}

.fil {
  display: grid;
  gap: .15rem;
  padding: .65rem .8rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: inherit;
  text-decoration: none;
}

.fil:hover { border-color: var(--accent, #1a7f5a); }

.fil.est-actif {
  border-color: var(--accent, #1a7f5a);
  box-shadow: inset 3px 0 0 var(--accent, #1a7f5a);
}

.fil__tete {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
}

.fil__apercu {
  margin: 0;
  font-size: .82rem;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.fil__quand {
  font-size: .7rem;
  color: var(--text-muted);
}

.msg-support__fil { display: flex; flex-direction: column; }

/* Sur mobile, la liste des fils passe au-dessus et se comprime : deux
   colonnes de 8 rem ne servent personne. */
@media (max-width: 860px) {
  .msg-support { grid-template-columns: 1fr; }
  .msg-support__fils { max-height: 16rem; }
  .conversation__fil { max-height: 50vh; }
  .bulle { max-width: 92%; }
}
