/* Écran « Contacts » : rattachements en libellés, fenêtre d'une personne, recherche d'une personne à rattacher, doublons et fusion.
   Aucune valeur en dur : variables du thème (app.css). */
.ct-ratts { display: flex; flex-direction: column; gap: var(--s-1); }
.ct-ratt { display: inline-flex; align-items: center; flex-wrap: wrap; gap: var(--s-1) var(--s-2); }
.ct-projets { display: flex; flex-wrap: wrap; gap: var(--s-1) var(--s-3); font-variant-numeric: tabular-nums; }
.ct-plus { display: flex; justify-content: center; padding: var(--s-3) 0; }
.ct-plus:empty { display: none; }

/* Fenêtre d'une personne */
.ct-fiche { display: flex; flex-direction: column; gap: var(--s-4); }
.ct-section { display: flex; flex-direction: column; gap: var(--s-2); }
.ct-lignes { display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: var(--r-md); }
.ct-ligne { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: var(--s-2) var(--s-3); padding: var(--s-2) var(--s-3); border-bottom: 1px solid var(--border); }
.ct-ligne:last-child { border-bottom: 0; }
.ct-ligne-lib { display: inline-flex; align-items: center; flex-wrap: wrap; gap: var(--s-1) var(--s-2); min-width: 0; }
.ct-autres { margin: 0; }

/* « Rattacher un contact existant » */
.ct-picker { display: flex; flex-direction: column; gap: var(--s-3); }
.ct-picker-liste { display: flex; flex-direction: column; min-height: var(--s-6); max-height: calc(var(--s-7) * 5); overflow-y: auto; border: 1px solid var(--border); border-radius: var(--r-md); }
.ct-picker-liste:empty { display: none; }
.ct-picker-ligne { display: flex; flex-direction: column; align-items: flex-start; gap: var(--s-1); padding: var(--s-2) var(--s-3); border: 0; border-bottom: 1px solid var(--border); background: transparent; color: var(--fg); text-align: left; cursor: pointer; }
.ct-picker-ligne:last-child { border-bottom: 0; }
.ct-picker-ligne:hover:not(:disabled), .ct-picker-ligne.on { background: var(--surface2); }
.ct-picker-ligne.on { box-shadow: inset 3px 0 0 var(--accent); }
.ct-picker-ligne:disabled { cursor: default; opacity: .6; }
.ct-picker-vide { padding: var(--s-3); }
.ct-picker-reglages { display: flex; flex-wrap: wrap; gap: var(--s-2); }
.ct-picker-reglages select { flex: 1 1 10rem; min-width: 0; }

/* Doublons possibles */
.ct-doublons { display: flex; flex-direction: column; gap: var(--s-4); }
.ct-doublon { border: 1px solid var(--border); border-radius: var(--r-md); }
.ct-doublon-mail { padding: var(--s-2) var(--s-3); background: var(--surface2); border-bottom: 1px solid var(--border); font-family: var(--font-mono); }
.ct-doublon-ligne { display: flex; align-items: flex-start; flex-wrap: wrap; gap: var(--s-2) var(--s-3); padding: var(--s-2) var(--s-3); border-bottom: 1px solid var(--border); cursor: pointer; }
.ct-doublon-ligne input[type=radio] { width: var(--s-4); height: var(--s-4); min-height: 0; padding: 0; margin-top: var(--s-1); flex: none; }
.ct-doublon-nom { min-width: 10rem; }
.ct-doublon-pied { display: flex; justify-content: flex-end; padding: var(--s-2) var(--s-3); }

@media (max-width: 640px) {
  .ct-ligne .btn { margin-left: auto; }
}

/* Nom de contact cliquable (ouvre la fenêtre « fiche contact ») : un bouton qui garde l'apparence d'un lien */
.ct-nom-lien { border: 0; background: transparent; padding: 0; font: inherit; font-weight: inherit; text-align: left; cursor: pointer; }
.ct-nom-lien:focus-visible { outline: var(--s-1) solid var(--accent); outline-offset: var(--s-1); border-radius: var(--r-sm); }
.infos-v .ct-nom-lien { font-weight: inherit; }
.ct-gi-plus { color: var(--muted); font-size: inherit; }

/* Fenêtre « fiche contact » : valeur, lien et bouton Copier sur chaque ligne */
.ct-valeurs { display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: var(--r-md); }
.ct-valeur { display: grid; grid-template-columns: 7rem minmax(0, 1fr) auto; align-items: center; gap: var(--s-2) var(--s-3); padding: var(--s-2) var(--s-3); border-bottom: 1px solid var(--border); }
.ct-valeur:last-child { border-bottom: 0; }
.ct-valeur-lib { color: var(--muted); }
.ct-valeur-val { min-width: 0; overflow-wrap: anywhere; }
.ct-commentaire { color: var(--muted); white-space: pre-line; }
.ct-section-tete { display: flex; align-items: center; justify-content: space-between; gap: var(--s-2); }
.ct-section-titre { grid-column: 1 / -1; margin-top: var(--s-2); }

/* Champ GI / GT du formulaire de l'actif : recherche d'un contact du client ou création sur place */
.ct-gest { grid-column: 1 / -1; }
.ct-gest-champ { display: flex; gap: var(--s-2); align-items: center; }
.ct-gest-champ input { flex: 1 1 auto; min-width: 0; }
.ct-gest-champ .btn { flex: none; white-space: nowrap; }
.ct-gest-nouveau { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s-2); margin-top: var(--s-2); }
.ct-gest-nouveau[hidden] { display: none; }
.ct-gest .ct-gest-nouveau input { width: 100%; }

@media (max-width: 640px) {
  .ct-valeur { grid-template-columns: minmax(0, 1fr) auto; }
  .ct-valeur-lib { grid-column: 1 / -1; }
  .ct-gest-nouveau { grid-template-columns: minmax(0, 1fr); }
}

/* Choix de l'ancien GI / GT quand on le remplace ou qu'on vide le champ */
.ct-gest-ancien { margin-top: var(--s-2); width: 100%; }
.ct-gest-ancien[hidden] { display: none; }
.ct-doublon-pied .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; }
