:root {
  --bleu: #1466c8;
  --bleu-fonce: #0d3f7a;
  --vert: #17925a;
  --rouge: #cc2f3b;
  --orange: #a8500a; /* orange accessible (WCAG AA) : ~5.5:1 avec blanc, ~4.8:1 sur fond clair */
  --gris-bg: #f4f6f9;
  --gris-bord: #e2e7ee;
  --texte: #1c2733;
  --texte-doux: #64748b;
  --radius: 12px;
  --ombre: 0 4px 18px rgba(16, 42, 76, 0.08);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--texte);
  background: var(--gris-bg);
  line-height: 1.55;
}

.container { width: 100%; max-width: 1080px; margin: 0 auto; padding: 0 20px; }
.container.narrow { max-width: 680px; }

a { color: var(--bleu); }

/* ---------- Header ---------- */
.site-header {
  background: #fff;
  border-bottom: 1px solid var(--gris-bord);
  position: sticky; top: 0; z-index: 50;
}
.header-inner { display: flex; align-items: center; justify-content: space-between; height: 64px; }
.logo { font-size: 1.35rem; font-weight: 800; text-decoration: none; color: var(--bleu-fonce); }
.logo span { color: var(--orange); }
.main-nav a { margin-left: 22px; text-decoration: none; color: var(--texte-doux); font-weight: 600; font-size: .95rem; }
.main-nav a:hover { color: var(--bleu); }

