/* ── Variables ──────────────────────────────────────────────────────────── */
:root {
  --bg:            #f0f4f8;
  --card:          #ffffff;
  --border:        #dde3ea;
  --text:          #1a2332;
  --muted:         #64748b;
  --primary:       #1565c0;
  --primary-dark:  #0d47a1;

  --conforme-color:   #16a34a;
  --conforme-bg:      #f0fdf4;
  --conforme-border:  #bbf7d0;

  --vigilance-color:  #b45309;
  --vigilance-bg:     #fffbeb;
  --vigilance-border: #fde68a;

  --nc-color:         #dc2626;
  --nc-bg:            #fef2f2;
  --nc-border:        #fecaca;

  --restrict-color:   #7c3aed;
  --restrict-bg:      #f5f3ff;
  --restrict-border:  #ddd6fe;

  --inconnu-color:    #6b7280;
  --inconnu-bg:       #f9fafb;
  --inconnu-border:   #e5e7eb;

  --radius: 14px;
  --shadow: 0 1px 4px rgba(0,0,0,.07), 0 4px 16px rgba(0,0,0,.08);
  --shadow-lg: 0 6px 24px rgba(0,0,0,.10), 0 20px 44px rgba(0,0,0,.12);
}

/* ── Reset ──────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
  font-family: system-ui, -apple-system, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Layout ─────────────────────────────────────────────────────────────── */
.container { max-width: 1080px; margin: 0 auto; padding: 0 1.25rem; }

