:root {
  --bg: #f3f5f7;
  --card: #fff;
  --ink: #18212b;
  --muted: #5f6c78;
  --line: #e1e6eb;
  --brand: #123a5a;
  --brand-2: #1d5f8f;
  --green: #128a47;
  --green-bg: #e8f7ee;
  --e85: #7a4fe0;
  --e85-bg: #f1ebff;
  --orange: #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.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: var(--ink); background: var(--bg); }
a { color: var(--brand-2); }
h1 { font-size: 1.65rem; line-height: 1.25; margin: .25rem 0 .5rem; letter-spacing: -.01em; }
h2 { font-size: 1.15rem; margin: 0 0 .75rem; }
h3 { font-size: .95rem; margin: 1rem 0 .4rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.lead { margin: 0 0 1rem; }

/* --- barre haute --- */
.topbar { display: flex; align-items: center; gap: .75rem 1.25rem; flex-wrap: wrap; 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: .4rem; align-items: center; }
.topsearch { flex: 1; min-width: 200px; max-width: 460px; }
.topsearch input { width: 100%; border: 0; border-radius: 8px; padding: .5rem .75rem; font: inherit; }
.topbar nav { display: flex; gap: .2rem; flex-wrap: wrap; margin-left: auto; }
.topbar nav a { color: #d4e2ee; text-decoration: none; padding: .4rem .7rem; border-radius: 8px; font-weight: 500; }
.topbar nav a:hover { background: rgba(255,255,255,.12); color: #fff; }

/* --- structure --- */
.wrap { max-width: 1200px; margin: 0 auto; padding: 1.25rem; }
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1rem 1.1rem; margin-bottom: 1.25rem; }
.card.flush { padding: 0; overflow: hidden; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: .75rem; flex-wrap: wrap; padding: 1rem 1.1rem .5rem; }
.card-head h2 { margin: 0; }
.card-head input { max-width: 220px; }
.grid2 { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 0 1.25rem; align-items: start; }
.cards3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 0 1.25rem; }
.prose p { margin: 0 0 .7rem; } .prose p:last-child { margin: 0; }
.crumbs { font-size: .88rem; color: var(--muted); margin-bottom: .25rem; }
.crumbs a { text-decoration: none; }
.crumbs .sep { margin: 0 .15rem; }
.row { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.hero h1 { margin-top: 0; }
.tile { text-decoration: none; color: var(--ink); display: grid; gap: .2rem; }
.tile b { font-size: 1.05rem; } .tile span { color: var(--muted); font-size: .9rem; }
.tile:hover { box-shadow: 0 2px 4px rgba(15,30,45,.08), 0 8px 24px rgba(15,30,45,.12); }

/* --- formulaires --- */
input[type=search], input[type=text], input[type=number], input[type=password], input[type=url], select, textarea {
  font: inherit; padding: .5rem .65rem; border: 1px solid #cdd6df; border-radius: 8px; background: #fff; width: 100%;
}
input:focus, select:focus, textarea:focus { outline: 2px solid #9cc3e6; border-color: #6ea5d6; }
.btn { font: inherit; font-weight: 600; padding: .5rem .95rem; border: 0; border-radius: 8px; cursor: pointer; background: var(--brand); color: #fff;
  text-decoration: none; display: inline-flex; gap: .35rem; align-items: center; white-space: nowrap; }
.btn:hover { filter: brightness(1.12); }
.btn.green { background: var(--green); }
.btn.ghost { background: #fff; color: var(--brand); border: 1px solid var(--line); }
.btn.danger { background: var(--orange); }
.btn.sm { padding: .3rem .6rem; font-size: .85rem; }

/* --- chiffres clés --- */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: .75rem; margin-bottom: 1.25rem; }
.kpi { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: .75rem .9rem; }
.kpi b { display: block; font-size: 1.35rem; font-variant-numeric: tabular-nums; }
.kpi.big b { font-size: 1.8rem; color: var(--brand); }
.kpi span { font-size: .8rem; color: var(--muted); }

/* --- listes --- */
.table-wrap { overflow-x: auto; }
table.list { width: 100%; border-collapse: collapse; }
table.list th, table.list td { padding: .55rem .75rem; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
table.list thead th { font-size: .76rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; white-space: nowrap; }
table.list .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
table.list tbody tr:hover td { background: #f8fafc; }
table.list tr.sel td { background: #eef6ff; }
table.list a { text-decoration: none; }
table.list a:hover { text-decoration: underline; }
table.specs th { width: 42%; color: var(--muted); font-weight: 500; }
.conso { font-weight: 700; }
.eco { color: var(--green); font-weight: 700; }
.rank { display: inline-grid; place-items: center; min-width: 1.7rem; height: 1.7rem; padding: 0 .3rem; border-radius: 999px; background: var(--line); font-size: .8rem; font-weight: 700; }
.rank.r1 { background: #ffd43b; } .rank.r2 { background: #dee2e6; } .rank.r3 { background: #f0b98d; }
.badge { display: inline-block; font-size: .7rem; font-weight: 700; padding: .05rem .4rem; border-radius: 5px; margin-left: .3rem; vertical-align: 1px; }
.badge.stage1 { background: #e3f0fb; color: #1c5d99; }
.badge.e85 { background: var(--e85-bg); color: #5b34c9; }
.empty { padding: 2rem 1rem; text-align: center; color: var(--muted); }

.marques { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: .5rem; }
.marques a { display: grid; padding: .55rem .7rem; border: 1px solid var(--line); border-radius: 10px; text-decoration: none; color: var(--ink); }
.marques a:hover { border-color: var(--brand-2); background: #f7fbff; }

.chips { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; }
.chip { display: inline-block; padding: .3rem .75rem; border-radius: 999px; border: 1px solid var(--line); background: #fff; color: var(--ink); text-decoration: none; font-size: .87rem; font-weight: 500; }
.chip:hover { border-color: var(--brand-2); }
.chip.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.sep-v { width: 1px; height: 1.4rem; background: var(--line); margin: 0 .3rem; }

.pager { display: flex; flex-wrap: wrap; gap: .3rem; padding: 1rem; justify-content: center; }
.pager a, .pager span { padding: .35rem .7rem; border-radius: 8px; border: 1px solid var(--line); text-decoration: none; font-size: .9rem; }
.pager .on { background: var(--brand); color: #fff; border-color: var(--brand); }

/* --- offres + meters --- */
.offre { border-top: 4px solid var(--brand-2); }
.offre.e85 { border-top-color: var(--e85); }
.offre.stage1 { border-top-color: var(--green); }
.dyno { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; margin: .5rem 0 .75rem; }
.dyno div { background: #f5f8fb; border-radius: 10px; padding: .55rem .7rem; display: grid; }
.dyno span { font-size: .78rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.dyno b { font-variant-numeric: tabular-nums; }
.dyno em { font-style: normal; color: var(--green); font-weight: 700; font-size: .9rem; }

.meter-row { display: grid; grid-template-columns: 8.5rem minmax(0, 1fr) 8.5rem; gap: .6rem; align-items: center; margin: .35rem 0; }
.meter-row .ml { font-size: .88rem; color: var(--muted); }
.meter-row .mv { text-align: right; font-variant-numeric: tabular-nums; font-size: .92rem; }
.meter-row.after .mv, .meter-row.gain .mv { color: var(--green); }
meter { width: 100%; height: 1.1rem; -webkit-appearance: none; appearance: none; border: 0; border-radius: 6px; background: #e9edf1; overflow: hidden; }
meter::-webkit-meter-bar { background: #e9edf1; border: 0; border-radius: 6px; height: 1.1rem; }
meter::-webkit-meter-optimum-value { background: #2fb36a; border-radius: 6px; }
meter::-webkit-meter-suboptimum-value { background: #f2a93b; border-radius: 6px; }
meter::-webkit-meter-even-less-good-value { background: #e8590c; border-radius: 6px; }
meter:-moz-meter-optimum::-moz-meter-bar { background: #2fb36a; }
meter:-moz-meter-sub-optimum::-moz-meter-bar { background: #f2a93b; }
meter:-moz-meter-sub-sub-optimum::-moz-meter-bar { background: #e8590c; }
.meter-row.after meter::-webkit-meter-optimum-value,
.meter-row.after meter::-webkit-meter-suboptimum-value,
.meter-row.after meter::-webkit-meter-even-less-good-value { background: #2fb36a; }
.meter-row.after meter::-moz-meter-bar { background: #2fb36a; }
table.budget tr.meters td { padding-top: 0; background: none !important; }
table.budget tr.meters .meter-row { grid-template-columns: 4rem minmax(0, 1fr) 6.5rem; }

.simu { background: #f5f8fb; border-radius: 10px; padding: .8rem .9rem; margin-top: 1rem; }
.simu label { font-weight: 600; font-size: .9rem; }
.simu input[type=range] { flex: 1; accent-color: var(--green); }
.simu output { font-weight: 700; min-width: 6rem; text-align: right; }
.simu p { margin: .5rem 0 0; }

.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 p { margin: .45rem 0 0; color: var(--muted); }

.foot { text-align: center; color: var(--muted); font-size: .82rem; padding: 1rem 1rem 2rem; max-width: 900px; margin: 0 auto; }

@media (max-width: 860px) {
  .grid2 { grid-template-columns: 1fr; }
  .topbar nav { margin-left: 0; }
  .meter-row { grid-template-columns: 6rem minmax(0, 1fr) 7rem; }
  h1 { font-size: 1.35rem; }
}

/* --- admin --- */
.admin-nav { display: flex; gap: .5rem; flex-wrap: wrap; margin-bottom: 1rem; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: .9rem; }
.form-grid .full { grid-column: 1 / -1; }
.form-grid label { font-weight: 600; font-size: .85rem; display: block; margin-bottom: .2rem; }
.form-grid .help { font-size: .78rem; color: var(--muted); margin-top: .2rem; }
.flash { padding: .7rem .9rem; border-radius: 8px; margin-bottom: 1rem; background: var(--green-bg); color: #0b5f2f; }
.flash.err { background: #fff0eb; color: #a3330a; }
.login-box { max-width: 380px; margin: 4rem auto; display: grid; gap: .8rem; }
.progress { height: 1.2rem; background: #e9edf1; border-radius: 8px; overflow: hidden; }
.progress div { height: 100%; width: 0; background: var(--green); transition: width .3s; }
.log { font: .82rem/1.5 ui-monospace, monospace; background: #0f1b26; color: #cfe3f3; border-radius: 8px; padding: .7rem .9rem; max-height: 260px; overflow: auto; white-space: pre-wrap; }