/* ---------- Hero ---------- */
.hero {
  background: linear-gradient(135deg, var(--bleu-fonce), var(--bleu));
  color: #fff;
  padding: 56px 0 72px;
  text-align: center;
}
.hero h1 { font-size: 2.3rem; margin: 0 0 14px; font-weight: 800; }
.hero h1 strong { color: #ffd479; }
.hero-sub { font-size: 1.05rem; opacity: .95; margin: 0 auto 30px; max-width: 640px; }

.search-box {
  background: #fff;
  border-radius: 16px;
  box-shadow: var(--ombre);
  padding: 18px;
  display: flex;
  gap: 14px;
  align-items: flex-end;
  max-width: 760px;
  margin: 0 auto;
  text-align: left;
}
.field { flex: 1; }
.field-ville { position: relative; }

/* Menu d'autocomplete des communes */
.suggestions {
  list-style: none; margin: 6px 0 0; padding: 6px; position: absolute;
  top: 100%; left: 0; right: 0; z-index: 60; background: #fff;
  border: 1px solid var(--gris-bord); border-radius: 12px;
  box-shadow: 0 12px 30px rgba(16, 42, 76, 0.18); max-height: 320px; overflow-y: auto;
}
.suggestions[hidden] { display: none; }
.suggestions li {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: 8px; cursor: pointer; color: var(--texte);
}
.suggestions li:hover, .suggestions li.active { background: #eef4fc; }
.suggestions .sug-nom { font-weight: 700; }
.suggestions .sug-cp { font-size: .8rem; color: var(--texte-doux); white-space: nowrap; }
.suggestions .sug-info { padding: 10px 12px; color: var(--texte-doux); font-size: .85rem; cursor: default; }
.suggestions .sug-info:hover { background: transparent; }

/* Accessibilité : texte réservé aux lecteurs d'écran */
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.field label { display: block; font-size: .78rem; font-weight: 700; color: var(--texte-doux); margin-bottom: 6px; text-transform: uppercase; letter-spacing: .03em; }
.field input, .field select {
  width: 100%; padding: 12px 14px; border: 1px solid var(--gris-bord);
  border-radius: 10px; font-size: 1rem; background: #fff; color: var(--texte);
}
.field input:focus, .field select:focus { outline: none; border-color: var(--bleu); box-shadow: 0 0 0 3px rgba(20,102,200,.15); }

/* ---------- Boutons ---------- */
.btn {
  border: none; border-radius: 10px; padding: 13px 20px; font-size: 1rem;
  font-weight: 700; cursor: pointer; transition: transform .05s, background .15s; white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--orange); color: #fff; }
.btn-primary:hover { background: #8a4108; }
.btn-dark { background: var(--bleu-fonce); color: #fff; }
.btn-dark:hover { background: #0a2f5c; }
.btn-controle { background: #eef4fc; color: var(--bleu-fonce); border: 1px solid #cfe0f5; padding: 9px 14px; border-radius: 8px; font-weight: 700; font-size: .9rem; cursor: pointer; }
.btn-controle:hover { background: #e0ecfb; }
.btn-ghost { background: transparent; border: 1px solid var(--gris-bord); color: var(--texte); padding: 9px 14px; border-radius: 8px; font-weight: 600; font-size: .9rem; text-decoration: none; display: inline-block; }
.btn-ghost:hover { border-color: var(--bleu); color: var(--bleu); }

.live-note { margin: 16px 0 0; font-size: .92rem; color: #eaf1fb; }
.live-note strong { color: #ffd479; }

.card-badges { display: flex; flex-direction: column; gap: 6px; align-items: flex-end; }

/* Badge statut sur les fiches live */
.badge-etat { font-size: .74rem; font-weight: 800; padding: 3px 9px; border-radius: 999px; }
.badge-etat.a { background: #e8f6ee; color: #0e6b3f; }
.badge-etat.c { background: #fdeaec; color: #a01f2a; }
.tel-absent { color: var(--texte-doux); font-size: .9rem; font-style: italic; }
.tel-absent small { display: block; font-style: normal; font-size: .78rem; color: #b0863a; }
.source-live { background: #e8f0fb; border: 1px solid #c6dbf5; color: var(--bleu-fonce); padding: 10px 14px; border-radius: 10px; font-size: .88rem; margin-bottom: 16px; }
.source-live.invite { background: #fff7e9; border-color: #f3ddb0; color: #7a5713; }

/* ---------- Bandeau démo ---------- */
.banner-demo {
  background: #fff7e9; border: 1px solid #f3ddb0; color: #7a5713;
  padding: 12px 16px; border-radius: 10px; font-size: .9rem; margin: 26px 0 20px;
}

/* ---------- Résultats ---------- */
main { padding-bottom: 60px; }
.results-head { display: flex; align-items: baseline; gap: 12px; margin: 8px 0 18px; }
.results-head h2 { margin: 0; font-size: 1.4rem; }
.count { color: var(--texte-doux); font-weight: 600; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 18px; }

.card {
  background: #fff; border: 1px solid var(--gris-bord); border-radius: var(--radius);
  padding: 18px; box-shadow: var(--ombre); display: flex; flex-direction: column;
}
.card-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.card h3 { margin: 0 0 2px; font-size: 1.12rem; }
.tag { font-size: .74rem; font-weight: 700; padding: 3px 9px; border-radius: 999px; background: #eef4fc; color: var(--bleu-fonce); white-space: nowrap; }
.card .ville { color: var(--texte-doux); font-size: .9rem; font-weight: 600; }
.card .desc { font-size: .92rem; color: #435162; margin: 10px 0 12px; flex: 1; }
.card .note { font-size: .88rem; color: #6b4e00; margin-bottom: 12px; }
.card .tel { font-weight: 800; color: var(--bleu-fonce); font-size: 1.05rem; letter-spacing: .02em; }
.card-actions { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }

/* Zone statut du contrôle */
.statut { margin-top: 12px; font-size: .88rem; border-radius: 8px; padding: 10px 12px; display: none; }
.statut.show { display: block; }
.statut.loading { background: #f1f5fb; color: var(--texte-doux); }
.statut.active { background: #e8f6ee; color: #0e6b3f; border: 1px solid #b9e6cd; }
.statut.cessee { background: #fdeaec; color: #a01f2a; border: 1px solid #f3c4c9; }
.statut.introuvable { background: #fff4e5; color: #8a5312; border: 1px solid #f2d3a3; }
.statut.erreur { background: #f4f4f4; color: #555; border: 1px solid #ddd; }
.statut strong { font-weight: 800; }
.statut .detail { display: block; margin-top: 4px; font-size: .82rem; opacity: .9; }

.empty { text-align: center; color: var(--texte-doux); padding: 40px; font-size: 1.05rem; }

/* ---------- Section alt / SIREN libre ---------- */
.section-alt { background: #fff; border-top: 1px solid var(--gris-bord); padding: 48px 0; }
.section-alt h2 { margin-top: 0; }
.muted { color: var(--texte-doux); }
.small { font-size: .82rem; }
.inline-form { display: flex; gap: 10px; margin: 16px 0; }
.inline-form input { flex: 1; padding: 12px 14px; border: 1px solid var(--gris-bord); border-radius: 10px; font-size: 1rem; }
.controle-libre-result .statut { display: block; }

/* ---------- Footer ---------- */
.site-footer { background: var(--bleu-fonce); color: #cdd9e8; padding: 30px 0; text-align: center; }
.site-footer a { color: #9fc3ef; }
.site-footer .muted { color: #b7c4d8; } /* gris plus clair pour contraste AA sur fond bleu foncé */
.site-footer p { margin: 6px 0; }

/* ---------- Modale ---------- */
.modale { position: fixed; inset: 0; background: rgba(16,32,56,.55); display: flex; align-items: center; justify-content: center; z-index: 100; padding: 20px; }
.modale[hidden] { display: none; }
.modale-contenu { background: #fff; border-radius: 16px; max-width: 520px; width: 100%; padding: 28px; position: relative; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.modale-close { position: absolute; top: 14px; right: 18px; border: none; background: none; font-size: 1.8rem; line-height: 1; cursor: pointer; color: var(--texte-doux); }
.modale-close:hover { color: var(--texte); }
.modale h3 { margin-top: 0; }
.fiche-ligne { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--gris-bord); font-size: .95rem; }
.fiche-ligne span:first-child { color: var(--texte-doux); }
.fiche-ligne span:last-child { font-weight: 600; text-align: right; }

/* Carte Google Maps embarquée (gratuite) */
.fiche-map {
  margin: 16px 0; border-radius: 12px; overflow: hidden;
  border: 1px solid var(--gris-bord); height: 220px;
}
.fiche-map iframe { width: 100%; height: 100%; border: 0; display: block; }
.fiche-map-placeholder {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 4px; text-align: center; margin: 16px 0; padding: 26px 16px; border-radius: 12px;
  border: 1px dashed var(--gris-bord); background: #f7fafd; color: var(--bleu-fonce);
  text-decoration: none; font-size: 1rem;
}
.fiche-map-placeholder:hover { background: #eef4fc; border-color: var(--bleu); }
.fiche-map-placeholder small { color: var(--texte-doux); font-size: .78rem; }
.btn-avis { text-decoration: none; display: inline-block; }
.btn-avis-card { background: var(--orange); color: #fff; padding: 9px 14px; border-radius: 8px; font-weight: 700; font-size: .9rem; text-decoration: none; white-space: nowrap; }
.btn-avis-card:hover { background: #8a4108; }

.charger-plus { text-align: center; margin: 28px 0 10px; }
.btn-plus { background: #fff; border: 1px solid var(--bleu); color: var(--bleu-fonce); padding: 12px 28px; border-radius: 10px; font-weight: 700; font-size: .95rem; cursor: pointer; }
.btn-plus:hover { background: #eef4fc; }
.btn-plus[hidden] { display: none; }
.btn-plus:disabled { opacity: .6; cursor: default; }

/* Encart anti-arnaque (accueil) */
.encart-arnaque { display: flex; align-items: center; gap: 16px; max-width: 1100px; margin: 22px auto; padding: 15px 20px;
  background: linear-gradient(135deg, #fff4e6, #fdeaec); border: 1px solid #f3c9b0; border-left: 5px solid var(--orange);
  border-radius: 14px; text-decoration: none; color: var(--bleu-fonce); transition: box-shadow .15s, transform .15s; }
.encart-arnaque:hover { box-shadow: 0 8px 24px rgba(20, 40, 80, .12); transform: translateY(-1px); }
.encart-arnaque .ea-ico { font-size: 2rem; line-height: 1; }
.encart-arnaque .ea-txt { flex: 1; line-height: 1.5; font-size: .95rem; color: #4a3b30; }
.encart-arnaque .ea-txt strong { display: block; font-size: 1.08rem; margin-bottom: 2px; color: var(--bleu-fonce); }
.encart-arnaque .ea-cta { white-space: nowrap; font-weight: 700; color: var(--orange); }
@media (max-width: 640px) { .encart-arnaque { flex-direction: column; text-align: center; } }

/* Ancres : defilement doux + compensation du header sticky (65px) */
html { scroll-behavior: smooth; }
#haut { scroll-margin-top: 120px; }
#form-recherche, #controle-libre { scroll-margin-top: 80px; }

/* Formulaire de contact */
.contact-form { text-align: left; margin-top: 18px; }
.contact-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.contact-form label { display: flex; flex-direction: column; gap: 5px; font-size: .78rem; font-weight: 700; color: var(--texte-doux); text-transform: uppercase; letter-spacing: .03em; }
.contact-form input, .contact-form select, .contact-form textarea { padding: 11px 13px; border: 1px solid var(--gris-bord); border-radius: 10px; font-size: 1rem; font-weight: 400; font-family: inherit; text-transform: none; letter-spacing: normal; background: #fff; color: var(--texte); }
.contact-form input:focus, .contact-form select:focus, .contact-form textarea:focus { outline: none; border-color: var(--bleu); box-shadow: 0 0 0 3px rgba(20,102,200,.15); }
.contact-message { margin-top: 14px; }
.contact-message textarea { resize: vertical; }
#c-submit { margin-top: 16px; }
.contact-result { margin-top: 16px; border-radius: 10px; padding: 12px 14px; font-size: .92rem; display: none; }
.contact-result.show { display: block; }
.contact-result.ok { background: #e8f6ee; color: #0e6b3f; border: 1px solid #b9e6cd; }
.contact-result.ko { background: #fdeaec; color: #a01f2a; border: 1px solid #f3c4c9; }
.contact-result.info { background: #eef4fc; color: var(--bleu-fonce); border: 1px solid #cfe0f5; }
@media (max-width: 560px) { .contact-grid { grid-template-columns: 1fr; } }
.fiche-note-avis { font-size: .78rem; color: var(--texte-doux); margin: 10px 0 0; line-height: 1.4; }

/* ---------- Responsive ---------- */
@media (max-width: 640px) {
  .search-box { flex-direction: column; align-items: stretch; }
  .inline-form { flex-direction: column; align-items: stretch; }
  .hero h1 { font-size: 1.7rem; }
  .main-nav { display: none; }
}