/* ── Hero ───────────────────────────────────────────────────────────────── */
.hero {
  background: linear-gradient(135deg, #1565c0 0%, #0288d1 100%);
  color: #fff;
  padding: 4rem 1.25rem 3rem;
  text-align: center;
}
.hero-inner { max-width: 680px; margin: 0 auto; }
.hero-title  { font-size: clamp(1.75rem, 4vw, 2.5rem); font-weight: 700; letter-spacing: -.5px; margin-bottom: .75rem; }
.hero-subtitle { font-size: 1.05rem; opacity: .9; margin-bottom: 2rem; }

/* ── Search ─────────────────────────────────────────────────────────────── */
.search-wrapper { position: relative; }
.search-form {
  display: flex;
  background: #fff;
  border-radius: 50px;
  overflow: hidden;
  box-shadow: 0 4px 24px rgba(0,0,0,.2);
}
.search-input {
  flex: 1;
  border: none;
  padding: .85rem 1.5rem;
  font-size: 1rem;
  color: var(--text);
  background: transparent;
  outline: none;
}
.search-input::placeholder { color: #9ca3af; }
.search-btn {
  background: var(--primary);
  border: none;
  padding: .75rem 1.25rem;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  transition: background .2s;
}
.search-btn:hover { background: var(--primary-dark); }

/* ── Autocomplete ───────────────────────────────────────────────────────── */
.autocomplete-list {
  position: absolute;
  top: calc(100% + 6px);
  left: 0; right: 0;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  list-style: none;
  z-index: 100;
  overflow: hidden;
  text-align: left;
}
.autocomplete-list[hidden] { display: none; }
.autocomplete-list li {
  padding: .7rem 1.25rem;
  cursor: pointer;
  color: var(--text);
  font-size: .95rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: .5rem;
}
.autocomplete-list li:last-child { border-bottom: none; }
.autocomplete-list li:hover,
.autocomplete-list li.active { background: #eff6ff; }
.autocomplete-list .ac-dep { font-size: .8rem; color: var(--muted); white-space: nowrap; }

/* ── Hero badges / features / footer ───────────────────────────────────── */
.hero-badges { margin-top: 2rem; display: flex; gap: .6rem; justify-content: center; flex-wrap: wrap; }

.features { padding: 3rem 0; }
.features-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1.25rem; }
.feature-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.5rem; box-shadow: var(--shadow); }
.feature-icon { font-size: 2rem; margin-bottom: .75rem; }
.feature-card h3 { font-size: 1rem; margin-bottom: .4rem; }
.feature-card p  { font-size: .9rem; color: var(--muted); }

.footer { background: #fff; border-top: 1px solid var(--border); padding: 1.25rem 0; text-align: center; font-size: .85rem; color: var(--muted); }

/* ── Badges ─────────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: .3rem;
  padding: .2rem .65rem;
  border-radius: 50px;
  font-size: .78rem; font-weight: 600; white-space: nowrap;
}
.badge-lg { padding: .45rem 1.1rem; font-size: .9rem; }
.badge-conforme     { background: var(--conforme-bg);   color: var(--conforme-color);  border: 1px solid var(--conforme-border); }
.badge-vigilance    { background: var(--vigilance-bg);  color: var(--vigilance-color); border: 1px solid var(--vigilance-border); }
.badge-non-conforme { background: var(--nc-bg);         color: var(--nc-color);        border: 1px solid var(--nc-border); }
.badge-restriction  { background: var(--restrict-bg);   color: var(--restrict-color);  border: 1px solid var(--restrict-border); }
.badge-inconnu      { background: var(--inconnu-bg);    color: var(--inconnu-color);   border: 1px solid var(--inconnu-border); }

/* ── Commune header ─────────────────────────────────────────────────────── */
.commune-header { background: #fff; border-bottom: 1px solid var(--border); padding: 1.75rem 0; box-shadow: 0 1px 8px rgba(0,0,0,.05); }
.commune-header .container { display: flex; flex-direction: column; gap: .45rem; }
.breadcrumb { font-size: .82rem; color: var(--muted); }
.breadcrumb a { color: var(--muted); }
.breadcrumb a:hover { color: var(--primary); }
.commune-title-row { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.commune-title { font-size: clamp(1.6rem, 3vw, 2.2rem); font-weight: 800; letter-spacing: -.5px; }
.commune-meta { font-size: .88rem; color: var(--muted); display: flex; gap: .85rem; flex-wrap: wrap; }
.commune-meta span::before { content: '· '; }
.commune-meta span:first-child::before { content: ''; }

/* ── Alert ──────────────────────────────────────────────────────────────── */
.alert { padding: .9rem 1.1rem; border-radius: var(--radius); margin-bottom: 1.5rem; border: 1px solid; font-size: .92rem; }
.alert-warning { background: var(--vigilance-bg); color: var(--vigilance-color); border-color: var(--vigilance-border); }
.alert-danger  { background: var(--nc-bg);        color: var(--nc-color);        border-color: var(--nc-border); }
.alert-purple  { background: var(--restrict-bg);  color: var(--restrict-color);  border-color: var(--restrict-border); }

/* ── Main content ───────────────────────────────────────────────────────── */
.commune-main { padding: 1.75rem 0 3rem; }

/* ══════════════════════════════════════════════════════════════════════════
   HISTORIQUE
═══════════════════════════════════════════════════════════════════════════ */
.history-section {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow);
}
.history-title {
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 1rem;
}

/* ── Timeline horizontale ─────────────────────────────────────────────── */
.tl-scroll {
  overflow-x: auto;
  margin-bottom: 1.25rem;
  padding-bottom: .25rem;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
.tl-inner {
  display: flex;
  align-items: flex-start;
  min-width: max-content;
  padding: .5rem .5rem .25rem;
  position: relative;
}
/* Ligne de connexion entre les points */
.tl-inner::before {
  content: '';
  position: absolute;
  top: calc(.5rem + 11px);
  left: 30px;
  right: 30px;
  height: 2px;
  background: var(--border);
}
.tl-dot {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .3rem;
  min-width: 60px;
  padding: 0 .25rem;
  text-decoration: none;
  position: relative;
  z-index: 1;
}
.tl-dot:hover { text-decoration: none; }
.tl-pip {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 0 2.5px #fff, 0 0 0 4px currentColor;
  transition: transform .12s;
  flex-shrink: 0;
}
.tl-dot:hover .tl-pip { transform: scale(1.18); }
.tl-dot.tl-active .tl-pip {
  width: 28px;
  height: 28px;
  box-shadow: 0 0 0 3px #fff, 0 0 0 5.5px currentColor;
}
/* Couleurs via currentColor hérité par .tl-pip */
.tdot-conforme     { color: var(--conforme-color); }
.tdot-vigilance    { color: var(--vigilance-color); }
.tdot-non-conforme { color: var(--nc-color); }
.tdot-restriction  { color: var(--restrict-color); }
.tdot-inconnu      { color: var(--inconnu-color); }
.tl-lbl {
  font-size: .67rem;
  color: var(--muted);
  white-space: nowrap;
  text-align: center;
  line-height: 1.2;
}
.tl-dot.tl-active .tl-lbl {
  color: var(--primary);
  font-weight: 700;
}

/* ── Tableau évolution paramètres ─────────────────────────────────────── */
.evo-wrap {
  border-top: 1px solid var(--border);
  padding-top: 1rem;
}
.evo-title {
  font-size: .72rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .08em;
  margin-bottom: .75rem;
}
.evo-scroll {
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch; /* momentum scrolling iOS */
  overscroll-behavior-x: contain;
  scrollbar-width: thin;
  scrollbar-color: var(--primary) transparent;
  /* Indique visuellement que le tableau est scrollable */
  background:
    linear-gradient(to right, var(--card) 20px, transparent 40px),
    linear-gradient(to left,  var(--card) 20px, transparent 40px),
    radial-gradient(farthest-side at 0 50%, rgba(0,0,0,.08), transparent),
    radial-gradient(farthest-side at 100% 50%, rgba(0,0,0,.08), transparent);
  background-repeat: no-repeat;
  background-attachment: local, local, scroll, scroll;
}
.evo-table {
  border-collapse: separate;
  border-spacing: 0;
  font-size: .8rem;
  min-width: 100%;
}
.evo-table th {
  background: #f8fafc;
  font-weight: 700;
  font-size: .68rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  padding: .55rem .65rem;
  white-space: nowrap;
  border-bottom: 2px solid var(--border);
  border-right: 1px solid #edf0f3;
  color: var(--muted);
  text-align: center;
}
.evo-table th:last-child { border-right: none; }
.evo-table th.evo-param-col {
  text-align: left;
  position: sticky;
  left: 0;
  z-index: 20;
  background: #f8fafc;
  border-right: 2px solid var(--border);
}
.evo-table th.evo-active {
  background: #eff6ff;
  color: var(--primary);
}
/* Ligne de catégorie */
.evo-cat-row td {
  background: #f8fafc;
  font-size: .67rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--muted);
  padding: .35rem .65rem;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid #edf0f3;
  white-space: nowrap;
}
.evo-cat-row td.evo-param-col {
  position: sticky;
  left: 0;
  z-index: 10;
  border-right: 2px solid var(--border);
}
/* Cellules de données */
.evo-table td {
  padding: .45rem .65rem;
  border-bottom: 1px solid #f0f2f5;
  border-right: 1px solid #f0f2f5;
  vertical-align: middle;
}
.evo-table td:last-child { border-right: none; }
.evo-table td.evo-param-name {
  position: sticky;
  left: 0;
  background: #fff;
  z-index: 10;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  border-right: 2px solid var(--border);
}
.evo-table tr:hover td.evo-param-name { background: #fafbfc; }
.evo-table td.evo-active { background: rgba(239,246,255,.6); }
.evo-table td.evo-param-name.evo-active { background: #eff6ff; }
/* Chip de valeur */
.evo-cell {
  display: block;
  border-radius: 4px;
  padding: .2rem .45rem;
  font-weight: 600;
  white-space: nowrap;
  font-size: .76rem;
  text-align: center;
}
.evc-conforme     { background: rgba(22,163,74,.12);  color: var(--conforme-color); }
.evc-vigilance    { background: rgba(180,83,9,.11);   color: var(--vigilance-color); }
.evc-non-conforme { background: rgba(220,38,38,.12);  color: var(--nc-color); }
.evc-restriction  { background: rgba(124,58,237,.10); color: var(--restrict-color); }
.evc-inconnu      { color: var(--muted); font-weight: 400; }
.evo-cell-empty   { display: block; text-align: center; color: var(--border); font-size: .9rem; }

/* ══════════════════════════════════════════════════════════════════════════
   TABLEAU PARAMÈTRES
═══════════════════════════════════════════════════════════════════════════ */
.ptable-section {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  margin-bottom: 1.25rem;
}

/* En-tête tableau */
.ptable-header {
  display: grid;
  grid-template-columns: 190px 110px 1fr 105px;
  gap: .75rem;
  padding: .55rem 1.1rem;
  background: #f8fafc;
  border-bottom: 2px solid var(--border);
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--muted);
}

/* Séparateur de catégorie */
.ptable-cat {
  padding: .4rem 1.1rem;
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted);
  background: #f8fafc;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid #edf0f3;
}
.ptable-cat:first-of-type { border-top: none; }

/* Ligne de paramètre */
.ptable-row {
  display: grid;
  grid-template-columns: 190px 110px 1fr 105px;
  align-items: center;
  gap: .75rem;
  padding: .65rem 1.1rem;
  border-bottom: 1px solid #f0f2f5;
  transition: background .12s;
}
.ptable-row:last-child { border-bottom: none; }
.ptable-row:hover { background: #fafbfc; }

/* Bordure gauche colorée par conformité */
.ptable-row { border-left: 3px solid transparent; }
.ptable-row.row-conforme     { border-left-color: var(--conforme-color); }
.ptable-row.row-vigilance    { border-left-color: var(--vigilance-color); }
.ptable-row.row-non-conforme { border-left-color: var(--nc-color); }
.ptable-row.row-restriction  { border-left-color: var(--restrict-color); }
.ptable-row.row-inconnu      { border-left-color: transparent; }

.col-name { font-size: .88rem; font-weight: 600; color: var(--text); }
.col-val  { font-size: .95rem; font-weight: 700; color: var(--text); }
.ptable-row.row-non-conforme .col-val { color: var(--nc-color); }
.ptable-row.row-restriction  .col-val { color: var(--restrict-color); }
.ptable-row.row-vigilance    .col-val { color: var(--vigilance-color); }
.col-val small { font-size: .75rem; font-weight: 400; color: var(--muted); margin-left: .2rem; }
.col-status { display: flex; justify-content: flex-end; }

/* ── Slider curseur ──────────────────────────────────────────────────────── */
/*  Usage PHP :
    style="--pct:52;--clr:var(--conforme-color)"
    Pour range : style="--pos:48.5;--zl:11.5;--zw:76.9;--clr:var(--conforme-color)"
*/
.pslider { display: flex; flex-direction: column; gap: 5px; }

.pslider-rail {
  position: relative;
  height: 5px;
  background: #e5e7eb;
  border-radius: 3px;
}
.pslider-fill {
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: calc(min(var(--pct, 0), 100) * 1%);
  background: var(--clr, var(--conforme-color));
  border-radius: 3px;
}
.pslider-thumb {
  position: absolute;
  width: 15px; height: 15px;
  border-radius: 50%;
  background: #fff;
  border: 2.5px solid var(--clr, var(--conforme-color));
  box-shadow: 0 1px 4px rgba(0,0,0,.18);
  top: 50%;
  left: calc(min(var(--pct, 0), 100) * 1%);
  transform: translate(-50%, -50%);
  z-index: 1;
}

/* Range slider (pH, conductivité) */
.pslider-range .pslider-zone {
  position: absolute;
  top: 0; bottom: 0;
  left: calc(var(--zl, 0) * 1%);
  width: calc(var(--zw, 100) * 1%);
  background: rgba(22,163,74,.2);
  border-radius: 2px;
}
.pslider-range .pslider-fill  { display: none; }
.pslider-range .pslider-thumb {
  left: calc(min(max(var(--pos, 0), 0), 100) * 1%);
}

/* Labels sous le slider */
.pslider-meta {
  display: flex;
  justify-content: space-between;
  font-size: .68rem;
  color: var(--muted);
  padding: 0 .1rem;
}

/* Cas bactériologie : présence/absence */
.bact-presence {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  font-size: .82rem;
  font-weight: 600;
  color: var(--nc-color);
  background: var(--nc-bg);
  border: 1px solid var(--nc-border);
  border-radius: 4px;
  padding: .15rem .5rem;
}

/* ── Empty state ────────────────────────────────────────────────────────── */
.empty-state { text-align: center; padding: 3rem 1rem; color: var(--muted); }
.empty-state .empty-icon { font-size: 3rem; margin-bottom: 1rem; }
.empty-state h2 { font-size: 1.2rem; color: var(--text); margin-bottom: .5rem; }

/* ── Data meta + bouton historique ─────────────────────────────────────── */
.data-meta-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 1.25rem;
  gap: .75rem;
  flex-wrap: wrap;
}
.data-meta { font-size: .78rem; color: var(--muted); }

.btn-history-toggle {
  background: #fff;
  border: 1px solid var(--border);
  color: var(--primary);
  padding: .3rem .9rem;
  border-radius: 50px;
  font-size: .82rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s, border-color .15s;
  flex-shrink: 0;
}
.btn-history-toggle:hover {
  background: #eff6ff;
  border-color: var(--primary);
}

/* Bouton "Charger l'historique complet" à l'intérieur du panel */
.history-load-full {
  border-top: 1px solid var(--border);
  padding-top: .75rem;
  margin-top: .5rem;
  display: flex;
  align-items: center;
  gap: .5rem;
  flex-wrap: wrap;
}
.history-load-full button {
  background: #fff;
  border: 1px solid var(--border);
  color: var(--muted);
  padding: .25rem .75rem;
  border-radius: 50px;
  font-size: .78rem;
  cursor: pointer;
  transition: border-color .15s, color .15s;
}
.history-load-full button:hover { border-color: var(--primary); color: var(--primary); }
.history-load-full #history-load-status { font-size: .75rem; color: var(--muted); }

/* Unité dans la colonne paramètre du tableau évolution */
.evo-param-unit { font-weight: 400; color: var(--muted); font-size: .72rem; margin-left: .15rem; }

/* ══════════════════════════════════════════════════════════════════════════
   VUE HABITANT — Verdict, catégories, attention
═══════════════════════════════════════════════════════════════════════════ */

/* ── Verdict hero ──────────────────────────────────────────────────────── */
.verdict-wrap {
  border-radius: 24px;
  padding: 2.75rem 2rem;
  margin-bottom: 1.75rem;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .6rem;
  border: none;
  position: relative;
  overflow: hidden;
}
.verdict-wrap::before {
  content: '';
  position: absolute;
  top: -70px; left: -40px;
  width: 240px; height: 240px;
  border-radius: 50%;
  background: rgba(255,255,255,.06);
  pointer-events: none;
}
.verdict-wrap::after {
  content: '';
  position: absolute;
  bottom: -50px; right: -50px;
  width: 200px; height: 200px;
  border-radius: 50%;
  background: rgba(255,255,255,.05);
  pointer-events: none;
}
.verdict-wrap.verdict-conforme {
  background: linear-gradient(135deg, #15803d 0%, #059669 60%, #10b981 100%);
  box-shadow: 0 8px 32px rgba(5,150,105,.40), 0 2px 8px rgba(5,150,105,.2);
}
.verdict-wrap.verdict-vigilance {
  background: linear-gradient(135deg, #b45309 0%, #d97706 60%, #f59e0b 100%);
  box-shadow: 0 8px 32px rgba(217,119,6,.40), 0 2px 8px rgba(217,119,6,.2);
}
.verdict-wrap.verdict-non-conforme {
  background: linear-gradient(135deg, #b91c1c 0%, #dc2626 60%, #ef4444 100%);
  box-shadow: 0 8px 32px rgba(220,38,38,.40), 0 2px 8px rgba(220,38,38,.2);
}
.verdict-wrap.verdict-restriction {
  background: linear-gradient(135deg, #5b21b6 0%, #7c3aed 60%, #8b5cf6 100%);
  box-shadow: 0 8px 32px rgba(124,58,237,.40), 0 2px 8px rgba(124,58,237,.2);
}
.verdict-wrap.verdict-inconnu {
  background: linear-gradient(135deg, #334155 0%, #475569 100%);
  box-shadow: 0 8px 32px rgba(71,85,105,.25);
}
.verdict-icon {
  font-size: 3.5rem;
  line-height: 1;
  filter: drop-shadow(0 2px 8px rgba(0,0,0,.25));
  margin-bottom: .2rem;
  position: relative;
  z-index: 1;
}
.verdict-label {
  font-size: 1.75rem;
  font-weight: 800;
  color: #fff;
  letter-spacing: -.5px;
  line-height: 1.15;
  text-shadow: 0 1px 4px rgba(0,0,0,.2);
  position: relative;
  z-index: 1;
}
.verdict-phrase {
  font-size: 1.05rem;
  font-weight: 400;
  line-height: 1.6;
  max-width: 540px;
  color: rgba(255,255,255,.92);
  position: relative;
  z-index: 1;
}
.verdict-meta {
  font-size: .8rem;
  color: rgba(255,255,255,.65);
  margin-top: .2rem;
  position: relative;
  z-index: 1;
}
.verdict-conclusion {
  font-size: .83rem;
  line-height: 1.55;
  color: rgba(255,255,255,.82);
  font-style: italic;
  border-top: 1px solid rgba(255,255,255,.2);
  padding-top: .7rem;
  margin-top: .3rem;
  max-width: 580px;
  text-align: left;
  position: relative;
  z-index: 1;
}
.verdict-conclusion-icon {
  font-style: normal;
}

/* ── 4 cartes bulles ───────────────────────────────────────────────────── */
.cat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 1.75rem;
}
.cat-bubble-wrap {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 1.5rem 1rem 1.25rem;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .55rem;
  cursor: default;
  transition: transform .18s ease, box-shadow .18s ease;
}
.cat-bubble-wrap:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-lg);
}
.cat-bubble {
  width: 74px;
  height: 74px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.9rem;
  border: 3px solid;
}
.cat-bubble.cat-conforme     { background: var(--conforme-bg);  border-color: var(--conforme-border);  box-shadow: 0 4px 12px rgba(22,163,74,.18); }
.cat-bubble.cat-vigilance    { background: var(--vigilance-bg); border-color: var(--vigilance-border); box-shadow: 0 4px 12px rgba(180,83,9,.18); }
.cat-bubble.cat-non-conforme { background: var(--nc-bg);        border-color: var(--nc-border);        box-shadow: 0 4px 12px rgba(220,38,38,.18); }
.cat-bubble.cat-restriction  { background: var(--restrict-bg);  border-color: var(--restrict-border);  box-shadow: 0 4px 12px rgba(124,58,237,.18); }
.cat-bubble.cat-inconnu      { background: var(--inconnu-bg);   border-color: var(--inconnu-border); }
.cat-label {
  font-size: .8rem;
  font-weight: 700;
  color: var(--text);
  text-align: center;
  line-height: 1.25;
}
.cat-status {
  font-size: .68rem;
  font-weight: 700;
  padding: .18rem .65rem;
  border-radius: 20px;
  letter-spacing: .02em;
  text-align: center;
}
.cat-status.cat-conforme     { background: var(--conforme-bg);  color: var(--conforme-color); }
.cat-status.cat-vigilance    { background: var(--vigilance-bg); color: var(--vigilance-color); }
.cat-status.cat-non-conforme { background: var(--nc-bg);        color: var(--nc-color); }
.cat-status.cat-restriction  { background: var(--restrict-bg);  color: var(--restrict-color); }
.cat-status.cat-inconnu      { background: var(--inconnu-bg);   color: var(--inconnu-color); }

/* ── Points d'attention ────────────────────────────────────────────────── */
.attention-wrap {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 20px;
  overflow: hidden;
  margin-bottom: 1.75rem;
  box-shadow: var(--shadow);
}
.attention-title {
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 1rem 1.5rem .75rem;
  border-bottom: 1px solid var(--border);
  background: #f8fafc;
}
.attention-item {
  padding: 1rem 1.5rem;
  border-bottom: 1px solid #f0f2f5;
  border-left: 4px solid transparent;
  transition: background .12s;
}
.attention-item:hover { background: #fafbfc; }
.attention-item:last-child { border-bottom: none; }
.attention-item.aitem-vigilance    { border-left-color: var(--vigilance-color); }
.attention-item.aitem-non-conforme { border-left-color: var(--nc-color); }
.attention-item.aitem-restriction  { border-left-color: var(--restrict-color); }
.attention-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  margin-bottom: .35rem;
}
.attention-name  { font-weight: 700; font-size: .95rem; color: var(--text); }
.attention-detail { font-size: .84rem; color: var(--muted); line-height: 1.5; }
.attention-val   { font-weight: 700; font-size: .95rem; color: var(--text); }
.attention-lim   { color: var(--muted); }
.attention-desc {
  margin-top: .5rem;
  padding-top: .5rem;
  border-top: 1px solid #f0f2f5;
  font-size: .83rem;
  color: var(--muted);
  line-height: 1.55;
}
.attention-desc-icon {
  font-style: normal;
  opacity: .55;
  margin-right: .1rem;
}

/* ── Toggle "voir les détails" ─────────────────────────────────────────── */
.details-section { margin-bottom: 1.5rem; }
.btn-details-toggle {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  border: none;
  color: #fff;
  padding: .65rem 1.5rem;
  border-radius: 50px;
  font-size: .88rem;
  font-weight: 600;
  cursor: pointer;
  width: 100%;
  text-align: center;
  margin-bottom: .75rem;
  box-shadow: 0 2px 8px rgba(21,101,192,.25);
  transition: box-shadow .15s, transform .12s;
}
.btn-details-toggle:hover {
  box-shadow: 0 4px 16px rgba(21,101,192,.38);
  transform: translateY(-1px);
}

/* ── Tableau paramètres : état chargement ───────────────────────────────── */
#ptable-container {
  transition: opacity .2s;
}
#ptable-container.ptable-loading {
  opacity: .35;
  pointer-events: none;
}

/* ── Modal de chargement ────────────────────────────────────────────────── */
#loading-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 900;
  align-items: center;
  justify-content: center;
}
#loading-modal.active {
  display: flex;
}
.loading-backdrop {
  position: absolute;
  inset: 0;
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  background: rgba(15, 23, 42, .4);
}
.loading-dialog {
  position: relative;
  background: #fff;
  border-radius: 18px;
  padding: 2.25rem 2.75rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.25rem;
  box-shadow: 0 24px 64px rgba(0,0,0,.28);
  max-width: 320px;
  width: 90%;
  text-align: center;
}
.loading-spinner {
  width: 48px;
  height: 48px;
  border: 4px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin .75s linear infinite;
  flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-msg {
  font-size: .9rem;
  color: var(--muted);
  line-height: 1.5;
  white-space: pre-line;
}

/* ── Responsive ─────────────────────────────────────────────────────────── */
@media (max-width: 820px) {
  .ptable-header,
  .ptable-row {
    grid-template-columns: 160px 95px 1fr 85px;
  }
}
@media (max-width: 620px) {
  .ptable-header { display: none; }
  .ptable-row {
    grid-template-columns: 1fr 85px;
    grid-template-rows: auto auto;
  }
  .col-name   { grid-column: 1; grid-row: 1; }
  .col-val    { display: none; } /* valeur déjà dans le slider label */
  .col-gauge  { grid-column: 1 / 3; grid-row: 2; }
  .col-status { grid-column: 2; grid-row: 1; }
  .cat-grid { grid-template-columns: repeat(2, 1fr); gap: .75rem; }
  .verdict-wrap { padding: 2rem 1.25rem; border-radius: 20px; }
  .verdict-icon { font-size: 2.75rem; }
  .verdict-label { font-size: 1.4rem; }
  .verdict-phrase { font-size: .95rem; }
}
@media (max-width: 480px) {
  .hero { padding: 2.5rem 1rem 2rem; }
  .commune-title-row { flex-direction: column; align-items: flex-start; }
  .cat-bubble { width: 60px; height: 60px; font-size: 1.55rem; border-width: 2px; }
  .cat-label  { font-size: .72rem; }
  .cat-bubble-wrap { padding: 1.1rem .75rem 1rem; border-radius: 16px; }
}

/* ══════════════════════════════════════════════════════════════════════════
   PAGES CONTACT & MENTIONS LÉGALES
═══════════════════════════════════════════════════════════════════════════ */

/* ── En-tête de page ────────────────────────────────────────────────────── */
.page-header {
  background: #fff;
  border-bottom: 1px solid var(--border);
  padding: 1.75rem 0;
  box-shadow: 0 1px 8px rgba(0,0,0,.05);
}
.page-title    { font-size: clamp(1.5rem, 3vw, 2rem); font-weight: 800; letter-spacing: -.4px; margin-bottom: .3rem; }
.page-subtitle { font-size: .95rem; color: var(--muted); margin: 0; }

/* ── Zone de contenu ────────────────────────────────────────────────────── */
.page-section { padding: 2rem 0 3rem; }

/* ── Alert succès ───────────────────────────────────────────────────────── */
.alert-success { background: var(--conforme-bg); color: var(--conforme-color); border-color: var(--conforme-border); }

/* ── Carte formulaire ───────────────────────────────────────────────────── */
.form-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 2rem;
  margin-bottom: 2rem;
}
.form-card-title { font-size: 1.15rem; font-weight: 700; margin-bottom: .25rem; }
.form-card-hint  { font-size: .85rem; color: var(--muted); margin-bottom: 1.5rem; }

.form-row   { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.form-group { display: flex; flex-direction: column; gap: .35rem; margin-bottom: 1rem; }
.form-label { font-size: .88rem; font-weight: 600; color: var(--text); }

.form-input {
  border: 1.5px solid var(--border);
  border-radius: 8px;
  padding: .6rem .85rem;
  font-size: .95rem;
  font-family: inherit;
  color: var(--text);
  background: #fff;
  transition: border-color .15s, box-shadow .15s;
  width: 100%;
}
.form-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(21,101,192,.12);
}
.form-input.input-error { border-color: var(--nc-color); }
textarea.form-input { resize: vertical; }

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
  border: none;
  border-radius: 50px;
  padding: .75rem 2.5rem;
  font-size: .95rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(21,101,192,.25);
  transition: box-shadow .15s, transform .12s;
}
.btn-primary:hover {
  box-shadow: 0 4px 16px rgba(21,101,192,.38);
  transform: translateY(-1px);
}

