/* Espace agent — système de design (palette, typographie, composants), clair et sombre.
   Polices hébergées localement (SIL Open Font License, voir polices/LICENCE-*.txt). */

@font-face { font-family: "IBM Plex Sans"; font-weight: 400; font-display: swap; src: url(polices/ibm-plex-sans-400.woff2) format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-weight: 500; font-display: swap; src: url(polices/ibm-plex-sans-500.woff2) format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-weight: 600; font-display: swap; src: url(polices/ibm-plex-sans-600.woff2) format("woff2"); }
@font-face { font-family: "Instrument Sans"; font-weight: 500; font-display: swap; src: url(polices/instrument-sans-500.woff2) format("woff2"); }
@font-face { font-family: "Instrument Sans"; font-weight: 600; font-display: swap; src: url(polices/instrument-sans-600.woff2) format("woff2"); }
@font-face { font-family: "Instrument Sans"; font-weight: 700; font-display: swap; src: url(polices/instrument-sans-700.woff2) format("woff2"); }
@font-face { font-family: "IBM Plex Mono"; font-weight: 400; font-display: swap; src: url(polices/ibm-plex-mono-400.woff2) format("woff2"); }
@font-face { font-family: "IBM Plex Mono"; font-weight: 500; font-display: swap; src: url(polices/ibm-plex-mono-500.woff2) format("woff2"); }

:root {
  --fond: #f3f5f4; --surface: #ffffff; --surface-2: #edf2f1; --encre: #16242a; --doux: #5a696e;
  --trait: #dce3e2; --petrole: #0f5c58; --petrole-fort: #0a4643; --petrole-doux: #e1efec;
  --sur-petrole: #ffffff; --brique: #b4412a; --brique-doux: #f8e7e2; --ocre: #a86a12; --ocre-doux: #f6ecd9;
  --vert: #2f7a45; --vert-doux: #e3f1e7; --gris-doux: #e9edee;
  --ombre: 0 1px 2px rgb(22 36 42 / .06), 0 4px 16px rgb(22 36 42 / .06);
  --titre: "Instrument Sans", "Segoe UI", system-ui, sans-serif;
  --texte: "IBM Plex Sans", "Segoe UI", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
  --rayon: 10px; --barre-haut: 56px; --nav-bas: 64px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --fond: #0e1517; --surface: #152024; --surface-2: #1b292e; --encre: #e4ecec; --doux: #95a6ab;
    --trait: #26373c; --petrole: #58b5ac; --petrole-fort: #7fcbc3; --petrole-doux: #173331; --sur-petrole: #0b1a19;
    --brique: #e57a62; --brique-doux: #3a211b; --ocre: #e0a447; --ocre-doux: #33291a; --vert: #6cc08a;
    --vert-doux: #1b3324; --gris-doux: #22302f; --ombre: 0 1px 2px rgb(0 0 0 / .3), 0 6px 20px rgb(0 0 0 / .25);
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--fond); color: var(--encre); font: 15px/1.55 var(--texte); -webkit-font-smoothing: antialiased; }
a { color: var(--petrole); }
h1, h2, h3 { font-family: var(--titre); letter-spacing: -.01em; text-wrap: balance; margin: 0; }
h1 { font-size: 1.5rem; line-height: 1.2; font-weight: 700; }
h2 { font-size: 1.05rem; font-weight: 600; }
p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--petrole); outline-offset: 2px; border-radius: 6px; }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.doux { color: var(--doux); }
.petit { font-size: .82rem; }
.etiquette { font-family: var(--titre); font-size: .72rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--doux); }
.visuellement-cache { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* --- structure --- */
.app { min-height: 100vh; }
.laterale { display: none; }
.barre-haut { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 500; height: var(--barre-haut); display: flex; align-items: center;
  justify-content: space-between; gap: 12px; padding-inline: 16px; background: var(--surface); border-bottom: 1px solid var(--trait); }
.marque { display: flex; align-items: center; gap: 10px; font-family: var(--titre); font-weight: 700; font-size: 1.02rem; color: var(--encre); text-decoration: none; }
.marque svg { flex: none; }
.avatar { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--petrole-doux); color: var(--petrole-fort);
  font-family: var(--titre); font-weight: 700; font-size: .85rem; text-decoration: none; flex: none; }
