/* ============================================================
   clients.css — Fiches clients (CRM) : suggestions et page CRM
   S'appuie sur les couleurs de styles.css (--surface, --accent…).
   ============================================================ */

/* ── Suggestions pendant la frappe ─────────────────────────── */
.crm-suggest {
  position: fixed;
  z-index: 1000;
  max-width: min(28rem, calc(100vw - 16px));
  margin: 0;
  padding: 0.3rem;
  list-style: none;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border-strong);
  border-radius: 0.7rem;
  box-shadow: var(--shadow-lg);
}
.crm-suggest[hidden] { display: none; }
.crm-suggest-titre {
  padding: 0.3rem 0.6rem 0.25rem;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-faint);
}
.crm-suggest-item {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.45rem 0.6rem;
  border-radius: 0.45rem;
  cursor: pointer;
}
.crm-suggest-item:hover,
.crm-suggest-item.actif { background: var(--accent-soft); }
.crm-suggest-nom { font-size: 0.88rem; font-weight: 600; }
.crm-suggest-info { font-size: 0.75rem; color: var(--text-muted); white-space: nowrap; }

/* ── Page CRM ──────────────────────────────────────────────── */
.crm-barre { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem; }
.crm-recherche { flex: 1 1 16rem; max-width: 26rem; }
.crm-barre .pot-filters { align-self: center; }

.crm-table { min-width: 860px; }
.crm-table td { padding: 0.6rem 0.85rem; font-size: 0.9rem; overflow-wrap: anywhere; }
.crm-table td.crm-vide { color: var(--text-faint); }
.crm-table tbody tr { cursor: pointer; }
.crm-table tbody tr.empty-row { cursor: default; }
.crm-nom { font-weight: 600; }
.crm-fiches { font-size: 0.8rem; color: var(--text-muted); }
.crm-badge {
  display: inline-block;
  margin-left: 0.4rem;
  padding: 0.1rem 0.45rem;
  border-radius: 0.4rem;
  background: var(--warning-soft);
  color: var(--warning);
  font-size: 0.7rem;
  font-weight: 700;
  vertical-align: middle;
}
.crm-aide { font-size: 0.82rem; color: var(--text-muted); }

/* Dialogues (fiche, import) */
.crm-dialog { max-width: 46rem; max-height: calc(100vh - 2rem); overflow: auto; }
.crm-dialog-large { max-width: 64rem; }
.crm-dialog textarea.pot-input { min-height: 4.5rem; resize: vertical; }
.crm-ligne-titre { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; }
.crm-section { display: flex; flex-direction: column; gap: 0.5rem; padding-top: 0.9rem; border-top: 1px solid var(--border); }
.crm-section h3 { font-size: 0.85rem; font-weight: 800; }
.crm-section[hidden] { display: none; }
.crm-histo { display: flex; flex-direction: column; gap: 0.3rem; margin: 0; padding: 0; list-style: none; }
.crm-histo li {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.25rem 1rem;
  padding: 0.45rem 0.6rem;
  border-radius: 0.5rem;
  background: var(--surface-2);
  font-size: 0.84rem;
}
.crm-histo-meta { color: var(--text-muted); font-size: 0.78rem; }
.crm-histo-vide { font-size: 0.84rem; font-style: italic; color: var(--text-faint); }
.crm-semblable { align-items: center; }
.crm-semblable .btn { padding: 0.3rem 0.6rem; font-size: 0.78rem; }
.crm-rgpd { font-size: 0.78rem; color: var(--text-muted); }
.crm-dialog .pot-dialog-actions { flex-wrap: wrap; }
.crm-dialog .pot-dialog-actions .crm-gauche { margin-right: auto; }
.crm-message { font-size: 0.82rem; font-weight: 600; color: var(--accent-strong); }
.dark .crm-message { color: var(--accent); }
.crm-message[hidden] { display: none; }
.btn[hidden] { display: none; }

/* Aperçu de l'import */
.crm-import-wrap { max-height: 55vh; }
.crm-import-table { min-width: 860px; }
.crm-import-table td { padding: 0.25rem 0.4rem; font-size: 0.85rem; }
.crm-import-table td.crm-import-src { padding: 0.4rem 0.6rem; font-size: 0.76rem; color: var(--text-muted); }
.crm-import-table .cell-input { padding: 0.4rem 0.5rem; font-size: 0.85rem; }
.crm-import-table tr.crm-import-off td { opacity: 0.45; }
.crm-import-table input[type="checkbox"] { width: 1rem; height: 1rem; accent-color: var(--accent); }
.crm-import-existant { font-size: 0.8rem; font-weight: 600; color: var(--text-muted); padding: 0.4rem 0.5rem; }

@media (max-width: 640px) {
  .crm-dialog .pot-field-row { grid-template-columns: 1fr; }
}