/* ── Grille info-cards ──────────────────────────────────────────────────── */
.info-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-top: .5rem;
}
.info-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1rem;
  text-align: center;
  box-shadow: var(--shadow);
}
.info-icon       { font-size: 2rem; margin-bottom: .5rem; }
.info-card h3    { font-size: .9rem; font-weight: 700; margin-bottom: .25rem; }
.info-card p     { font-size: .82rem; color: var(--muted); margin: 0; }

/* ── Article mentions légales ───────────────────────────────────────────── */
.content-section {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 2rem 2.25rem;
}
.content-section h2 {
  font-size: 1.05rem;
  font-weight: 700;
  margin: 1.75rem 0 .5rem;
  padding-bottom: .4rem;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}
.content-section h2:first-child { margin-top: 0; }
.content-section p  { font-size: .92rem; color: var(--muted); line-height: 1.7; margin-bottom: .75rem; }
.content-section a  { color: var(--primary); }

/* ── Responsive pages ───────────────────────────────────────────────────── */
@media (max-width: 640px) {
  .form-row  { grid-template-columns: 1fr; }
  .info-grid { grid-template-columns: 1fr; }
  .form-card { padding: 1.25rem; }
  .content-section { padding: 1.25rem; }
}

/* ══════════════════════════════════════════════════════════════════════════
   PAGE COMPRENDRE L'EAU
═══════════════════════════════════════════════════════════════════════════ */