main { padding: 16px 16px calc(var(--nav-bas) + 28px + env(safe-area-inset-bottom, 0px)); max-width: 1180px; margin-inline: auto; }
.nav-bas { position: fixed; inset: auto 0 0 0; z-index: 600; display: grid; grid-template-columns: repeat(4, 1fr); background: var(--surface);
  border-top: 1px solid var(--trait); padding-bottom: env(safe-area-inset-bottom, 0px); }
.nav-bas a, .laterale nav a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; height: var(--nav-bas);
  font-size: .72rem; font-weight: 500; color: var(--doux); text-decoration: none; }
.nav-bas a[aria-current="page"], .laterale nav a[aria-current="page"] { color: var(--petrole); }
.nav-bas svg, .laterale nav svg { width: 22px; height: 22px; }
.laterale .agent { display: flex; gap: 10px; align-items: center; padding: 12px; border-radius: 10px; background: var(--surface-2); }
.laterale form { margin: 0; }
.lien-bouton { background: none; border: 0; padding: 0; color: var(--petrole); cursor: pointer; font-size: .82rem; }
@media (min-width: 960px) {
  .app { display: grid; grid-template-columns: 240px 1fr; }
  .laterale { display: flex; flex-direction: column; gap: 24px; position: sticky; top: 0; height: 100vh; padding: 20px 14px;
    background: var(--surface); border-right: 1px solid var(--trait); }
  .laterale nav { display: grid; gap: 2px; }
  .laterale nav a { flex-direction: row; justify-content: flex-start; gap: 12px; height: 42px; padding-inline: 12px; border-radius: 8px; font-size: .92rem; }
  .laterale nav a:hover { background: var(--surface-2); }
  .laterale nav a[aria-current="page"] { background: var(--petrole-doux); color: var(--petrole-fort); font-weight: 600; }
  .laterale .pied { margin-top: auto; display: grid; gap: 8px; }
  .barre-haut, .nav-bas { display: none; }
  main { padding: 28px 32px 48px; }
}

