:root {
  --encre: #02060a;
  --encre-2: #5b6168;
  --encre-3: #9aa0a6;
  --fond: #ffffff;
  --fond-2: #f2f3f5;
  --trait: #e6e8eb;
  --trait-fort: #d3d6db;
  --bleu: #2f6bff;
  --bleu-pale: #eaf0ff;
  --bleu-encre: #1a3fa3;
  --rouge: #d92d20;
  --orange: #b45309;
  --vert: #12a150;
  --rayon: 16px;
  --rayon-petit: 12px;
  --ressort: cubic-bezier(0.32, 0.72, 0, 1);
  --barre: 64px;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-feature-settings: "cv11", "ss01";
  color: var(--encre);
  background: var(--fond);
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}
@supports (font-variation-settings: normal) {
  :root { font-family: "InterVariable", "Inter", -apple-system, BlinkMacSystemFont, sans-serif; }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-size: 16px; line-height: 1.45; min-height: 100dvh; overflow-x: hidden; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; }
svg.i { width: 22px; height: 22px; flex: none; display: block; }

main {
  max-width: 720px;
  margin: 0 auto;
  padding: calc(env(safe-area-inset-top) + 16px) 16px calc(env(safe-area-inset-bottom) + var(--barre) + 32px);
}
h1 { font-size: 32px; line-height: 1.1; letter-spacing: -0.02em; font-weight: 700; margin: 8px 0 16px; }
h2 { font-size: 20px; letter-spacing: -0.01em; font-weight: 600; margin: 32px 0 8px; }
h3 { font-size: 13px; font-weight: 600; color: var(--encre-2); margin: 24px 0 8px; }
.discret { color: var(--encre-2); }
.petit { font-size: 14px; }
.vide { color: var(--encre-2); text-align: center; padding: 48px 16px; }
.press { transition: transform 120ms ease-out, background-color 150ms ease, color 150ms ease, opacity 200ms ease; touch-action: manipulation; }
.press:active { transform: scale(0.97); }

/* ---------- Barre du bas ---------- */
.barre-bas {
  position: fixed; inset: auto 0 0 0; z-index: 30;
  display: grid; grid-template-columns: repeat(4, 1fr);
  padding: 6px 4px calc(env(safe-area-inset-bottom) + 6px);
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-top: 1px solid var(--trait);
  transition: transform 340ms var(--ressort), opacity 200ms ease;
}
html[data-conv-open] .barre-bas { transform: translate3d(0, calc(100% + 24px), 0); opacity: 0; pointer-events: none; }
.barre-bas a {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px;
  min-height: 48px; justify-content: center; text-decoration: none; font-size: 11px; font-weight: 500; color: var(--encre-3);
}
.barre-bas a.actif { color: var(--encre); }
.barre-bas svg { width: 25px; height: 25px; }
.barre-bas .ic { position: relative; display: block; width: 25px; height: 25px; }
.barre-bas .ic > span { position: absolute; inset: 0; transition: opacity 200ms ease, transform 200ms ease; }
.barre-bas .actif-ic { opacity: 0; transform: scale(0.85); }
.barre-bas a.actif .actif-ic { opacity: 1; transform: none; }
.barre-bas a.actif .repos { opacity: 0; }
.barre-bas .marque { display: none; }
.pastille {
  position: absolute; top: 2px; left: calc(50% + 8px);
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  background: var(--bleu); color: #fff; font-size: 11px; line-height: 18px; text-align: center; font-weight: 600;
}
.pastille.point { min-width: 10px; width: 10px; height: 10px; padding: 0; top: 6px; }
#pt-tel { background: var(--rouge); }

/* ---------- Éléments ---------- */
.carte { background: var(--fond); border: 1px solid var(--trait); border-radius: var(--rayon); padding: 16px; margin: 0 0 12px; }
.groupe { background: var(--fond-2); border-radius: var(--rayon-petit); overflow: hidden; }
.groupe > * + * { border-top: 1px solid var(--trait); }
.rangee { display: flex; align-items: center; gap: 12px; padding: 12px 14px; min-height: 48px; text-decoration: none; }
.rangee .etire { flex: 1; min-width: 0; }
.entre { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }

.bouton {
  appearance: none; border: 0; cursor: pointer;
  min-height: 44px; padding: 0 18px; border-radius: 22px;
  background: var(--fond-2); color: var(--encre); font-weight: 600; font-size: 16px;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; text-decoration: none;
}
.bouton[disabled] { opacity: 0.4; pointer-events: none; }
.bouton.principal { background: var(--bleu); color: #fff; }
.bouton.danger { background: transparent; color: var(--rouge); }
.bouton.plein { width: 100%; }
.bouton.petit { min-height: 32px; padding: 0 12px; font-size: 14px; border-radius: 16px; }
.boutons { display: flex; gap: 8px; margin-top: 12px; }
.boutons .bouton { flex: 1; }
.rond {
  appearance: none; border: 0; background: transparent; cursor: pointer; color: var(--encre);
  width: 44px; height: 44px; border-radius: 22px; display: inline-flex; align-items: center; justify-content: center; text-decoration: none; flex: none;
}

input[type="text"], input[type="tel"], input[type="email"], input[type="password"], input[type="search"], select, textarea {
  width: 100%; min-height: 44px; padding: 10px 14px;
  border: 1px solid var(--trait-fort); border-radius: var(--rayon-petit); background: var(--fond);
  outline: none; transition: border-color 0.15s ease; font-size: 16px;
}
input:focus, select:focus, textarea:focus { border-color: var(--encre); }
textarea { resize: vertical; min-height: 96px; line-height: 1.45; }
label.champ { display: block; font-size: 13px; font-weight: 500; color: var(--encre-2); margin: 16px 0 6px; }

.recherche { display: flex; align-items: center; gap: 8px; height: 40px; padding: 0 12px; border-radius: var(--rayon-petit); background: var(--fond-2); color: var(--encre-3); }
.recherche svg { width: 18px; height: 18px; }
.recherche input { border: 0; background: transparent; padding: 0; min-height: 0; height: 100%; color: var(--encre); }
.puce {
  flex: none; min-height: 34px; padding: 0 14px; border-radius: 17px; border: 1px solid var(--trait);
  background: var(--fond); font-size: 14px; font-weight: 500; cursor: pointer; white-space: nowrap;
}
.puce.active { background: var(--encre); border-color: var(--encre); color: #fff; }

.etiquette { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: 12px; font-weight: 600; background: var(--fond-2); color: var(--encre-2); white-space: nowrap; }
.etiquette.oppose, .etiquette.perdu { color: var(--rouge); }
.etiquette.interesse, .etiquette.rendez_vous, .etiquette.gagne { color: var(--vert); }
.etiquette.bleu { background: var(--bleu-pale); color: var(--bleu-encre); }

/* ---------- Alertes ---------- */
.alerte { border-radius: var(--rayon); padding: 14px 16px; margin: 0 0 12px; background: #fff4f3; border: 1px solid #f7d4d0; }
.alerte .motif { font-weight: 700; color: var(--rouge); font-size: 14px; }
.alerte p { margin: 4px 0 8px; }
.alerte .boutons { margin-top: 4px; }

/* ---------- Liste des contacts (façon Conversations de Wolphus) ---------- */
.liste { margin: 0 -16px; }
.ligne-contact { display: flex; align-items: flex-start; gap: 8px; padding-left: 8px; text-decoration: none; transition: background-color 150ms ease; }
.ligne-contact:active { background: var(--fond-2); }
.ligne-contact .point-lu { margin-top: 20px; width: 10px; height: 10px; border-radius: 5px; flex: none; }
.ligne-contact .point-lu.oui { background: var(--bleu); }
.ligne-contact .corps { flex: 1; min-width: 0; border-bottom: 1px solid var(--trait); padding: 12px 16px 12px 0; }
.ligne-contact .haut { display: flex; align-items: center; gap: 8px; }
.ligne-contact .nom { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.ligne-contact.non-lu .nom { font-weight: 700; }
.ligne-contact .quand { font-size: 13px; color: var(--encre-3); font-variant-numeric: tabular-nums; }
.ligne-contact .apercu { margin-top: 2px; font-size: 14px; line-height: 1.35; color: var(--encre-2); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; word-break: break-word; }
.ligne-contact .infos { margin-top: 6px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 12.5px; font-weight: 500; }
.orange { color: var(--orange); }

/* ---------- Feuille de conversation : glisse depuis la droite (façon iOS, repris de Wolphus) ---------- */
@keyframes conv-push-in { from { transform: translate3d(100%, 0, 0); } to { transform: none; } }
@keyframes conv-fade { from { opacity: 0; } to { opacity: 1; } }
.conv-list { transition: transform 340ms var(--ressort); }
.conv-list[data-covered] { transform: translate3d(-25%, 0, 0); }
.conv-scrim { position: fixed; inset: 0; z-index: 40; background: rgba(0, 0, 0, 0.1); pointer-events: none; }
.conv-scrim[data-phase="in"] { animation: conv-fade 340ms ease both; }
.conv-scrim[data-phase="out"] { animation: conv-fade 300ms ease reverse both; }
.conv-sheet {
  position: fixed; inset: 0; z-index: 41; display: flex; flex-direction: column; background: var(--fond);
  box-shadow: -10px 0 30px rgba(0, 0, 0, 0.08);
}
.conv-sheet[data-phase="in"] { animation: conv-push-in 340ms var(--ressort) both; }
.conv-sheet[data-phase="out"] { animation: conv-push-in 300ms var(--ressort) reverse both; }

.entete-conv {
  position: relative; z-index: 2; padding-top: env(safe-area-inset-top);
  background: rgba(255, 255, 255, 0.9); backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--trait);
}
.entete-conv .barre { display: flex; align-items: center; height: 54px; padding: 0 4px; }
.entete-conv .titre { flex: 1; min-width: 0; }
.entete-conv .titre b { display: block; font-size: 16px; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.entete-conv .titre span { display: block; font-size: 12px; color: var(--encre-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bouton-info { font-weight: 800; font-size: 18px; color: var(--encre); }
.bouton-info .anneau { width: 26px; height: 26px; border-radius: 13px; border: 1.8px solid currentColor; display: flex; align-items: center; justify-content: center; font-size: 15px; line-height: 1; }

/* Bascule Client ↔ IA : pastille qui glisse, rien ne change d'écran */
.bascule { position: relative; display: grid; grid-template-columns: 1fr 1fr; margin: 0 16px 10px; padding: 3px; border-radius: 12px; background: var(--fond-2); }
.bascule button { position: relative; z-index: 1; appearance: none; border: 0; background: transparent; height: 34px; border-radius: 9px; font-size: 14px; font-weight: 600; color: var(--encre-2); cursor: pointer; transition: color 250ms ease; display: flex; align-items: center; justify-content: center; gap: 6px; }
.bascule button[aria-pressed="true"] { color: var(--encre); }
.bascule .curseur { position: absolute; top: 3px; bottom: 3px; left: 3px; width: calc(50% - 3px); border-radius: 9px; background: var(--fond); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1), 0 0 0 0.5px rgba(0, 0, 0, 0.04); transition: transform 340ms var(--ressort), background-color 250ms ease; }
.conv-sheet[data-mode="ia"] .bascule .curseur { transform: translateX(100%); background: var(--bleu-pale); }
.conv-sheet[data-mode="ia"] .bascule button[aria-pressed="true"] { color: var(--bleu-encre); }
.bascule svg { width: 15px; height: 15px; }
.bascule .compte { min-width: 16px; height: 16px; border-radius: 8px; background: var(--bleu); color: #fff; font-size: 10.5px; line-height: 16px; padding: 0 4px; }

.defile { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 8px 12px 12px; }
.fil { max-width: 720px; margin: 0 auto; min-height: 100%; display: flex; flex-direction: column; justify-content: flex-end; }
.separateur { padding: 12px 0 8px; text-align: center; font-size: 12px; font-weight: 500; color: var(--encre-3); }
.item { margin-top: 3px; transition: opacity 300ms ease, filter 300ms ease; }
.item.debut { margin-top: 12px; }
.item.gauche { display: flex; flex-direction: column; align-items: flex-start; }
.item.droite { display: flex; flex-direction: column; align-items: flex-end; }

/* Le fil qui n'est pas au premier plan reste visible, estompé */
.conv-sheet[data-mode="client"] .item.ia, .conv-sheet[data-mode="ia"] .item.client { opacity: 0.32; filter: saturate(0.4); }
.conv-sheet[data-mode="client"] .item.ia .bulle, .conv-sheet[data-mode="ia"] .item.client .bulle { pointer-events: none; }
.conv-sheet[data-mode="client"] .item.ia .actions-bulle, .conv-sheet[data-mode="ia"] .item.client .actions-bulle { display: none; }

.bulle { max-width: 80%; padding: 8px 14px; border-radius: 19px; font-size: 15.5px; line-height: 1.38; white-space: pre-wrap; word-wrap: break-word; }
.item.client.gauche .bulle { background: var(--fond-2); }
.item.client.gauche.fin .bulle { border-bottom-left-radius: 6px; }
.item.client.droite .bulle { background: var(--encre); color: #fff; }
.item.client.droite.fin .bulle { border-bottom-right-radius: 6px; }
.item.client.droite.attente .bulle { background: transparent; color: var(--encre-2); border: 1.5px dashed var(--trait-fort); }
.item.client.droite.ferme .bulle { background: transparent; color: var(--encre-3); border: 1.5px solid var(--trait); text-decoration: line-through; }
.item.ia.droite .bulle { background: var(--bleu-pale); color: var(--bleu-encre); }
.item.ia.droite.fin .bulle { border-bottom-right-radius: 6px; }
.item.ia.gauche .bulle { background: var(--fond); color: var(--encre); border: 1.5px solid #cfdcff; }
.item.ia.gauche.fin .bulle { border-bottom-left-radius: 6px; }
.qui { font-size: 11.5px; color: var(--bleu-encre); font-weight: 600; margin: 0 6px 3px; display: flex; gap: 6px; align-items: center; }
.bulle.ecrit { opacity: .6; font-style: italic; }
.meta { margin-top: 4px; padding: 0 6px; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; font-size: 11.5px; color: var(--encre-3); }
.meta .erreur { color: var(--rouge); font-weight: 600; }
.meta .attend { color: var(--orange); font-weight: 600; }
.actions-bulle { display: flex; gap: 6px; margin-top: 6px; }
.photos { display: grid; gap: 4px; margin: -2px -8px 6px; border-radius: 14px; overflow: hidden; }
.photos.deux { grid-template-columns: 1fr 1fr; }
.photos img { width: 100%; display: block; object-fit: cover; max-height: 280px; }
.photos.deux img { aspect-ratio: 1; }

/* Glisser un message pas encore parti vers la gauche → le refuser (résistance, corbeille qui grossit) */
.glisse { position: relative; display: flex; width: 100%; justify-content: flex-end; touch-action: pan-y; }
.glisse .corbeille { position: absolute; right: 4px; top: 0; bottom: 0; display: flex; align-items: center; pointer-events: none; opacity: 0; }
.glisse .corbeille span { width: 40px; height: 40px; border-radius: 20px; display: flex; align-items: center; justify-content: center; background: var(--fond-2); color: var(--rouge); transition: transform 200ms ease-out, background-color 200ms ease, color 200ms ease; }
.glisse .corbeille.armee span { background: var(--rouge); color: #fff; transform: scale(1.1); }
.glisse .contenu { display: flex; width: 100%; justify-content: flex-end; transform-origin: right center; }

/* Champ de saisie : grandit avec le texte, comme dans Messages */
.composer { border-top: 1px solid var(--trait); padding: 8px 10px max(8px, env(safe-area-inset-bottom)); background: rgba(255, 255, 255, 0.92); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); transition: background-color 300ms ease; }
.conv-sheet[data-mode="ia"] .composer, .composer.ia { background: rgba(234, 240, 255, 0.7); }
.composer .rangee-saisie { display: flex; align-items: flex-end; gap: 8px; max-width: 720px; margin: 0 auto; }
.composer .petit-rond { appearance: none; border: 0; cursor: pointer; width: 36px; height: 36px; border-radius: 18px; background: var(--fond-2); color: var(--encre-2); display: flex; align-items: center; justify-content: center; flex: none; margin-bottom: 1px; }
.composer .petit-rond svg { width: 18px; height: 18px; }
.composer .zone { flex: 1; min-width: 0; display: flex; align-items: flex-end; border: 1px solid var(--trait-fort); border-radius: 19px; background: var(--fond); padding: 3px 3px 3px 14px; transition: border-color 150ms ease; }
.composer .zone:focus-within { border-color: var(--bleu); }
.composer textarea { border: 0; min-height: 0; height: 30px; max-height: 140px; padding: 5px 0; resize: none; background: transparent; font-size: 16px; line-height: 1.3; }
.composer .envoyer { appearance: none; border: 0; cursor: pointer; width: 30px; height: 30px; border-radius: 15px; background: var(--bleu); color: #fff; display: flex; align-items: center; justify-content: center; flex: none; transition: opacity 200ms ease; margin-left: 4px; }
.composer .envoyer[disabled] { opacity: 0.35; }
.composer .envoyer svg { width: 17px; height: 17px; stroke-width: 2.6; }
.composer .objet { max-width: 720px; margin: 0 auto 8px; }
.composer .objet input { min-height: 36px; border-radius: 18px; padding: 6px 14px; }
.composer .note { text-align: center; font-size: 12.5px; color: var(--encre-2); padding: 6px 0; }
.choix-photos { display: flex; gap: 8px; overflow-x: auto; padding: 0 0 8px; max-width: 720px; margin: 0 auto; }
.choix-photos div { position: relative; flex: none; }
.choix-photos img { width: 64px; height: 64px; object-fit: cover; border-radius: 12px; box-shadow: 0 0 0 1px var(--trait); display: block; }
.choix-photos button { position: absolute; top: -6px; right: -6px; width: 24px; height: 24px; border-radius: 12px; border: 0; background: var(--encre); color: #fff; display: flex; align-items: center; justify-content: center; cursor: pointer; }
.choix-photos button svg { width: 13px; height: 13px; stroke-width: 2.6; }

/* ---------- Feuille du bas (iOS) : encoche, glisser vers le bas pour fermer ---------- */
@keyframes feuille-monte { from { transform: translate3d(0, 100%, 0); } to { transform: none; } }
.voile { position: fixed; inset: 0; z-index: 60; background: rgba(0, 0, 0, 0.3); animation: conv-fade 300ms ease both; }
.voile.part { animation: conv-fade 260ms ease reverse both; }
.feuille {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 61; max-height: calc(100dvh - env(safe-area-inset-top) - 24px);
  display: flex; flex-direction: column; background: var(--fond); border-radius: 20px 20px 0 0;
  box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.12); animation: feuille-monte 380ms var(--ressort) both;
  max-width: 720px; margin: 0 auto;
}

.feuille .poignee { height: 44px; display: flex; align-items: center; justify-content: center; cursor: grab; touch-action: none; flex: none; margin-bottom: -10px; }
.feuille .poignee span { width: 44px; height: 6px; border-radius: 3px; background: #c4c8ce; transition: background-color 150ms ease, width 200ms var(--ressort); }
.feuille .poignee:hover span, .feuille.tiree .poignee span { background: #9aa0a6; width: 52px; }
.feuille.tiree, .feuille.tiree .poignee { cursor: grabbing; }
.feuille:focus { outline: none; }
.feuille .tete { display: flex; align-items: center; gap: 8px; padding: 0 16px 12px; touch-action: none; cursor: grab; }
.feuille .tete h2 { margin: 0; flex: 1; font-size: 20px; }
.feuille .contenu-feuille { overflow-y: auto; padding: 0 16px calc(env(safe-area-inset-bottom) + 24px); overscroll-behavior: contain; }
.feuille textarea.markdown { min-height: 260px; font-size: 15px; font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; }

/* ---------- Tableau des accroches ---------- */
table { width: 100%; border-collapse: collapse; font-size: 15px; }
th, td { text-align: right; padding: 10px 6px; border-bottom: 1px solid var(--trait); }
th:first-child, td:first-child { text-align: left; }
th { font-size: 12px; font-weight: 600; color: var(--encre-2); }
.taux { color: var(--encre-2); font-size: 12px; display: block; }

/* ---------- Divers ---------- */
.code { font-size: 44px; font-weight: 700; letter-spacing: 0.18em; font-variant-numeric: tabular-nums; text-align: center; margin: 12px 0 4px; }
.etat { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--encre-3); margin-right: 8px; }
.etat.ok { background: var(--vert); }
.etat.ko { background: var(--rouge); }
.connexion { max-width: 360px; margin: 18vh auto 0; }
.connexion h1 { text-align: center; }
.erreur-texte { color: var(--rouge); font-size: 14px; min-height: 20px; margin: 8px 0; }
.interrupteur { appearance: none; width: 51px; height: 31px; border-radius: 16px; background: var(--trait-fort); position: relative; cursor: pointer; transition: background-color 250ms ease; flex: none; margin: 0; }
.interrupteur::after { content: ""; position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 14px; background: #fff; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2); transition: transform 300ms var(--ressort); }
.interrupteur:checked { background: var(--vert); }
.interrupteur:checked::after { transform: translateX(20px); }
.segment { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; padding: 3px; border-radius: 10px; background: var(--fond-2); }
.segment button { appearance: none; border: 0; background: transparent; height: 32px; border-radius: 8px; font-size: 14px; font-weight: 500; cursor: pointer; }
.segment button[aria-pressed="true"] { background: var(--fond); font-weight: 600; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1); }

#toast {
  position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom) + var(--barre) + 20px); transform: translateX(-50%);
  background: var(--encre); color: #fff; padding: 10px 16px; border-radius: 20px; font-size: 14px; z-index: 80; max-width: calc(100% - 32px);
}

@media (prefers-reduced-motion: reduce) {
  .conv-sheet[data-phase="in"] { animation: conv-fade 200ms ease both; }
  .conv-sheet[data-phase="out"] { animation: conv-fade 200ms ease reverse both; }
  .conv-list, .barre-bas, .bascule .curseur, .item, .feuille, .voile { transition: none !important; animation-duration: 1ms !important; }
  .conv-list[data-covered] { transform: none; }
  .press:active { transform: none; }
}

/* ---------- Menu déroulant maison ---------- */
.menu-bouton {
  appearance: none; border: 0; cursor: pointer; width: 100%; min-height: 40px; padding: 0 10px 0 14px;
  border-radius: var(--rayon-petit); background: var(--fond-2); color: var(--encre); font-size: 15px; font-weight: 500;
  display: flex; align-items: center; gap: 8px; text-align: left;
}
.menu-bouton:focus-visible { outline: 2px solid var(--bleu); outline-offset: 2px; }
.menu-bouton[disabled] { opacity: 0.5; cursor: default; }
.menu-bouton .menu-texte { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu-bouton .menu-fleche { color: var(--encre-3); transition: transform 300ms var(--ressort); }
.menu-bouton .menu-fleche svg { width: 16px; height: 16px; }
.menu-bouton[aria-expanded="true"] .menu-fleche { transform: rotate(180deg); }
.feuille .menu-bouton, .carte .menu-bouton { min-height: 44px; }
@keyframes menu-ouvre { from { opacity: 0; transform: translateY(-6px) scale(0.98); } to { opacity: 1; transform: none; } }
@keyframes menu-ouvre-haut { from { opacity: 0; transform: translateY(6px) scale(0.98); } to { opacity: 1; transform: none; } }
.menu-liste {
  position: fixed; z-index: 90; max-height: 320px; overflow-y: auto; padding: 6px; border-radius: 14px;
  background: rgba(255, 255, 255, 0.96); backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px);
  box-shadow: 0 12px 40px rgba(2, 6, 10, 0.14), 0 0 0 0.5px rgba(2, 6, 10, 0.08);
  transform-origin: top center; animation: menu-ouvre 260ms var(--ressort) both; outline: none;
}
.menu-liste.au-dessus { transform-origin: bottom center; animation-name: menu-ouvre-haut; }
.menu-liste.part { animation: menu-ouvre 160ms ease reverse both; }
.menu-option { display: flex; align-items: center; gap: 10px; min-height: 40px; padding: 0 10px 0 12px; border-radius: 9px; font-size: 15px; cursor: pointer; user-select: none; }
.menu-option span:first-child { flex: 1; }
.menu-option.survol { background: var(--fond-2); }
.menu-option[aria-selected="true"] { font-weight: 600; }
.menu-coche svg { width: 18px; height: 18px; color: var(--encre); }

/* ---------- Votre commercial (épinglé) ---------- */
.avatar-commercial { width: 44px; height: 44px; border-radius: 50%; background: var(--encre); color: #fff; display: flex; align-items: center; justify-content: center; flex: none; }
.avatar-commercial svg { width: 22px; height: 22px; }
.avatar-commercial.petit { width: 28px; height: 28px; }
.avatar-commercial.petit svg { width: 15px; height: 15px; }
.avatar-commercial.moyen { width: 34px; height: 34px; margin-right: 10px; }
.avatar-commercial.moyen svg { width: 18px; height: 18px; }
.avatar-commercial.grand { width: 64px; height: 64px; background: var(--fond-2); color: var(--encre-3); margin: 0 auto 12px; }
.avatar-commercial.grand svg { width: 30px; height: 30px; }
.ligne-contact.epingle { align-items: center; padding-left: 16px; gap: 12px; }
.ligne-contact.epingle .corps { padding-top: 14px; padding-bottom: 14px; }
.ligne-contact .chevron { color: var(--encre-3); }
.ligne-contact .chevron svg { width: 16px; height: 16px; }
.ligne-contact.active { background: var(--fond-2); }

/* ---------- Ce que j'ai appris ---------- */
.choix-vue { margin: 16px 0 8px; }
.choix-vue[data-vue="graphe"] .curseur { transform: translateX(100%); }
.choix-vue svg { width: 16px; height: 16px; }
@keyframes apparait { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
#vue-appris.apparait { animation: apparait 320ms var(--ressort) both; }
.ligne-note { width: 100%; border: 0; background: transparent; text-align: left; cursor: pointer; }
.ligne-note > svg { width: 16px; height: 16px; color: var(--encre-3); }
.pastille-dossier { width: 8px; height: 8px; border-radius: 4px; flex: none; align-self: flex-start; margin-top: 8px; }
.deux-lignes { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.graphe { position: relative; height: min(64vh, 560px); margin-top: 8px; border-radius: var(--rayon); background: #fafbfc; border: 1px solid var(--trait); overflow: hidden; touch-action: none; }
.graphe canvas { width: 100%; height: 100%; display: block; cursor: grab; }
.graphe-aide { position: absolute; left: 12px; bottom: 10px; right: 12px; font-size: 12px; color: var(--encre-3); pointer-events: none; }
.legende { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 12px; font-size: 13px; color: var(--encre-2); }
.legende span { display: inline-flex; align-items: center; gap: 6px; }
.legende i { width: 10px; height: 10px; border-radius: 5px; display: inline-block; }
.bouton svg { width: 18px; height: 18px; }

#vide-conv { display: none; }

/* ---------- Ordinateur : barre latérale, liste et conversation côte à côte ---------- */
@media (min-width: 900px) {
  :root { --lateral: 232px; --colonne: 400px; }
  .barre-bas {
    inset: 0 auto 0 0; width: var(--lateral); display: flex; flex-direction: column; gap: 2px;
    padding: calc(env(safe-area-inset-top) + 20px) 12px 20px; border-top: 0; border-right: 1px solid var(--trait);
    background: #fbfbfc; backdrop-filter: none; -webkit-backdrop-filter: none;
  }
  html[data-conv-open] .barre-bas { transform: none; opacity: 1; pointer-events: auto; }
  .barre-bas .marque { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 17px; letter-spacing: -0.01em; padding: 0 10px 20px; }
  .barre-bas a { flex-direction: row; justify-content: flex-start; gap: 12px; min-height: 44px; padding: 0 12px; border-radius: 10px; font-size: 15px; color: var(--encre-2); transition: background-color 150ms ease, color 150ms ease; }
  .barre-bas a:hover { background: var(--fond-2); }
  .barre-bas a.actif { background: var(--fond-2); color: var(--encre); font-weight: 600; }
  .barre-bas svg, .barre-bas .ic { width: 22px; height: 22px; }
  .pastille { position: static; margin-left: auto; }
  .pastille.point { margin-top: 0; }

  main { margin-left: calc(var(--lateral) + max(0px, (100vw - var(--lateral) - 760px) / 2)); max-width: 760px; padding: 32px 32px 48px; }
  body[data-page="contacts"] main { margin-left: var(--lateral); width: var(--colonne); max-width: none; padding: 24px 16px 32px; height: 100dvh; overflow-y: auto; position: fixed; top: 0; border-right: 1px solid var(--trait); }
  .conv-list[data-covered] { transform: none; }
  .conv-scrim { display: none; }
  .conv-sheet { left: calc(var(--lateral) + var(--colonne)); box-shadow: none; }
  .conv-sheet[data-phase="in"] { animation: conv-fade 220ms ease both; }
  .conv-sheet[data-phase="out"] { animation: conv-fade 160ms ease reverse both; }
  .conv-sheet [data-retour] { display: none; }
  .entete-conv .barre { padding: 0 12px 0 20px; height: 60px; }
  body[data-page="contacts"] #vide-conv {
    display: flex; position: fixed; inset: 0 0 0 calc(var(--lateral) + var(--colonne)); align-items: center; justify-content: center;
    text-align: center; color: var(--encre-2); font-size: 15px;
  }
  html[data-conv-open] #vide-conv { display: none !important; }
  .ligne-contact:hover { background: #f7f8f9; }
  .ligne-contact.active { background: var(--fond-2); }
  /* Ordinateur : la feuille devient une fenêtre centrée (fondu + légère mise à l'échelle), sans encoche ni croix. */
  .feuille {
    inset: 0; margin: auto; width: min(600px, calc(100vw - 64px)); height: fit-content; max-height: min(86vh, 860px);
    border-radius: 20px; box-shadow: 0 24px 80px rgba(2, 6, 10, 0.22), 0 0 0 0.5px rgba(2, 6, 10, 0.06);
    animation: fenetre-ouvre 300ms var(--ressort) both;
  }
  .feuille.part { animation: fenetre-ouvre 180ms ease reverse both !important; }
  .feuille .poignee { display: none; }
  .feuille .tete { padding-top: 22px; cursor: default; }
  .feuille .contenu-feuille { padding-bottom: 24px; }
  .pied-filtres { bottom: -24px; padding-bottom: 20px; }
  #toast { bottom: 24px; }
  .graphe { height: calc(100dvh - 300px); min-height: 420px; }
}


@media (prefers-reduced-motion: reduce) {
  .menu-liste, .menu-liste.part, #vue-appris.apparait { animation-duration: 1ms !important; }
}

/* ---------- Filtres de la liste des contacts ---------- */
.barre-recherche { display: flex; gap: 8px; margin-bottom: 8px; }
.barre-recherche .recherche { flex: 1; min-width: 0; }
.bouton-filtres {
  position: relative; appearance: none; border: 0; cursor: pointer; flex: none; width: 40px; height: 40px;
  border-radius: var(--rayon-petit); background: var(--fond-2); color: var(--encre-2);
  display: flex; align-items: center; justify-content: center;
}
.bouton-filtres svg { width: 20px; height: 20px; }
.bouton-filtres.actif { background: var(--encre); color: #fff; }
.compteur-filtres {
  position: absolute; top: -5px; right: -5px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  background: var(--bleu); color: #fff; font-size: 11px; line-height: 18px; text-align: center; font-weight: 700;
  box-shadow: 0 0 0 2px var(--fond);
}
.puces-filtre { display: flex; flex-wrap: wrap; gap: 8px; }
.puces-filtre .puce { transition: background-color 150ms ease, color 150ms ease, border-color 150ms ease, transform 120ms ease-out; }
.puces-filtre .puce[aria-pressed="true"] { background: var(--encre); border-color: var(--encre); color: #fff; }
.ligne-relancer { padding: 12px 14px; border-radius: var(--rayon-petit); background: var(--fond-2); cursor: pointer; }
.ligne-relancer .etire { display: flex; flex-direction: column; gap: 2px; }
.liste-villes { max-height: 240px; overflow-y: auto; }
.liste-villes .rangee { cursor: pointer; min-height: 44px; }
.case {
  appearance: none; margin: 0; width: 22px; height: 22px; border-radius: 50%; border: 1.5px solid var(--trait-fort);
  background: var(--fond); flex: none; cursor: pointer; position: relative; transition: background-color 150ms ease, border-color 150ms ease;
}
.case:checked { background: var(--encre); border-color: var(--encre); }
.case:checked::after { content: ""; position: absolute; left: 7px; top: 3px; width: 5px; height: 10px; border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg); }
.pied-filtres {
  position: sticky; bottom: calc(-1 * (env(safe-area-inset-bottom) + 24px)); display: flex; gap: 8px; margin: 24px -16px 0;
  padding: 12px 16px calc(env(safe-area-inset-bottom) + 16px); background: linear-gradient(to bottom, rgba(255, 255, 255, 0.85), #fff 30%);
}
.pied-filtres .bouton:first-child { flex: 0 0 auto; }
.pied-filtres .bouton.principal { flex: 1; }

@keyframes fenetre-ouvre { from { opacity: 0; transform: scale(0.96) translateY(8px); } to { opacity: 1; transform: none; } }
