/* File: fiche.css — Panneau latéral commune + boutons pied de fiche + badge statut optionnel
 * - 1.3.5: `.fiche-parr-src*` lien source parrainage IA ; `.fiche-parr-src-verify`
 * Desc: Styles du panneau fiche commune (édition terrain, score bars) séparés de app.css.
 * Version 1.3.27 — CTA fiche : accent via `.btn-secondary.statsbar-zone-btn` (app.css)
 * Version 1.3.26 — synthèse sans encadré ; URL site web une ligne + ellipsis
 * Version 1.3.25 — **🤖 Cont.** : titre section Commune (`fiche-section-title-row`)
 * Version 1.3.24 — header : **🤖 Cont.** à droite du nom commune
 * Version 1.3.23 — synthèse : xN n ; parrainages sous nom ; `.fiche-row` 12px / 3px
 * Version 1.3.22 — synthèse : `.fiche-synth-head` blanc (maire · parrain) + score à droite
 * Version 1.3.21 — hint Notes inline, même typo que libellé, couleur un peu plus claire
 * Version 1.3.20 — `.fiche-notes-privacy-hint` ; `.fiche-btn-contacts-ia` rouge (aligné Vérif.)
 * Version 1.3.19 — Identité : nom + Contacts sur la même ligne
 * Version 1.3.18 — Contacts sous Identité (aligné à droite du nom)
 * Version 1.3.17 — Vérif./Contacts titre Maire ; Sauv. sous Suivi ; synthèse score seul
 * Version 1.3.16 — hauteur fiche : `bottom: var(--parr-signature-reserve-h)` (dock signature carte)
 * Version 1.3.15 — INSEE + OSM ↗ à droite ; bouton SAUVEGARDER en titre Suivi prospection
 * Version 1.3.14 — triangle score : curseur grab/grabbing (plus crosshair)
 * Version 1.3.13 — Vérification : `statsbar-zone-btn` (plus `.btn-ia-cta-red`)
 * Version 1.3.12 — `.fiche-btn-verify-maire` : `btn-ia-cta-red` (même rouge que Zone)
 * Version 1.3.11 — `.fiche-btn-verify-maire` aligné bouton Zone (accent pipeline)
 * Version 1.3.10 — canvas triangle score : hauteur calibrée JS (plus 102 px fixe)
 * Version 1.3.8 — glyphes **● ○ ⊙** (classes `.parr-glyph-*` dans legend.css)
 * Version 1.3.7 — **◉ Statut** : pastille avant le libellé
 * Version 1.3.6 — synthèse : pastille score **●** à droite du nom ; **◉** couleur statut au label
 * Version 1.3.5 — `.fiche-text-aucun` : lisibilité du noir « aucun » sur fond fiche (halo blanc, carte inchangée)
 * Version 1.3.4 — jauge seuil parrainage n−1/n−2 (20 % rouge / 80 % vert, grands)
 * Copyright 2026 DNAvatar.org - Arnaud Maignan
 * Licensed under Apache License 2.0 with Commons Clause. See LICENSE_HEADER.txt for full terms.
 * Logs:
 * - 1.3.25: section Commune — `fiche-section-title-row` + Contacts à droite
 * - 1.3.24: `.fiche-header-title-row` — bouton Contacts à droite du nom
 * - 1.3.23: `.fiche-synth-mandats` / `.fiche-synth-parr-sub` ; `.fiche-row` sans gap
 * - 1.3.22: `.fiche-synth-row-head` — maire, genre, légende parrain en blanc
 * - 1.3.21: `.fiche-notes-heading` — hint à côté de Notes, sans encadré
 * - 1.3.20: bloc Notes + avertissement données personnelles lisible
 * - 1.3.19: `.fiche-row-val-maire-identite` — nom + Contacts même ligne
 * - 1.3.18: `.fiche-row-maire-contacts` — bouton Contacts sous Identité, à droite
 * - 1.3.17: `.fiche-section-title-btns` Maire ; `.fiche-suivi-save-row` ; synthèse score seul
 * - 1.3.16: `.fiche-panel` — ne couvre plus le dock signature (réserve `--parr-signature-reserve-h`)
 * - 1.3.15: `.fiche-row-val-insee` + `.fiche-insee-osm` ; `.fiche-btn-save` (titre Suivi prospection)
 * - 1.3.14: `.fiche-score-blend-tri` — `cursor: grab` / `:active grabbing`
 * - 1.3.13: retrait ref. `.btn-ia-cta-red` (style unifié `app.css` statsbar-zone-btn)
 * - 1.3.12: Vérification — classe `.btn-ia-cta-red` (gabarit Zone rouge)
 * - 1.3.11: bouton Vérification — même accent que Zone (`--ia-pipeline-accent`)
 * - 1.3.10: `.fiche-score-blend-tri` — largeur fixe, hauteur calibrée sur les lignes
 * - 1.3.9: `.fiche-score-languette-row` + canvas triangle IDW score
 * - 1.0.0: extrait de app.css
 * - 1.1.0: z-index panneau fiche pour rester au-dessus de Leaflet / ia-dock
 * - 1.1.1: .fiche-title-osm cartouche score ; désaccentuation titre rouge carte
 * - 1.3.0: .score-blend-gauge, .fiche-score-blend-total
 * - 1.3.3: `.fiche-cartouche-*` → `.fiche-languette-*` (terminologie)
 */