.learn-layout {
  display: grid;
  grid-template-columns: 230px 1fr;
  gap: 1.75rem;
  align-items: start;
}

/* ── Sidebar navigation ─────────────────────────────────────────────────── */
.learn-nav {
  position: sticky;
  top: 1.5rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1rem;
  max-height: calc(100vh - 3rem);
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
.learn-nav-title {
  font-size: .68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--muted);
  margin-bottom: .5rem;
  padding: 0 .25rem;
}
.learn-nav ul { list-style: none; margin-bottom: .85rem; }
.learn-nav .nav-cat {
  display: flex;
  align-items: center;
  gap: .4rem;
  padding: .35rem .5rem;
  border-radius: 6px;
  font-size: .85rem;
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
  transition: background .12s;
}
.learn-nav .nav-cat:hover { background: #eff6ff; color: var(--primary); text-decoration: none; }
.learn-nav .nav-param {
  display: block;
  padding: .2rem .5rem .2rem 1.5rem;
  border-radius: 5px;
  font-size: .8rem;
  color: var(--muted);
  text-decoration: none;
  transition: background .12s, color .12s;
}
.learn-nav .nav-param:hover { background: #f0f4f8; color: var(--primary); text-decoration: none; }

/* ── Section de catégorie ───────────────────────────────────────────────── */
.param-section { margin-bottom: 2.25rem; scroll-margin-top: 1rem; }
.param-section-hd {
  display: flex;
  align-items: center;
  gap: .6rem;
  margin-bottom: 1rem;
  padding-bottom: .6rem;
  border-bottom: 2px solid var(--border);
}
.param-section-icon  { font-size: 1.5rem; }
.param-section-title { font-size: 1.1rem; font-weight: 800; color: var(--text); }

/* ── Carte paramètre ────────────────────────────────────────────────────── */
.param-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: .85rem;
  overflow: hidden;
  scroll-margin-top: 1rem;
}
.param-card-hd {
  background: #f8fafc;
  border-bottom: 1px solid var(--border);
  padding: .75rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.param-card-name  { font-size: .98rem; font-weight: 700; color: var(--text); }
.param-card-badge {
  font-size: .7rem;
  font-weight: 700;
  border-radius: 20px;
  padding: .2rem .7rem;
  white-space: nowrap;
  flex-shrink: 0;
}
.pbadge-lim  { background: var(--primary); color: #fff; }
.pbadge-ref  { background: var(--muted);   color: #fff; }
.pbadge-none { background: var(--nc-color); color: #fff; }
.pbadge-info { background: var(--inconnu-bg); color: var(--inconnu-color); border: 1px solid var(--inconnu-border); }

.param-card-body { padding: 1rem 1.25rem; }
.param-card-body p { font-size: .9rem; color: var(--muted); line-height: 1.7; margin-bottom: .5rem; }
.param-card-body p:last-child { margin-bottom: 0; }

.learn-sub  {
  font-size: .68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--muted);
  margin: .85rem 0 .25rem;
}
.learn-box {
  border-radius: 8px;
  padding: .6rem .9rem;
  font-size: .87rem;
  line-height: 1.65;
}
.learn-box-ok     { background: var(--conforme-bg);  color: var(--conforme-color);  border: 1px solid var(--conforme-border); }
.learn-box-warn   { background: var(--vigilance-bg); color: var(--vigilance-color); border: 1px solid var(--vigilance-border); }
.learn-box-danger { background: var(--nc-bg);        color: var(--nc-color);        border: 1px solid var(--nc-border); }

/* ── Lien "en savoir plus" depuis le tableau commune ───────────────────── */
.param-learn-link { color: inherit; text-decoration: none; border-bottom: 1px dashed var(--border); }
.param-learn-link:hover { color: var(--primary); border-bottom-color: var(--primary); text-decoration: none; }

/* ── Responsive ─────────────────────────────────────────────────────────── */
@media (max-width: 780px) {
  .learn-layout { grid-template-columns: 1fr; }
  .learn-nav { position: static; max-height: none; }
}
