:root {
  --bg: #fafaf8; --surface: #ffffff; --ink: #15171c; --ink-2: #3a3f4a; --muted: #6b7079;
  --line: #e8e7e3; --line-2: #f1f0ec; --accent: #3f3bc9; --accent-bg: #eeeefc;
  --ok: #0d6b3f; --ok-bg: #e4f4ea; --warn: #8a4b00; --warn-bg: #fdf1dc; --bad: #a3261b; --bad-bg: #fbe9e6;
  --r1: #d7f0e1; --r2: #fbefcf; --r3: #f7e3d9;
  --radius: 12px; --shadow: 0 1px 2px rgba(20, 20, 30, .04), 0 2px 8px rgba(20, 20, 30, .04);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111215; --surface: #191a1f; --ink: #eceef2; --ink-2: #c6c9d1; --muted: #8d929c;
    --line: #2a2c33; --line-2: #212228; --accent: #9d9aff; --accent-bg: #23234a;
    --ok: #6fd49b; --ok-bg: #16301f; --warn: #f2bd6b; --warn-bg: #33270f; --bad: #ff8f84; --bad-bg: #3a1714;
    --r1: #1b3a28; --r2: #3a3113; --r3: #3b2419; --shadow: none;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.6 "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-feature-settings: "cv11"; -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.wrap { max-width: 1040px; margin: 0 auto; padding: 0 20px; }
.top { border-bottom: 1px solid var(--line); background: var(--surface); }
.top .wrap { display: flex; align-items: center; justify-content: space-between; height: 56px; }
.marque { font-weight: 700; letter-spacing: -.01em; color: var(--ink); }
.marque span { color: var(--muted); font-weight: 500; }
main { padding: 40px 0 80px; }

h1 { font-size: 32px; line-height: 1.2; letter-spacing: -.02em; margin: 0 0 8px; font-weight: 700; }
h2 { font-size: 22px; line-height: 1.3; letter-spacing: -.01em; margin: 0 0 6px; font-weight: 650; }
h3 { font-size: 17px; margin: 28px 0 10px; font-weight: 650; }
.sous { color: var(--muted); margin: 0 0 24px; max-width: 70ch; }
.etiquette { font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }

section.bloc { margin-top: 56px; }
.carte { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 24px; }

/* en-tête du rapport */
.entete { display: flex; justify-content: space-between; gap: 24px; flex-wrap: wrap; align-items: flex-end; }
.meta { color: var(--muted); font-size: 15px; }
.meta b { color: var(--ink-2); font-weight: 600; }
.chiffres { display: flex; gap: 32px; margin-top: 24px; flex-wrap: wrap; }
.chiffre .n { font-size: 28px; font-weight: 700; letter-spacing: -.02em; line-height: 1.1; }
.chiffre .l { color: var(--muted); font-size: 14px; }

/* l'essentiel */
.constats { display: grid; gap: 12px; margin-top: 20px; }
.constat { background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--muted); border-radius: var(--radius); padding: 18px 22px; }
.constat.mauvais { border-left-color: var(--bad); }
.constat.moyen { border-left-color: #d99a2b; }
.constat.bon { border-left-color: var(--ok); }
.constat .t { font-weight: 650; font-size: 17px; line-height: 1.4; }
.constat .d { color: var(--ink-2); margin-top: 4px; }
.constat .a { color: var(--accent); margin-top: 8px; font-weight: 550; }
.constat .a::before { content: "→ "; }

/* tableaux */
.tableau { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); margin-top: 16px; }
table { width: 100%; border-collapse: collapse; font-size: 15px; }
th, td { padding: 11px 14px; text-align: left; border-bottom: 1px solid var(--line-2); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
th { font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); background: var(--surface); white-space: nowrap; }
th .vol { display: block; text-transform: none; letter-spacing: 0; font-weight: 500; color: var(--muted); font-size: 12px; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td.ville { white-space: nowrap; font-weight: 500; }
.cellules th:first-child { text-align: left; }
.cellules th { white-space: normal; text-align: center; min-width: 88px; line-height: 1.3; }
.comparaison th { text-transform: none; letter-spacing: 0; font-size: 14px; color: var(--ink); white-space: normal; min-width: 120px; }
.comparaison td:first-child { white-space: nowrap; color: var(--muted); }
.comparaison th.moi, .comparaison td.moi { background: var(--accent-bg); }
.chemin { font-size: 14px; color: var(--ink-2); overflow-wrap: anywhere; }
.faibles { color: var(--muted); font-size: 14px; margin-top: 10px; }
textarea.villes { font-size: 14px; }
tr.moi td { background: var(--accent-bg); font-weight: 600; }
.cellules td.c { text-align: center; font-weight: 600; font-variant-numeric: tabular-nums; }
.c.r1 { background: var(--r1); } .c.r2 { background: var(--r2); } .c.r3 { background: var(--r3); }
.c.abs, .c.err { color: var(--muted); font-weight: 400; }
.legende { display: flex; gap: 16px; flex-wrap: wrap; font-size: 13px; color: var(--muted); margin-top: 10px; }
.legende i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; vertical-align: -1px; margin-right: 6px; }