:root {
  --fiche-w: 380px;
  --fiche-aucun-text: #1a1a22;
}

/* Fiche seulement — même teinte que halo carte « aucun », lisible sur fond sombre */
.fiche-text-aucun {
  color: var(--fiche-aucun-text);
  font-weight: 600;
  text-shadow:
    0 0 2px #fff,
    0 0 4px #fff,
    -1px -1px 0 #fff,
    1px -1px 0 #fff,
    -1px 1px 0 #fff,
    1px 1px 0 #fff;
}
.fiche-text-aucun strong {
  font-weight: 700;
}

@media (max-width: 640px) {
  :root { --fiche-w: 100vw; }
}

/* ===== FICHE PANEL ===== */
.fiche-panel {
  position: absolute;
  top: 0;
  right: 0;
  bottom: var(--parr-signature-reserve-h, 0px);
  width: var(--fiche-w);
  height: auto;
  background: var(--c-surface);
  border-left: 2px solid var(--c-border);
  z-index: 650;
  display: flex;
  flex-direction: column;
  transform: translateX(0);
  transition: transform .2s ease;
  overflow: hidden;
}
.fiche-panel.hidden { transform: translateX(100%); }
.fiche-header {
  background: var(--c-panel);
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  border-bottom: 1px solid var(--c-border);
}
.fiche-header-name { font-weight: 700; font-size: 15px; flex: 1; }
.fiche-header-pop { color: var(--c-muted); font-size: 12px; }
.fiche-close {
  background: none;
  border: none;
  color: var(--c-muted);
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  padding: 2px 6px;
}
.fiche-close:hover { color: var(--c-accent); }
.fiche-body { flex: 1; overflow-y: auto; padding: 12px 14px; }
.fiche-synthese {
  margin-bottom: 14px;
}
.fiche-synthese-title {
  font-weight: 700;
  font-size: 12px;
  color: #5ed4e0;
  margin-bottom: 8px;
  letter-spacing: .04em;
}
.fiche-synthese-block { margin-bottom: 8px; font-size: 12px; line-height: 1.45; }
.fiche-synthese-block:last-child { margin-bottom: 0; }
.fiche-synthese-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--c-muted);
  margin-bottom: 3px;
}
.fiche-synthese-val { color: var(--c-text); }
.fiche-section { margin-bottom: 14px; }
.fiche-section-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: #5ed4e0;
  margin-bottom: 6px;
  padding-bottom: 4px;
  border-bottom: 1px solid rgba(94, 212, 224, 0.45);
}
.fiche-section-title-row {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
  padding-bottom: 4px;
  border-bottom: 1px solid rgba(94, 212, 224, 0.45);
}
.fiche-section-title-row .fiche-section-title {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}
.fiche-section-title-btns {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 4px;
  flex-shrink: 0;
}
.fiche-section-title-btns .statsbar-zone-btn {
  width: 100%;
  box-sizing: border-box;
  justify-content: center;
}
.fiche-suivi-save-row {
  display: flex;
  justify-content: flex-end;
  margin-top: 10px;
}
.fiche-suivi-save-row .statsbar-zone-btn {
  min-width: 7rem;
}
.fiche-btn-verify-maire,
.fiche-btn-contacts-ia,
.fiche-btn-save {
  flex-shrink: 0;
}
.fiche-btn-verify-maire:disabled {
  opacity: 0.55;
  cursor: wait;
}
.fiche-notes-block {
  margin-top: 6px;
}
.fiche-notes-heading {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0 6px;
  margin-bottom: 4px;
  line-height: 1.35;
}
.fiche-notes-label,
.fiche-notes-privacy-hint {
  font-size: 12px;
  font-weight: inherit;
}
.fiche-notes-label {
  color: var(--c-muted);
}
.fiche-notes-privacy-hint {
  color: #a8b6c6;
  font-style: italic;
}
.fiche-row-val-site {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  word-break: normal;
}
.fiche-site-web-link {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}
.fiche-row-insee .fiche-row-val-insee {
  flex: 1;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
}
.fiche-insee-osm {
  flex-shrink: 0;
  margin-left: auto;
  font-size: 12px;
}
.fiche-row {
  display: flex;
  align-items: baseline;
  margin-bottom: 3px;
  font-size: 12px;
}
.fiche-row-label { color: var(--c-muted); min-width: 110px; flex-shrink: 0; font-size: 12px; }
.fiche-row-val { color: var(--c-text); word-break: break-all; }
.fiche-row-val a { color: #6ab3e0; text-decoration: none; }
.fiche-row-val a:hover { text-decoration: underline; }

/* Synthèse : maire + légende parrain (blanc) · score coloré à droite */
.fiche-synth-row { display: flex; align-items: baseline; gap: 6px; font-size: 12px; margin-bottom: 4px; flex-wrap: wrap; }
.fiche-synth-row:last-child { margin-bottom: 0; }
.fiche-synth-row-head {
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 0;
}
.fiche-synth-head {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
}
.fiche-synth-head-line {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px 10px;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.35;
}
.fiche-synth-maire-nom {
  font-weight: 700;
}
.fiche-synth-genre {
  color: #fff;
  font-weight: 400;
}
.fiche-synth-mandats {
  color: #fff;
  font-weight: 600;
  font-size: 12px;
}
.fiche-synth-mandats-muted {
  color: #7e8d9d;
}
.fiche-synth-parr-sub {
  display: block;
  font-size: 11px;
  font-weight: 400;
  line-height: 1.35;
  color: var(--c-muted);
  max-width: 100%;
}
.fiche-synth-parr-item {
  display: inline;
}
.fiche-synth-parr-lbl {
  color: #8899aa;
  font-weight: 600;
}
.fiche-synth-parr-sep {
  color: #667788;
}
.fiche-synth-score-dot {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}
.fiche-synth-score-pct { font-size: 14px; font-weight: 700; }
.fiche-row-label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.fiche-row-label .parr-glyph-statut {
  margin-right: 0;
}
/* Score : jauge tricolor + score inline */
.fiche-score-inline-row { display: flex; align-items: center; gap: 10px; margin: 4px 0 8px; }
.fiche-score-inline-val { font-size: 18px; font-weight: 700; flex-shrink: 0; white-space: nowrap; }
/* Score bar */
.score-bar-bg { background: var(--c-border); border-radius: 3px; height: 8px; overflow: hidden; }
.score-bar-fill { height: 100%; border-radius: 3px; transition: width .3s; }
.score-detail { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.score-detail-weighted { align-items: center; }
.score-blend-gauge-wrap { margin: 10px 0 4px; }
.score-blend-gauge {
  display: flex;
  flex-direction: row;
  height: 14px;
  border-radius: 5px;
  overflow: hidden;
  background: rgba(20, 28, 48, 0.95);
  border: 1px solid var(--c-border);
}
.score-blend-seg { min-width: 0; display: block; }
.fiche-score-blend-total { font-size: 15px; font-weight: 700; margin: 6px 0 2px; letter-spacing: 0.02em; }
.score-chip {
  font-size: 11px;
  background: var(--c-bg);
  border: 1px solid var(--c-border);
  border-radius: 3px;
  padding: 2px 6px;
  color: var(--c-muted);
}
.score-chip.active { border-color: var(--c-warn); color: var(--c-warn); }

.fiche-languette-line {
  font-size: 12px;
  margin-bottom: 3px;
}
.fiche-languette-line strong { font-weight: 700; }
.fiche-score-languette-row {
  display: flex;
  align-items: stretch;
  gap: 10px;
  margin-top: 10px;
}
.fiche-score-languette-lines {
  flex: 1;
  min-width: 0;
  padding-left: 8px;
  line-height: 1.45;
}
.fiche-score-blend-tri {
  flex-shrink: 0;
  width: 118px;
  display: block;
  cursor: grab;
  touch-action: none;
  vertical-align: top;
}
.fiche-score-blend-tri:active {
  cursor: grabbing;
}
.fiche-title-osm { color: #3db8c9; }
.fiche-maire-data-hint {
  font-size: 11px;
  line-height: 1.4;
  color: #92a8b8;
  margin: -2px 0 10px 0;
  padding: 8px 10px;
  background: rgba(15, 30, 62, 0.35);
  border-radius: 4px;
  border-left: 3px solid rgba(94, 212, 224, 0.55);
}
/* Editable fields */
.fiche-edit-field {
  width: 100%;
  background: var(--c-bg);
  border: 1px solid var(--c-border);
  color: var(--c-text);
  border-radius: 4px;
  padding: 5px 8px;
  font-size: 13px;
  resize: none;
}
.fiche-edit-field:focus { outline: none; border-color: var(--c-accent); }
select.fiche-edit-field option { background: var(--c-bg); }

.fiche-footer {
  padding: 10px 14px;
  border-top: 1px solid var(--c-border);
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}
.btn-save {
  flex: 1;
  background: var(--c-success);
  border: none;
  color: #fff;
  border-radius: 4px;
  padding: 7px;
  cursor: pointer;
  font-weight: 600;
  font-size: 13px;
}
.btn-save:hover { opacity: .85; }
.btn-contacts {
  background: var(--c-panel);
  border: 1px solid var(--c-border);
  color: var(--c-text);
  border-radius: 4px;
  padding: 7px 10px;
  cursor: pointer;
  font-size: 12px;
}
.btn-contacts:hover { background: var(--c-border); }

/* Statut badge */
.statut-badge {
  display: inline-block;
  border-radius: 3px;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  text-transform: uppercase;
  letter-spacing: .04em;
}

/* Parrainage IA : lien source + validation */
.fiche-parr-ia-unverified {
  color: #c9a227;
  font-weight: 700;
  margin-right: 2px;
}
.fiche-parr-src {
  font-size: 11px;
  font-weight: 600;
  text-decoration: none;
  margin-left: 4px;
  border-bottom: 1px dotted;
}
.fiche-parr-src-ia {
  color: #e8a85c;
  border-bottom-color: #e8a85c;
}
.fiche-parr-src-verified {
  color: #6fcf97;
  border-bottom: 1px solid #6fcf97;
}
.fiche-parr-src-verify {
  margin-left: 4px;
  padding: 0 6px;
  font-size: 11px;
  line-height: 1.4;
  border: 1px solid #4a6a8a;
  border-radius: 4px;
  background: #1a2a3a;
  color: #9fd;
  cursor: pointer;
}
.fiche-parr-src-verify:hover {
  background: #243848;
  border-color: #6fcf97;
}

/* Parrainage n−1 / n−2 : catégorie taille + jauge seuil (grands) */
.fiche-parr-taille {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px 8px;
  margin-left: 6px;
  vertical-align: baseline;
}
.fiche-parr-taille-lbl {
  font-size: 11px;
  font-weight: 600;
  color: #8ab4d6;
  letter-spacing: 0.02em;
}
.fiche-parr-seuil {
  display: inline-block;
  width: 44px;
  height: 8px;
  border-radius: 3px;
  overflow: visible;
  position: relative;
  vertical-align: -2px;
  flex-shrink: 0;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12);
}
.fiche-parr-seuil-red {
  position: absolute;
  left: 0;
  top: 0;
  width: 20%;
  height: 100%;
  background: #b71c1c;
  border-radius: 3px 0 0 3px;
}
.fiche-parr-seuil-green {
  position: absolute;
  left: 20%;
  top: 0;
  width: 80%;
  height: 100%;
  background: #1b5e20;
  border-radius: 0 3px 3px 0;
}
.fiche-parr-seuil-pin {
  position: absolute;
  top: -1px;
  width: 3px;
  height: 10px;
  margin-top: 0;
  background: #fff;
  border-radius: 1px;
  box-shadow: 0 0 4px rgba(0, 0, 0, 0.5);
  z-index: 2;
  transform: translateX(-50%);
}
