/* ============================================================
   Onglet Messagerie (Plan 23a) — layout 2-panneaux,
   sidebar + stream + composer. Palette B&M.
   ============================================================ */

/* ─── Badge unread sur l'onglet nav ─── */
.nav-unread-badge {
  display: inline-block;
  background: var(--terracotta);
  color: #fff;
  font-size: 10px;
  font-weight: 600;
  border-radius: 10px;
  padding: 1px 7px;
  margin-left: 4px;
  min-width: 14px;
  text-align: center;
  vertical-align: middle;
}

/* ─── Layout 2-panneaux ─── */
.msg-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 16px;
  height: calc(100vh - 200px);
  min-height: 480px;
}

/* ─── Sidebar gauche ─── */
.msg-sidebar {
  background: var(--bg-card);
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.msg-sidebar-head {
  padding: 14px 14px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line-soft);
}
.msg-sidebar-head strong {
  font-family: 'Fraunces', serif;
  font-size: 15px;
}
.msg-newchan-btn {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink-soft);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  font-family: inherit;
}
.msg-newchan-btn:hover {
  background: var(--bois-dark);
  border-color: var(--bois-dark);
  color: #fff;
}
.msg-section { padding: 8px 0; border-bottom: 1px solid var(--line-soft); }
.msg-section:last-child { border-bottom: none; flex: 1; overflow-y: auto; }
.msg-section-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--ink-mute);
  padding: 4px 14px 6px;
  font-weight: 500;
}
.msg-collapsible { cursor: pointer; user-select: none; display: flex; align-items: center; gap: 4px; }
.msg-collapse-arrow {
  display: inline-block;
  transition: transform 0.15s;
  font-size: 8px;
}
.msg-section.is-open .msg-collapse-arrow { transform: rotate(90deg); }

.msg-section-list { display: flex; flex-direction: column; }

/* Item canal */
.msg-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 14px;
  cursor: pointer;
  font-size: 13px;
  color: var(--ink-soft);
  border-left: 2px solid transparent;
}
.msg-item:hover { background: var(--bg-warm); }
.msg-item.is-active {
  background: var(--bg-warm);
  border-left-color: var(--terracotta);
  color: var(--ink-dark);
  font-weight: 500;
}
.msg-item.is-archived { color: var(--ink-mute); font-style: italic; }
.msg-item-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.msg-item-badge {
  background: var(--terracotta);
  color: #fff;
  font-size: 10px;
  font-weight: 600;
  border-radius: 10px;
  padding: 1px 6px;
  margin-left: 6px;
  min-width: 14px;
  text-align: center;
}

/* ─── Main right (canal sélectionné) ─── */
.msg-main {
  background: var(--bg-card);
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.msg-header {
  padding: 14px 18px;
  border-bottom: 1px solid var(--line-soft);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
#msg-archive-btn {
  font-size: 12px;
  padding: 4px 10px;
  flex-shrink: 0;
}
.msg-header h3 {
  font-family: 'Fraunces', serif;
  font-size: 17px;
  font-weight: 500;
  margin: 0;
}
.msg-header-hint {
  font-size: 12px;
  color: var(--ink-mute);
  margin: 4px 0 0;
}

.msg-stream {
  flex: 1;
  overflow-y: auto;
  padding: 14px 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.msg-empty {
  color: var(--ink-mute);
  font-size: 13px;
  text-align: center;
  padding: 48px 0;
}
.msg-load-more {
  text-align: center;
  padding: 8px 0;
}
.msg-load-more button {
  font-size: 12px;
  background: none;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 4px 12px;
  cursor: pointer;
  color: var(--ink-soft);
  font-family: inherit;
}

/* Bulle de message */
.msg-row {
  display: grid;
  grid-template-columns: 34px 1fr;
  gap: 10px;
  align-items: flex-start;
}
.msg-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--bois);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.msg-bubble { min-width: 0; }
.msg-meta {
  font-size: 12px;
  color: var(--ink-mute);
  margin-bottom: 2px;
}
.msg-meta strong { color: var(--ink-dark); font-weight: 500; margin-right: 6px; }
.msg-content {
  font-size: 13px;
  line-height: 1.5;
  color: var(--ink-dark);
  white-space: pre-wrap;
  word-break: break-word;
}

/* Composer */
.msg-composer {
  border-top: 1px solid var(--line-soft);
  padding: 10px 14px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: flex-end;
}
.msg-composer textarea {
  font-family: inherit;
  font-size: 13px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 10px;
  resize: none;
  background: #fff;
  color: var(--ink-dark);
}
.msg-composer textarea:focus {
  outline: none;
  border-color: var(--bois);
}
.msg-archived-notice {
  border-top: 1px solid var(--line-soft);
  padding: 12px 14px;
  font-size: 13px;
  color: var(--ink-mute);
  text-align: center;
  background: var(--bg-warm);
}

/* Modale création canal — checkboxes alignées verticalement sur la même colonne x. */
.pe-chan-roles {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
}
.pe-chan-roles label {
  font-size: 13px;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  cursor: pointer;
  margin: 0;
  /* Labels alignés à gauche — pas de centrage ni de répartition */
  text-align: left;
  width: auto;
}
.pe-chan-roles input[type="checkbox"] {
  margin: 0;
  flex-shrink: 0;       /* la case ne se compresse pas selon la longueur du label */
  width: 16px;
  height: 16px;
}
