:root {
  --bg: #f4f6f8;
  --card: #ffffff;
  --ink: #17212b;
  --muted: #5d6b78;
  --line: #e2e7ec;
  --brand: #0f3b5f;
  --accent: #12a150;
  --e85: #8a5cf6;
  --warn: #d9480f;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(15, 30, 45, .06), 0 4px 16px rgba(15, 30, 45, .06);
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--ink); background: var(--bg);
}
a { color: var(--brand); }
h1 { font-size: 1.6rem; margin: 0 0 .25rem; letter-spacing: -.01em; }
h2 { font-size: 1.15rem; margin: 0 0 .75rem; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }

/* --- barre haute --- */
.topbar {
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: .5rem;
  padding: .7rem 1.25rem; background: var(--brand); color: #fff;
}
.brand { color: #fff; text-decoration: none; font-weight: 700; font-size: 1.15rem; display: flex; gap: .45rem; align-items: center; }
.topbar nav { display: flex; gap: .25rem; flex-wrap: wrap; }
.topbar nav a { color: #d6e4f0; text-decoration: none; padding: .4rem .75rem; border-radius: 8px; font-weight: 500; }
.topbar nav a:hover { background: rgba(255,255,255,.1); color: #fff; }
.topbar nav a.on { background: #fff; color: var(--brand); }

/* --- mise en page --- */
.wrap { max-width: 1400px; margin: 0 auto; padding: 1.25rem; }
.head { display: flex; justify-content: space-between; align-items: end; flex-wrap: wrap; gap: 1rem; margin-bottom: 1rem; }
.crumbs { font-size: .9rem; margin-bottom: .35rem; }
.crumbs a { text-decoration: none; }
.grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); gap: 1.25rem; align-items: start; }
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1rem; }
.card.flush { padding: 0; overflow: hidden; }
.sticky { position: sticky; top: 1rem; }
#map { height: calc(100vh - 170px); min-height: 420px; border-radius: var(--radius); }

/* --- sélecteur de carburant --- */
.chips { display: flex; flex-wrap: wrap; gap: .4rem; }
.chip {
  display: inline-block; padding: .35rem .8rem; border-radius: 999px; border: 1px solid var(--line);
  background: #fff; color: var(--ink); text-decoration: none; font-size: .88rem; font-weight: 500; cursor: pointer;
}
.chip:hover { border-color: var(--brand); }
.chip.on { background: var(--brand); color: #fff; border-color: var(--brand); }
.chip.e85.on { background: var(--e85); border-color: var(--e85); }

/* --- tableaux --- */
table.list { width: 100%; border-collapse: collapse; }
table.list th, table.list td { padding: .55rem .6rem; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
table.list th { font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; }
table.list td.num, table.list th.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
table.list tr.clic { cursor: pointer; }
table.list tr.clic:hover td { background: #f7fafc; }
table.list tr.sel td { background: #eef6ff; }
.rank { display: inline-grid; place-items: center; width: 1.6rem; height: 1.6rem; border-radius: 50%; background: var(--line); font-size: .8rem; font-weight: 700; }
.rank.r1 { background: #ffd43b; } .rank.r2 { background: #dee2e6; } .rank.r3 { background: #f0b98d; }

.price { font-weight: 700; font-variant-numeric: tabular-nums; }
.badge { display: inline-block; font-size: .72rem; padding: .1rem .45rem; border-radius: 6px; background: #eef2f6; color: var(--muted); font-weight: 600; margin-left: .25rem; }
.badge.perso { background: #e7f8ef; color: #0b7a3b; }
.badge.e85 { background: #f1ebff; color: #5b34c9; }
.badge.h24 { background: #e8f1fb; color: #1c5d99; }

/* --- page proximité --- */
.controls { display: grid; gap: .9rem; }
.controls label { font-weight: 600; font-size: .9rem; display: block; margin-bottom: .3rem; }
.row { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
input[type=text], input[type=search], input[type=number], input[type=email], input[type=url], input[type=password], select, textarea {
  font: inherit; padding: .5rem .65rem; border: 1px solid #cfd8e0; border-radius: 8px; background: #fff; width: 100%;
}
input:focus, select:focus, textarea:focus { outline: 2px solid #9cc3e6; border-color: #6ea5d6; }
input[type=range] { width: 100%; accent-color: var(--brand); }
.btn {
  font: inherit; font-weight: 600; padding: .5rem .9rem; border: 0; border-radius: 8px; cursor: pointer;
  background: var(--brand); color: #fff; text-decoration: none; display: inline-flex; align-items: center; gap: .35rem; white-space: nowrap;
}
.btn:hover { filter: brightness(1.1); }
.btn.ghost { background: #fff; color: var(--brand); border: 1px solid var(--line); }
.btn.green { background: var(--accent); }
.btn.danger { background: var(--warn); }
.btn.sm { padding: .3rem .6rem; font-size: .85rem; }
.rayon-val { font-weight: 700; font-size: 1.1rem; color: var(--brand); }
.status { padding: .6rem .8rem; border-radius: 8px; background: #eef4fa; font-size: .9rem; }
.status.err { background: #fff0eb; color: #a3330a; }
.suggest { position: relative; }
.suggest ul { position: absolute; z-index: 1000; left: 0; right: 0; top: 100%; margin: 2px 0 0; padding: 0; list-style: none; background: #fff; border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow); }
.suggest li { padding: .5rem .7rem; cursor: pointer; }
.suggest li:hover { background: #f2f6fa; }

.kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: .6rem; }
.kpi { background: #f6f9fb; border-radius: 10px; padding: .6rem .75rem; }
.kpi b { display: block; font-size: 1.2rem; font-variant-numeric: tabular-nums; }
.kpi span { font-size: .78rem; color: var(--muted); }

.partner { border: 1px solid var(--line); border-left: 4px solid var(--e85); border-radius: 10px; padding: .7rem .85rem; margin-bottom: .6rem; }
.partner h3 { margin: 0 0 .2rem; font-size: 1rem; }

/* --- marqueurs prix --- */
.pin {
  background: var(--c, #12a150); color: #fff; font-weight: 700; font-size: 12px; padding: 3px 6px; border-radius: 6px;
  white-space: nowrap; box-shadow: 0 1px 4px rgba(0,0,0,.35); position: relative; transform: translate(-50%, -100%);
  display: inline-block; font-variant-numeric: tabular-nums;
}
.pin::after { content: ""; position: absolute; left: 50%; bottom: -5px; margin-left: -5px; border: 5px solid transparent; border-bottom: 0; border-top-color: var(--c, #12a150); }
.pin.perso { outline: 2px solid #fff; }
.pin.sel { transform: translate(-50%, -100%) scale(1.25); z-index: 1000; }
.pin-partner { background: var(--e85); color: #fff; width: 28px; height: 28px; border-radius: 50% 50% 50% 0; transform: rotate(-45deg) translate(0, -50%); display: grid; place-items: center; box-shadow: 0 1px 4px rgba(0,0,0,.35); border: 2px solid #fff; }
.pin-partner span { transform: rotate(45deg); font-size: 13px; }
.me-dot { width: 16px; height: 16px; border-radius: 50%; background: #1971c2; border: 3px solid #fff; box-shadow: 0 0 0 4px rgba(25,113,194,.3); }
.leaflet-div-icon.clean { background: none; border: 0; }
.popup h4 { margin: 0 0 .2rem; font-size: .95rem; }
.popup table { border-collapse: collapse; margin: .35rem 0; }
.popup td { padding: 1px 8px 1px 0; font-size: .82rem; }
.popup td.on { font-weight: 700; }

.foot { text-align: center; color: var(--muted); font-size: .82rem; padding: 1.5rem 1rem 2rem; }
.foot-links { display: flex; flex-wrap: wrap; justify-content: center; gap: .3rem 1rem; max-width: 1000px; margin: 0 auto 1rem; }
.foot-links a { color: var(--muted); text-decoration: none; }
.foot-links a:hover { color: var(--brand); text-decoration: underline; }

/* --- pages SEO --- */
.crumbs span { color: var(--muted); }
.stat-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(165px, 1fr)); gap: .75rem; margin-bottom: 1.25rem; }
.stat-card {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: .8rem .9rem;
  text-decoration: none; color: var(--ink); display: grid; gap: .1rem; border-top: 3px solid var(--accent);
}
.stat-card:hover { box-shadow: 0 2px 4px rgba(15,30,45,.08), 0 8px 24px rgba(15,30,45,.1); }
.stat-card.e85 { border-top-color: var(--e85); }
.stat-card .lbl { font-size: .8rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.stat-card b { font-size: 1.35rem; font-variant-numeric: tabular-nums; }
.seo-text p { margin: 0 0 .7rem; }
.seo-text p:last-child { margin-bottom: 0; }
.table-wrap { overflow-x: auto; }
td.best { color: #0b7a3b; font-weight: 700; background: #effaf3; }
.links-cols { columns: 3 180px; column-gap: 1.25rem; }
.links-cols a { display: block; padding: .2rem 0; break-inside: avoid; text-decoration: none; }
.links-cols a:hover { text-decoration: underline; }
.faq details { border-top: 1px solid var(--line); padding: .6rem 0; }
.faq details:first-of-type { border-top: 0; }
.faq summary { cursor: pointer; font-weight: 600; }
.faq details p { margin: .5rem 0 0; color: var(--muted); }
.empty { padding: 2rem 1rem; text-align: center; color: var(--muted); }

@media (max-width: 960px) {
  .grid { grid-template-columns: 1fr; }
  .sticky { position: static; }
  #map { height: 55vh; }
  .grid > .map-col { order: -1; }
}

/* --- admin --- */
.admin-nav { display: flex; gap: .5rem; flex-wrap: wrap; margin-bottom: 1rem; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: .8rem; }
.form-grid .full { grid-column: 1 / -1; }
.form-grid label { font-weight: 600; font-size: .85rem; display: block; margin-bottom: .2rem; }
.flash { padding: .7rem .9rem; border-radius: 8px; margin-bottom: 1rem; background: #e7f8ef; color: #0b5f2f; }
.flash.err { background: #fff0eb; color: #a3330a; }
#mini-map { height: 320px; border-radius: 10px; }
.login-box { max-width: 380px; margin: 4rem auto; }
