/* Multipicker — remplaçant des <select multiple> (option B validée par Florian).
   Base v1 restaurée le 14-07 : champ replié + panneau avec BARRE DE RECHERCHE dédiée, Tout/Aucun
   et LISTE COMPLÈTE. SEUL changement : PLUS DE CASE À COCHER — l'état choisi d'une ligne se voit
   au style (fond doux + texte accent + ✓ textuel).
   Chargé globalement (base.html) : le même composant pour Agro, Com et Reco.
   Le <select> natif reste dans le DOM comme source de vérité : on le masque SEULEMENT
   quand le JS a pris la main (.mp-native), pour que la liste native reste utilisable
   si le JS ne tourne pas. */
select.mp-native { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

.mp { position: relative; width: 100%; max-width: 420px; }

.mp-btn { width: 100%; display: flex; align-items: center; gap: 8px; text-align: left;
  padding: 8px 11px; min-height: 44px; box-sizing: border-box;
  border: 1.5px solid var(--line); border-radius: 11px; background: var(--panel);
  color: var(--ink); font: inherit; font-size: .9rem; cursor: pointer; }
.mp-btn:hover { border-color: var(--reco); }
.mp-btn[aria-expanded="true"] { border-color: var(--reco); }
.mp-btn:focus-visible { outline: 2px solid var(--reco); outline-offset: 2px; }
.mp-sum { flex: 1; display: flex; flex-wrap: wrap; gap: 5px; align-items: center; min-width: 0; }
.mp-ph { color: var(--muted); }
.mp-car { color: var(--muted); font-size: .8rem; flex: none; }

.mp-chip { display: inline-flex; align-items: center; gap: 4px; max-width: 100%;
  padding: 2px 3px 2px 9px; border-radius: 999px; background: var(--reco-soft);
  color: var(--reco-d); font-size: .78rem; font-weight: 700; }
.mp-chip b { font-weight: 700; overflow: hidden; text-overflow: ellipsis;
  white-space: nowrap; max-width: 160px; }
.mp-chip.mp-mas { padding: 2px 9px; }
.mp-x { border: 0; background: none; color: inherit; font: inherit; line-height: 1;
  cursor: pointer; padding: 2px 5px; border-radius: 999px; opacity: .7; }
.mp-x:hover { opacity: 1; background: rgba(0, 0, 0, .08); }

.mp-pop { position: absolute; z-index: 90; top: calc(100% + 6px); left: 0; right: 0;
  display: none; padding: 10px; background: var(--panel);
  border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); }
.mp-pop.on { display: block; }

.mp-search { width: 100%; box-sizing: border-box; padding: 9px 11px; min-height: 40px;
  border: 1.5px solid var(--line); border-radius: 9px; background: var(--bg);
  color: var(--ink); font: inherit; font-size: .88rem; }
.mp-search:focus { outline: 2px solid var(--reco); outline-offset: -1px; }

.mp-acts { display: flex; align-items: center; gap: 8px; margin: 8px 2px; }
.mp-lnk { border: 0; background: none; color: var(--reco-d); font: inherit; font-size: .78rem;
  font-weight: 700; cursor: pointer; padding: 3px 5px; border-radius: 6px; }
.mp-lnk:hover { text-decoration: underline; }
.mp-lnk:focus-visible { outline: 2px solid var(--reco); outline-offset: 1px; }
.mp-count { margin-left: auto; font-size: .75rem; font-weight: 600; color: var(--muted);
  font-variant-numeric: tabular-nums; }

.mp-list { display: flex; flex-direction: column; gap: 1px;
  max-height: 340px; overflow-y: auto; scrollbar-width: thin; }
.mp-opt { display: flex; align-items: center; gap: 10px; padding: 9px 8px; min-height: 42px;
  border-radius: 8px; cursor: pointer; font-size: .88rem; color: var(--ink);
  -webkit-user-select: none; user-select: none; }
.mp-opt:hover { background: var(--line-2); }
.mp-txt { flex: 1; min-width: 0; }
/* ligne choisie : PAS de case — fond doux + texte accent + ✓ textuel en fin de ligne */
.mp-opt.mp-sel { background: var(--reco-soft); color: var(--reco-d); font-weight: 700; }
.mp-opt.mp-sel:hover { background: var(--reco-soft); }
.mp-tick { flex: none; width: 16px; text-align: center; color: var(--reco-d);
  font-weight: 800; font-size: .95rem; }
.mp-none { padding: 14px 8px; color: var(--muted); font-size: .85rem; }

/* mobile : le panneau prend toute la largeur du champ, cibles tactiles généreuses */
@media (max-width: 640px) {
  .mp { max-width: none; }
  .mp-list { max-height: 46vh; }
  .mp-opt { min-height: 46px; font-size: .92rem; }
}

/* plafond atteint (Benchmark : 3 parcelles maxi, borné aussi côté serveur) */
.mp-opt.mp-off { opacity: .42; cursor: not-allowed; }
.mp-opt.mp-off:hover { background: none; }
.mp-count.mp-full { color: var(--reco-d); }
