/* CONVERSATIONS — Mon Invoice (conversations.js) */

.conv-pastille {
  display: inline-block;
  min-width: 18px;
  height: 18px;
  margin-left: 6px;
  padding: 0 5px;
  border-radius: 9px;
  background: #dc2626;
  color: #fff;
  font: 700 11px/18px Arial, sans-serif;
  text-align: center;
  vertical-align: middle;
}
.conv-pastille[hidden] { display: none; }

.conv-fond {
  position: fixed;
  inset: 0;
  z-index: 3000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(15, 23, 42, .5);
}
.conv-fond[hidden] { display: none; }

.conv-fenetre {
  display: flex;
  flex-direction: column;
  width: min(980px, 100%);
  height: min(720px, calc(100vh - 32px));
  overflow: hidden;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 20px 50px rgba(15, 23, 42, .3);
  color: #1f2937;
  font-size: 14px;
}

.conv-entete {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 18px;
  background: #1f3a68;
  color: #fff;
}
.conv-entete h2 { margin: 0; font-size: 17px; }
.conv-x { width: 36px; height: 36px; border: 0; border-radius: 8px; background: rgba(255, 255, 255, .15); color: #fff; font-size: 22px; cursor: pointer; }

.conv-onglets { display: flex; gap: 4px; padding: 8px 12px 0; border-bottom: 1px solid #e2e8f0; background: #f8fafc; }
.conv-onglets button {
  min-height: 40px;
  padding: 0 16px;
  border: 0;
  border-bottom: 3px solid transparent;
  background: none;
  color: #475569;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}
.conv-onglets button.actif { border-bottom-color: #244d9b; color: #1f3a68; }

.conv-corps { flex: 1 1 auto; min-height: 0; }
.conv-vide { margin: 0; padding: 24px 16px; color: #64748b; text-align: center; line-height: 1.5; }

.conv-bouton {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #fff;
  color: #1f2937;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
}
.conv-bouton:hover:not(:disabled) { border-color: #244d9b; }
.conv-bouton:disabled { opacity: .4; cursor: not-allowed; }
.conv-bouton.conv-vert { border-color: #16a34a; background: #16a34a; color: #fff; }
.conv-bouton.conv-danger { color: #b91c1c; }

.conv-avatar {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #e0eaff;
  color: #1d4ed8;
  font-weight: 800;
}

/* ----- En ligne ----- */
.conv-enligne { display: grid; grid-template-columns: 320px minmax(0, 1fr); }
.conv-liste { display: flex; flex-direction: column; min-height: 0; border-right: 1px solid #e2e8f0; }
.conv-liste-tete { display: grid; gap: 8px; padding: 12px; border-bottom: 1px solid #e2e8f0; }
.conv-liste-tete p { margin: 0; color: #64748b; font-size: 12.5px; }
#conv-liste-items { flex: 1 1 auto; overflow-y: auto; }

.conv-item {
  display: flex;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  border: 0;
  border-bottom: 1px solid #f1f5f9;
  background: #fff;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.conv-item:hover { background: #f8fafc; }
.conv-item.actif { background: #eef4ff; }
.conv-item-texte { display: grid; gap: 2px; flex: 1 1 auto; min-width: 0; }
.conv-item-ligne { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-width: 0; }
.conv-item-ligne small { flex: 0 0 auto; color: #94a3b8; font-size: 11.5px; }
.conv-item-ligne strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conv-apercu { overflow: hidden; color: #64748b; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.conv-item.non-lu .conv-apercu { color: #0f1f3d; font-weight: 700; }
.conv-ref { color: #1d4ed8; font-size: 11.5px; font-weight: 700; }

.conv-fil-zone { display: flex; flex-direction: column; min-height: 0; background: #f8fafc; }
.conv-vide-fil { margin: auto; }
.conv-fil-tete { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid #e2e8f0; background: #fff; }
.conv-fil-tete > div:nth-child(2) { display: grid; flex: 1 1 auto; min-width: 0; }
.conv-fil-tete small { color: #64748b; }
.conv-fil-actions { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
.conv-retour { display: none; width: 36px; height: 36px; border: 0; border-radius: 8px; background: #f1f5f9; font-size: 18px; cursor: pointer; }

.conv-fil { display: flex; flex-direction: column; gap: 8px; flex: 1 1 auto; overflow-y: auto; padding: 14px; }
.conv-bulle { max-width: 75%; padding: 8px 12px; border-radius: 14px; line-height: 1.4; }
.conv-bulle p { margin: 0; overflow-wrap: anywhere; }
.conv-bulle small { display: block; margin-top: 3px; font-size: 11px; opacity: .75; }
.conv-bulle.client { align-self: flex-start; border-bottom-left-radius: 4px; background: #fff; box-shadow: 0 1px 2px rgba(15, 23, 42, .08); }
.conv-bulle.moi { align-self: flex-end; border-bottom-right-radius: 4px; background: #244d9b; color: #fff; }
.conv-bulle.moi .conv-ref { color: #dbeafe; }

.conv-saisie { display: flex; gap: 8px; align-items: flex-end; padding: 10px 14px; border-top: 1px solid #e2e8f0; background: #fff; }
.conv-saisie textarea { flex: 1 1 auto; min-height: 44px; max-height: 140px; padding: 10px 12px; border: 1px solid #cbd5e1; border-radius: 12px; font: inherit; resize: vertical; }
.conv-envoyer { width: 48px; height: 44px; border: 0; border-radius: 12px; background: #244d9b; color: #fff; font-size: 18px; cursor: pointer; }
.conv-envoyer:disabled { opacity: .5; }

/* ----- Contacter ----- */
.conv-contacter { display: flex; flex-direction: column; overflow: hidden; }
.conv-contacter-tete { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; padding: 12px 14px; border-bottom: 1px solid #e2e8f0; }
.conv-contacter-tete input { flex: 1 1 260px; min-height: 40px; padding: 0 12px; border: 1px solid #cbd5e1; border-radius: 8px; font: inherit; }
.conv-message-type { display: grid; gap: 3px; color: #64748b; font-size: 12px; font-weight: 600; }
.conv-message-type select { min-height: 40px; padding: 0 8px; border: 1px solid #cbd5e1; border-radius: 8px; font: inherit; color: #1f2937; }
#conv-contacts { flex: 1 1 auto; overflow-y: auto; }
.conv-contacts { margin: 0; padding: 0; list-style: none; }
.conv-contact { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 12px; padding: 10px 14px; border-bottom: 1px solid #f1f5f9; }
.conv-contact-texte { display: grid; gap: 2px; flex: 1 1 220px; min-width: 0; }
.conv-contact-texte small { color: #64748b; }
.conv-dernier { color: #15803d !important; font-weight: 600; }
.conv-contact-actions { display: flex; flex-wrap: wrap; gap: 6px; }

/* ----- Notifications ----- */
.conv-toasts { position: fixed; left: 16px; top: 16px; z-index: 100000; display: grid; gap: 10px; max-width: min(380px, calc(100vw - 32px)); }
.conv-toast { display: grid; gap: 4px; padding: 12px 14px; border-left: 5px solid #244d9b; border-radius: 10px; background: #fff; box-shadow: 0 12px 30px rgba(15, 23, 42, .22); font-size: 14px; }
.conv-toast strong { color: #0f1f3d; }
.conv-toast span { overflow: hidden; color: #334155; text-overflow: ellipsis; white-space: nowrap; }
.conv-toast-actions { display: flex; justify-content: space-between; gap: 8px; margin-top: 4px; }
.conv-toast-actions button { min-height: 32px; padding: 0 10px; border: 1px solid #cbd5e1; border-radius: 7px; background: #fff; font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; }
.conv-toast-actions [data-conv-toast="ouvrir"] { border-color: #244d9b; background: #244d9b; color: #fff; }

/* ----- Téléphone ----- */
@media (max-width: 760px) {
  .conv-fond { padding: 0; }
  .conv-fenetre { width: 100%; height: 100%; border-radius: 0; }
  .conv-enligne { grid-template-columns: 1fr; }
  .conv-enligne .conv-fil-zone { display: none; }
  .conv-enligne.avec-fil .conv-liste { display: none; }
  .conv-enligne.avec-fil .conv-fil-zone { display: flex; }
  .conv-retour { display: inline-block; }
  .conv-fil-tete { flex-wrap: wrap; }
  .conv-fil-actions { width: 100%; justify-content: flex-start; }
  .conv-bulle { max-width: 85%; }
  .conv-contact-actions .conv-bouton span { display: none; }
  .conv-contact-actions .conv-bouton { width: 44px; padding: 0; font-size: 16px; }
}