/* --- composants --- */
.bloc { background: var(--surface); border: 1px solid var(--trait); border-radius: var(--rayon); padding: 16px; }
.pile { display: grid; gap: 16px; align-content: start; }
.pile-serree { display: grid; gap: 8px; }
.ligne { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.ligne.ecartee { justify-content: space-between; }
.entete-page { display: grid; gap: 4px; margin-bottom: 18px; }
.entete-section { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 26px 0 10px; }
.entete-section h2 { display: flex; align-items: center; gap: 8px; }
.pastille { width: 9px; height: 9px; border-radius: 50%; flex: none; background: var(--doux); display: inline-block; }
.pastille.prio { background: var(--brique); } .pastille.inter { background: var(--ocre); }
.alerte { padding: 11px 14px; border-radius: var(--rayon); font-size: .9rem; }
.alerte.ok { background: var(--vert-doux); color: var(--vert); }
.alerte.erreur { background: var(--brique-doux); color: var(--brique); }
.alerte.attention { background: var(--ocre-doux); color: var(--encre); }
.messages { display: grid; gap: 8px; margin-bottom: 14px; }

.kpis { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
@media (min-width: 640px) { .kpis { grid-template-columns: repeat(4, 1fr); } }
.kpi { background: var(--surface); border: 1px solid var(--trait); border-radius: var(--rayon); padding: 12px 14px; display: grid; gap: 2px; }
.kpi .val { font-family: var(--titre); font-size: 1.7rem; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.1; }
.kpi .taux { font-size: .78rem; color: var(--doux); }

.cartes { display: grid; gap: 12px; grid-template-columns: 1fr; }
@media (min-width: 720px) { .cartes { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1240px) { .cartes { grid-template-columns: repeat(3, 1fr); } }
.carte { display: grid; gap: 10px; align-content: start; background: var(--surface); border: 1px solid var(--trait); border-radius: var(--rayon);
  padding: 14px 14px 12px; text-decoration: none; color: inherit; box-shadow: var(--ombre); transition: border-color .15s, transform .15s; }
.carte:hover { border-color: var(--petrole); }
@media (prefers-reduced-motion: no-preference) { .carte:active { transform: scale(.99); } }
.carte .pourquoi { font-family: var(--titre); font-weight: 600; font-size: 1.02rem; line-height: 1.3; }
.carte .haut, .entete-fiche { display: flex; gap: 12px; justify-content: space-between; align-items: flex-start; }
.carte .qui { font-size: .9rem; overflow-wrap: anywhere; }
.carte .besoin { font-size: .86rem; color: var(--doux); }
.carte .bas { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; justify-content: space-between; border-top: 1px solid var(--trait); padding-top: 9px; }

.note { flex: none; display: grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; font-family: var(--mono); font-weight: 500; font-size: 1rem;
  background: var(--gris-doux); color: var(--encre); }
.note.prio { background: var(--brique-doux); color: var(--brique); } .note.inter { background: var(--ocre-doux); color: var(--ocre); }
.puce { display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px; border-radius: 999px; font-size: .76rem; font-weight: 500;
  background: var(--surface-2); color: var(--encre); white-space: nowrap; }
.puce.statut::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--doux); }
.puce.s-1::before { background: var(--ocre); } .puce.s-2::before, .puce.s-4::before { background: var(--petrole); }
.puce.s-3::before { background: var(--petrole-fort); } .puce.s-5 { background: var(--vert-doux); } .puce.s-5::before { background: var(--vert); }
.puce.s-6::before { background: var(--brique); }
.puce.confirme { background: var(--vert-doux); color: var(--vert); } .puce.probable { background: var(--ocre-doux); color: var(--ocre); }

.bouton { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 42px; padding: 8px 16px; border-radius: 9px;
  border: 1px solid var(--petrole); background: var(--petrole); color: var(--sur-petrole); font-weight: 600; text-decoration: none; cursor: pointer; }
.bouton:hover { background: var(--petrole-fort); border-color: var(--petrole-fort); }
.bouton.second { background: var(--surface); color: var(--petrole); border-color: var(--trait); }
.bouton.second:hover { border-color: var(--petrole); }
.bouton.danger { background: var(--surface); color: var(--brique); border-color: var(--trait); }
.bouton.danger.plein { background: var(--brique); color: #fff; border-color: var(--brique); }
.bouton[disabled], .bouton[aria-disabled="true"] { opacity: .5; cursor: not-allowed; }
.bouton svg { width: 18px; height: 18px; }
.bouton.large { width: 100%; }
.champ { font-weight: 400; width: 100%; min-height: 42px; padding: 8px 12px; border-radius: 9px; border: 1px solid var(--trait); background: var(--surface); }
textarea.champ { min-height: 110px; resize: vertical; line-height: 1.5; }
label.lib { display: grid; gap: 5px; font-size: .82rem; color: var(--doux); font-weight: 500; }
.formulaire { display: grid; gap: 14px; }

/* --- connexion --- */
.page-seule { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.page-seule .bloc { width: 100%; max-width: 400px; padding: 28px 24px; display: grid; gap: 18px; }

/* --- listes --- */
.lignes { display: grid; gap: 8px; }
.ligne-prospect { display: grid; grid-template-columns: 44px 1fr; gap: 12px; align-items: center; padding: 10px 12px; background: var(--surface);
  border: 1px solid var(--trait); border-radius: var(--rayon); text-decoration: none; color: inherit; }
.ligne-prospect:hover { border-color: var(--petrole); }
.ligne-prospect .titre { font-weight: 600; } .ligne-prospect .sous { font-size: .82rem; color: var(--doux); display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: center; }
.vide { text-align: center; padding: 28px 16px; color: var(--doux); }

/* --- fiche prospect --- */
.retour { display: inline-flex; gap: 6px; align-items: center; font-size: .86rem; text-decoration: none; margin-bottom: 10px; }
.fiche { display: grid; gap: 16px; }
@media (min-width: 1040px) { .fiche { grid-template-columns: minmax(0, 1fr) 360px; align-items: start; } }
.hero { display: grid; gap: 10px; }
.hero .pourquoi { font-size: 1.35rem; line-height: 1.2; }
dl.infos { display: grid; grid-template-columns: 1fr; gap: 10px 20px; margin: 0; }
@media (min-width: 560px) { dl.infos { grid-template-columns: repeat(2, minmax(0, 1fr)); } dl.infos .large { grid-column: 1 / -1; } }
dl.infos div { display: grid; gap: 1px; } dl.infos dt { font-size: .76rem; color: var(--doux); } dl.infos dd { margin: 0; overflow-wrap: anywhere; }
.etapes { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.etapes span { height: 8px; border-radius: 4px; background: var(--gris-doux); }
.etapes span.fait { background: var(--petrole); } .etapes span.perdu { background: var(--brique); }
.recherches { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.recherches a { display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 8px 10px; border: 1px solid var(--trait); border-radius: 9px;
  text-decoration: none; color: var(--encre); font-size: .86rem; font-weight: 500; background: var(--surface); }
.recherches a:hover { border-color: var(--petrole); }
.recherches .i { width: 22px; height: 22px; border-radius: 6px; display: grid; place-items: center; font: 700 .7rem var(--titre); background: var(--surface-2); color: var(--doux); flex: none; }
.contact { display: grid; gap: 2px; padding: 10px 0; border-top: 1px solid var(--trait); } .contact:first-child { border-top: 0; padding-top: 0; }
.contact .val { font-family: var(--mono); font-size: .95rem; overflow-wrap: anywhere; }
.champ-double { display: grid; grid-template-columns: 130px minmax(0, 1fr); gap: 8px; }
.historique { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.historique li { display: grid; grid-template-columns: 14px 1fr; gap: 10px; font-size: .86rem; }
.historique li::before { content: ""; width: 10px; height: 10px; margin-top: 5px; border-radius: 50%; border: 2px solid var(--petrole); }
textarea.lettre { min-height: 320px; }
.pied-lettre { font-size: .8rem; color: var(--doux); border-top: 1px dashed var(--trait); padding-top: 10px; white-space: pre-wrap; }
.confirmation { border: 1px solid var(--brique); background: var(--brique-doux); border-radius: var(--rayon); padding: 14px; display: grid; gap: 10px; }

/* --- liste --- */
.filtres { display: grid; gap: 8px; grid-template-columns: 1fr 1fr; margin-bottom: 14px; }
.filtres .recherche, .filtres .case, .filtres .actions-filtres { grid-column: 1 / -1; }
@media (min-width: 900px) { .filtres { grid-template-columns: 2fr repeat(5, 1fr); } .filtres .recherche { grid-column: auto; } }
label.case { display: flex; align-items: center; gap: 8px; font-size: .86rem; color: var(--encre); }
label.case input { width: 18px; height: 18px; accent-color: var(--petrole); }

/* --- carte --- */
.zone-carte { display: grid; gap: 14px; }
@media (min-width: 1040px) { .zone-carte { grid-template-columns: minmax(0, 1fr) 340px; } }
#carte { height: 62vh; min-height: 360px; border-radius: var(--rayon); border: 1px solid var(--trait); overflow: hidden; background: var(--surface-2); }
@media (min-width: 1040px) { #carte { height: calc(100vh - 190px); } .liste-carte { max-height: calc(100vh - 150px); overflow: auto; align-content: start; } }
@media (prefers-color-scheme: dark) { .leaflet-tile-pane { filter: brightness(.72) contrast(1.08) saturate(.8); } }
.leaflet-container { font-family: var(--texte); }
.leaflet-popup-content-wrapper, .leaflet-popup-tip { background: var(--surface); color: var(--encre); }
.leaflet-popup-content { display: grid; gap: 4px; margin: 12px 14px; }
.legende { display: flex; flex-wrap: wrap; gap: 14px; font-size: .8rem; color: var(--doux); }
.legende span { display: inline-flex; align-items: center; gap: 6px; }

/* --- résultats --- */
.onglets { display: flex; gap: 4px; border-bottom: 1px solid var(--trait); margin-bottom: 16px; }
.onglets a { padding: 8px 12px; text-decoration: none; color: var(--doux); border-bottom: 2px solid transparent; font-weight: 500; }
.onglets a[aria-current="page"] { color: var(--encre); border-bottom-color: var(--petrole); }
.barres { display: grid; gap: 10px; }
.barre { display: grid; grid-template-columns: 96px minmax(0, 1fr) 36px 44px; gap: 10px; align-items: center; font-size: .86rem; }
.barre .fond { height: 12px; background: var(--gris-doux); border-radius: 6px; overflow: hidden; }
.barre .plein { height: 100%; background: var(--petrole); border-radius: 6px; }
.grille-statuts { display: grid; gap: 8px; grid-template-columns: repeat(2, 1fr); }
@media (min-width: 640px) { .grille-statuts { grid-template-columns: repeat(4, 1fr); } }
@media (min-width: 1040px) { .grille-statuts { grid-template-columns: repeat(7, 1fr); } }
.tableau-defilant { overflow-x: auto; }
.tableau { width: 100%; border-collapse: collapse; font-size: .9rem; }
.tableau th, .tableau td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--trait); }
.tableau thead th { font-size: .74rem; text-transform: uppercase; letter-spacing: .05em; color: var(--doux); font-weight: 600; }
.tableau tbody th { font-weight: 500; }
.tableau .num { text-align: right; font-variant-numeric: tabular-nums; }

/* --- aperçu par l'administrateur --- */
.bandeau-apercu { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 700; display: flex; flex-wrap: wrap; gap: 8px 16px;
  align-items: center; justify-content: center; padding: 8px 16px; background: var(--ocre); color: #fff; font-size: .88rem; text-align: center; }
.bandeau-apercu form { margin: 0; }
.bandeau-apercu button { background: #fff; color: var(--encre); border: 0; border-radius: 7px; padding: 5px 12px; font-weight: 600; cursor: pointer; }
.bandeau-apercu ~ .app .barre-haut { top: calc(env(safe-area-inset-top, 0px) + 38px); }

/* --- carte de couverture (page publique) --- */
.barre-haut.public { position: static; display: flex; padding-inline: max(16px, calc((100% - 1016px) / 2)); }
.couverture { display: grid; gap: 18px; padding-bottom: 40px; max-width: 1080px; }
.couverture .intro { display: grid; gap: 10px; max-width: 720px; padding-top: 12px; }
.couverture h1 { font-size: clamp(1.5rem, 4vw, 2.1rem); }
.chiffres { display: flex; flex-wrap: wrap; gap: 10px 28px; margin-top: 6px; }
.chiffres div { display: flex; align-items: baseline; gap: 8px; }
.chiffres .nombre { font: 700 2rem/1 var(--titre); font-variant-numeric: tabular-nums; }
.chiffres .nombre.couvert { color: var(--petrole); }
.carte-france { display: grid; gap: 12px; padding: 12px; }
.carte-france svg { width: 100%; height: auto; max-height: 78vh; display: block; }
.carte-france .dep { fill: var(--gris-doux); stroke: var(--surface); stroke-width: .8; stroke-linejoin: round; transition: fill .12s; }
.carte-france .dep.couvert { fill: var(--petrole); }
.carte-france a .dep:hover, .carte-france a:focus-visible .dep { fill: var(--ocre); }
.carte-france .dep.couvert:hover { fill: var(--petrole-fort); }
.carte-france a:focus-visible { outline: none; }
.carte-france .encart { fill: none; stroke: var(--trait); }
.carte-france .legende-encart { font: 500 8px var(--texte); fill: var(--doux); }
.pied-carte { display: flex; flex-wrap: wrap; gap: 8px 20px; justify-content: space-between; align-items: center; padding: 0 4px; }
.legende { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: .86rem; }
.legende span { display: inline-flex; align-items: center; gap: 7px; }
.pastille { width: 14px; height: 14px; border-radius: 4px; background: var(--gris-doux); border: 1px solid var(--trait); }
.pastille.couvert { background: var(--petrole); border-color: var(--petrole); }
.pied-carte .info { min-height: 1.4em; }
.pied-carte .info strong { color: var(--encre); }
.appel { display: flex; flex-wrap: wrap; gap: 16px; align-items: center; justify-content: space-between; padding: 20px; }
.appel .pile-serree { max-width: 640px; }
.mentions { max-width: 720px; }