/* verdicts */
.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 13px; font-weight: 600; white-space: nowrap; }
.badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.bad { background: var(--bad-bg); color: var(--bad); }
.badge.neutre { background: var(--line-2); color: var(--ink-2); }
.verdict { color: var(--ink-2); font-size: 14px; margin-top: 4px; }
.liste { margin: 12px 0 0; padding-left: 20px; } .liste li { margin: 4px 0; }
.note { color: var(--muted); font-size: 14px; margin-top: 12px; }
.methode { color: var(--muted); font-size: 14px; border-top: 1px solid var(--line); margin-top: 64px; padding-top: 24px; }
.methode p { margin: 6px 0; }

/* formulaire */
label { display: block; font-weight: 600; font-size: 14px; margin: 18px 0 6px; }
.aide { color: var(--muted); font-size: 14px; font-weight: 400; }
input[type=text], input[type=password], textarea {
  width: 100%; font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--line);
  border-radius: 10px; padding: 11px 13px; outline: none; transition: border-color .15s, box-shadow .15s;
}
input:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-bg); }
.ligne { display: grid; grid-template-columns: 2fr 1fr auto; gap: 12px; align-items: end; }
button, .bouton {
  font: inherit; font-weight: 600; border: 0; border-radius: 10px; padding: 11px 18px; cursor: pointer;
  background: var(--accent); color: #fff; white-space: nowrap;
}
button.second { background: var(--surface); color: var(--ink); border: 1px solid var(--line); }
button:disabled { opacity: .5; cursor: default; }
.choix { display: grid; gap: 10px; margin-top: 16px; }
.choix label { margin: 0; font-weight: 400; display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px;
  border: 1px solid var(--line); border-radius: 10px; background: var(--surface); cursor: pointer; }
.choix label:has(input:checked) { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-bg); }
.choix b { display: block; } .choix small { color: var(--muted); }
.case { display: flex; gap: 10px; align-items: center; font-weight: 400; }
.devis { color: var(--ink-2); font-size: 14px; margin: 16px 0; }
.barre { height: 8px; background: var(--line-2); border-radius: 99px; overflow: hidden; margin: 16px 0 8px; }
.barre div { height: 100%; width: 0; background: var(--accent); transition: width .4s; }
.erreur { color: var(--bad); margin-top: 12px; }
.cache { display: none; }
.recents td a { font-weight: 600; }

@media (max-width: 640px) {
  h1 { font-size: 26px; } main { padding-top: 28px; } .carte { padding: 18px; }
  .ligne { grid-template-columns: 1fr; } .chiffres { gap: 20px; }
  th, td { padding: 9px 10px; }
}
@media print {
  .top, .partage, .pas-imprimer { display: none !important; }
  body { background: #fff; } .carte, .constat, .tableau { box-shadow: none; }
  section.bloc { break-inside: avoid-page; }
}
