/* Tiptoe Hub — CRM (listes, carte, tournées), repris de la MDP. Variables de hub.css uniquement. */

.crm-maj { font: 400 11px/1.3 var(--mono); letter-spacing: .08em; color: var(--gris-2); }
.crm-onglets { overflow-y: hidden; }
.crm-zone, .crm-onglet { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.crm-esp { flex: 1; }
.crm-nu { border: 0; background: none; padding: 0; margin: 0; font: inherit; color: inherit; cursor: pointer; }
.crm-x { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; color: var(--gris-2); }
.crm-x:hover { background: var(--brume); color: var(--encre); }
.crm-x svg.ic { width: 13px; height: 13px; }
.crm-aide { font-size: 12.5px; color: var(--gris); }
.crm-ligne { display: flex; align-items: center; gap: 6px; min-width: 0; }
.crm-pastille { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; vertical-align: middle; flex: none; }

/* ---------- barre du haut : contacts / opportunités, listes prédéfinies, mes listes ---------- */
.crm-barre-haut { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.crm-sep { width: 1px; align-self: stretch; background: var(--ligne-2); margin: 4px 2px; }
.crm-mes-listes { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.crm-puce-liste { padding: 4px 6px 4px 13px; cursor: default; }
.crm-puce-liste.on .crm-x { color: var(--gris-2); }
.crm-puce-liste.on .crm-x:hover { background: var(--gris); color: var(--carte); }

/* ---------- corps : filtres à gauche ---------- */
.crm-corps { display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 20px; align-items: start; }
.crm-filtres { position: sticky; top: 84px; display: flex; flex-direction: column; gap: 8px; max-height: calc(100vh - 104px); overflow-y: auto; padding-right: 4px; scrollbar-width: thin; scrollbar-color: var(--ligne-2) transparent; }
.crm-filtre-texte { min-width: 0; width: 100%; }
.crm-bloc { display: flex; flex-direction: column; gap: 7px; background: var(--carte); border: 1px solid var(--ligne); border-radius: var(--r); padding: 10px 12px; }
.crm-etiquette { font-size: 12px; color: var(--gris); }
.crm-case { display: flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--encre); cursor: pointer; }
.crm-bloc input:not([type="checkbox"]), .crm-select { width: 100%; min-width: 0; font-size: 13.5px; color: var(--encre); background: var(--carte); border: 1px solid var(--ligne-2); border-radius: var(--r-s); padding: 6px 8px; }
.crm-bloc input:focus, .crm-select:focus { border-color: var(--encre); outline: 0; }
.crm-bloc input.crm-montant { width: 110px; flex: none; }
.crm-ligne .crm-select { flex: 1; }
.crm-date { display: flex; flex-direction: column; gap: 4px; }
.crm-bloc .puces .puce { padding: 4px 11px; font-size: 12.5px; }

.crm-filtre { background: var(--carte); border: 1px solid var(--ligne); border-radius: var(--r); }
.crm-filtre > summary { display: flex; align-items: center; gap: 8px; padding: 8px 12px; cursor: pointer; font-size: 13.5px; font-weight: 500; list-style: none; }
.crm-filtre > summary::-webkit-details-marker { display: none; }
.crm-filtre > summary > span:first-child { flex: 1; min-width: 0; }
.crm-filtre > summary::after { content: ""; width: 6px; height: 6px; border-right: 1.5px solid var(--gris-2); border-bottom: 1.5px solid var(--gris-2); transform: rotate(-45deg); transition: transform .15s; }
.crm-filtre[open] > summary::after { transform: rotate(45deg); }
.crm-compte:not(:empty) { min-width: 20px; padding: 0 6px; border-radius: 999px; text-align: center; background: var(--encre); color: var(--carte); font: 400 11px/18px var(--mono); }
.crm-mini-recherche { width: calc(100% - 20px); margin: 0 10px 6px; font-size: 13px; border: 1px solid var(--ligne); border-radius: 999px; padding: 5px 12px; background: var(--fond); }
.crm-mini-recherche:focus { border-color: var(--encre); outline: 0; }
.crm-valeurs { max-height: 240px; overflow-y: auto; padding: 0 6px 8px; }
.crm-valeur { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 8px; padding: 3px 6px; border-radius: var(--r-s); font-size: 13px; cursor: pointer; }
.crm-valeur:hover { background: var(--brume); }
.crm-valeur-nom { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.crm-n { font: 400 11px var(--mono); color: var(--gris-2); }

/* ---------- résultat ---------- */
.crm-resultat { display: flex; flex-direction: column; gap: 10px; min-width: 0; transition: opacity .15s; }
.crm-resultat.crm-charge { opacity: .55; }
.crm-barre-resultat { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; }
.crm-chiffres { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 13.5px; color: var(--gris); }
.crm-chiffres b { color: var(--encre); font-weight: 600; font-variant-numeric: tabular-nums; }
.crm-apercu { font-size: 12.5px; color: var(--gris-2); }
.crm-table { overflow: auto; max-height: calc(100vh - 290px); min-height: 220px; overscroll-behavior: contain; }
.crm-table thead th { position: sticky; top: 0; z-index: 1; background: var(--carte); }
.crm-table td { white-space: nowrap; max-width: 320px; overflow: hidden; text-overflow: ellipsis; font-size: 13px; padding: 8px 14px; }
.crm-table tbody tr:hover td { background: var(--fond); }
.crm-table .crm-droite { text-align: right; }
.crm-triable { cursor: pointer; user-select: none; }
.crm-triable:hover, .crm-trie { color: var(--encre); }

.modale.crm-modale-large .boite { width: min(880px, 100%); }
.crm-colonnes { display: flex; flex-direction: column; gap: 16px; }
.crm-colonnes-groupe { display: flex; flex-direction: column; gap: 8px; }

/* ---------- carte ---------- */
.crm-carte-principal { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.crm-carte-outils { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.crm-carte-selection { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; background: var(--carte); border: 1px solid var(--ligne); border-radius: 999px; padding: 6px 6px 6px 16px; }
.crm-compteur { font: 400 12px var(--mono); color: var(--encre); }
.crm-carte-cadre { position: relative; isolation: isolate; height: calc(100vh - 350px); min-height: 400px; border: 1px solid var(--ligne); border-radius: var(--r); overflow: hidden; background: var(--brume); }
.crm-carte-map { position: absolute; inset: 0; background: var(--brume); }
.crm-carte-map.crm-rect, .crm-carte-map.crm-rect .leaflet-interactive { cursor: crosshair; }
.crm-legende { position: absolute; left: 10px; bottom: 24px; z-index: 500; max-width: calc(100% - 20px); display: flex; flex-wrap: wrap; gap: 4px 12px; padding: 6px 12px; font-size: 12px; background: var(--carte); border: 1px solid var(--ligne); border-radius: var(--r); box-shadow: var(--ombre); }
.crm-legende span { display: inline-flex; align-items: center; }
.crm-carte-vide { position: absolute; inset: 0; z-index: 600; display: grid; place-items: center; padding: 20px; background: color-mix(in srgb, var(--fond) 55%, transparent); }
.crm-carte-vide > div { padding: 14px 20px; background: var(--carte); border: 1px solid var(--ligne); border-radius: var(--r); box-shadow: var(--ombre); color: var(--gris); }
.crm-carte-vide b { color: var(--encre); font-weight: 600; }
.crm-tuiles { filter: saturate(.75) contrast(.96) brightness(1.03); }
.crm-ib { font: 400 12.5px/1.4 var(--police); max-width: 280px; white-space: normal; }
.crm-ib .crm-ib-meta { color: var(--gris); font-size: 12px; }

/* ---------- tournées ---------- */
.crm-tournees-grille { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 12px; }
.crm-tournee { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; padding: 14px 16px; text-align: left; font: inherit; color: var(--encre); background: var(--carte); border: 1px solid var(--ligne); border-radius: var(--r); cursor: pointer; transition: border-color .15s, box-shadow .15s; }
.crm-tournee:hover { border-color: var(--ligne-2); box-shadow: var(--ombre); }
.crm-tournee b { font-weight: 600; font-size: 15px; line-height: 1.3; }
.crm-tournee-date { font: 400 11px/1.3 var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--vert); }
.crm-tournee-stats { font-size: 13px; color: var(--gris); }
.crm-tournee-auteur { font-size: 12px; color: var(--gris-2); }
.crm-vide { display: flex; flex-direction: column; align-items: center; gap: 14px; }
.crm-vide b { color: var(--encre); font-weight: 600; }

.crm-tournee-tete { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.crm-tournee-titre { flex: 1; min-width: 220px; }
.crm-tournee-titre .surtitre { margin-bottom: 2px; }
.crm-tournee-titre h2 { font-size: 22px; }
.crm-tournee-detail { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.crm-tournee-carte { position: sticky; top: 84px; isolation: isolate; height: calc(100vh - 240px); min-height: 420px; border: 1px solid var(--ligne); border-radius: var(--r); overflow: hidden; background: var(--brume); }
.crm-tournee-cote { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.crm-totaux { display: grid; grid-template-columns: repeat(auto-fit, minmax(104px, 1fr)); gap: 8px; }
.crm-totaux .chiffre { padding: 10px 12px; }
.crm-totaux .chiffre b { font-size: 17px; white-space: nowrap; }
.crm-totaux .chiffre small { font-size: 12px; }
.crm-edition { display: flex; flex-direction: column; gap: 10px; padding: 14px; }
.crm-infos { display: grid; grid-template-columns: minmax(0, 1fr) 160px; gap: 10px; }
.crm-edition .champ textarea { min-height: 60px; }
.crm-depart select { width: 100%; }
.crm-commentaire { margin: 0; color: var(--gris); white-space: pre-wrap; }
.crm-recherche { position: relative; }
.crm-recherche .filtre { width: 100%; min-width: 0; }
.crm-resultats { position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 5; max-height: 280px; overflow-y: auto; padding: 4px; background: var(--carte); border: 1px solid var(--ligne-2); border-radius: var(--r); box-shadow: var(--ombre); }
.crm-res { display: flex; flex-direction: column; align-items: flex-start; gap: 1px; width: 100%; padding: 7px 10px; border: 0; border-radius: var(--r-s); background: none; text-align: left; cursor: pointer; font: inherit; font-size: 13.5px; color: var(--encre); }
.crm-res:hover:not(:disabled) { background: var(--brume); }
.crm-res:disabled { opacity: .5; cursor: default; }
.crm-res small { font-size: 12px; color: var(--gris); }

.crm-etapes { list-style: none; margin: 0; padding: 0; background: var(--carte); border: 1px solid var(--ligne); border-radius: var(--r); }
.crm-etape { display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; gap: 10px; align-items: start; padding: 10px 12px; border-bottom: 1px solid var(--ligne); font-size: 13.5px; background: var(--carte); }
.crm-etape:first-child { border-radius: var(--r) var(--r) 0 0; }
.crm-etape:last-child { border-bottom: 0; border-radius: 0 0 var(--r) var(--r); }
.crm-etape b { font-weight: 600; }
.crm-etape small { display: block; font-size: 12.5px; color: var(--gris); }
.crm-etape-droite { display: inline-flex; align-items: center; gap: 6px; }
.crm-km { font: 400 11.5px var(--mono); color: var(--gris); white-space: nowrap; }
.crm-num { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--encre); color: var(--carte); font: 400 11px var(--mono); border: 2px solid var(--carte); box-shadow: var(--ombre); }
.crm-num.depart { background: var(--vert); }
.crm-etape-edit { cursor: grab; user-select: none; touch-action: none; transition: background .1s; }
.crm-etape-edit:hover { background: var(--fond); }
.crm-etape-edit .crm-x { opacity: .5; }
.crm-etape-edit:hover .crm-x, .crm-etape-edit .crm-x:focus-visible { opacity: 1; }
.crm-etape.crm-glisse { cursor: grabbing; position: relative; z-index: 2; background: var(--carte); box-shadow: var(--ombre); transition: none; }
.crm-etape.crm-cible-avant { box-shadow: inset 0 3px 0 var(--bleu); }
.crm-etape.crm-cible-apres { box-shadow: inset 0 -3px 0 var(--bleu); }

/* ---------- responsive ---------- */
@media (max-width: 960px) {
  .crm-corps, .crm-tournee-detail { grid-template-columns: minmax(0, 1fr); }
  .crm-filtres { position: static; max-height: none; overflow: visible; padding-right: 0; }
  .crm-carte-cadre { height: 62vh; min-height: 360px; }
  .crm-tournee-carte { position: relative; top: 0; height: 46vh; min-height: 300px; }
  .crm-table { max-height: 70vh; }
}
@media (max-width: 640px) {
  .crm-infos { grid-template-columns: minmax(0, 1fr); }
  .crm-carte-selection { border-radius: var(--r); }
  .crm-sep { display: none; }
  .crm-etape { grid-template-columns: 28px minmax(0, 1fr); }
  .crm-etape-droite { grid-column: 2; }
}
