/* Rapport complet : lecture à l'écran et impression A4. */
.page-rapport { background: var(--fond); }
.barre { position: sticky; top: 0; z-index: 1000; display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 8px 16px; background: var(--surface); border-bottom: 1px solid var(--bord); }
.barre a { color: var(--accent); }
.rapport-contenu { max-width: 58rem; margin: 0 auto; padding: 0 16px 48px; }
.attente { padding: 40px 0; color: var(--doux); }
.attente.erreur { color: var(--attention); }
/* Pendant le calcul du rapport (20 s à 1 min) : le même sablier que sur les boutons. */
.attente:not(.erreur)::before { content: "⏳"; display: inline-block; margin-right: .45em; animation: sablier-tourne 1.6s ease-in-out infinite; }
@media (prefers-reduced-motion: reduce) { .attente::before { animation: none; } }

.couverture { padding: 28px 0 18px; border-bottom: 2px solid var(--texte); }
.couverture h1 { font-size: 1.7rem; margin: 0 0 4px; }
.couverture .activite { font-size: 1.15rem; margin: 0 0 12px; }
.couverture ol { margin: 0 0 12px; padding: 0; list-style: none; display: grid; gap: 6px; }
.couverture li { display: flex; gap: 8px; align-items: center; }
.meta { color: var(--doux); font-size: .88rem; margin: 2px 0; }
.avertissement { margin-top: 12px; padding: 10px 12px; border-left: 4px solid var(--accent); background: var(--surface); font-size: .92rem; }

.rapport-contenu h2 { font-size: 1.35rem; margin: 32px 0 10px; padding-bottom: 4px; border-bottom: 1px solid var(--bord); display: flex; gap: 10px; align-items: center; }
.rapport-contenu h3 { font-size: 1.08rem; margin: 22px 0 8px; }
.bloc { break-inside: avoid; }
.texte-ia { font-size: 1rem; line-height: 1.6; margin: 6px 0; }
.origine { color: var(--doux); font-size: .78rem; margin: 2px 0 10px; }

.tete-lieu { display: flex; flex-wrap: wrap; gap: 16px 24px; align-items: center; margin: 12px 0; }
.note-globale { display: grid; place-items: center; min-width: 7.5rem; padding: 10px 14px; border-radius: var(--rayon); border: 2px solid var(--couleur); background: var(--surface); }
.note-globale .valeur { font-size: 2.4rem; font-weight: 750; line-height: 1; font-variant-numeric: tabular-nums; }
.note-globale .sur { color: var(--doux); font-size: .85rem; }
.verdict { font-size: 1.2rem; font-weight: 650; }
.plafond, .fiabilite { color: var(--doux); font-size: .9rem; margin: 4px 0 0; }

.colonnes { display: grid; grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); gap: 12px 24px; }
.points h4 { margin: 8px 0 4px; font-size: .95rem; }
.points ul { margin: 0; padding-left: 1.2rem; }
.points li { margin: 4px 0; }
.points .forts h4::before { content: "✓ "; color: var(--accent); }
.points .vigilance h4::before { content: "! "; color: var(--attention); font-weight: 800; }

table { width: 100%; border-collapse: collapse; font-size: .9rem; margin: 6px 0 10px; }
th, td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--bord); vertical-align: top; }
th { color: var(--doux); font-weight: 600; font-size: .82rem; }
td.nombre, th.nombre { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tableau-defilant { overflow-x: auto; }

/* Barres 0-100 des critères : marque fine, bout arrondi, piste discrète */
.jauge { position: relative; height: 10px; border-radius: 0 4px 4px 0; background: color-mix(in srgb, var(--bord) 55%, transparent); min-width: 6rem; }
.jauge span { position: absolute; inset: 0 auto 0 0; border-radius: 0 4px 4px 0; background: var(--couleur, var(--accent)); }
.critere-note { font-weight: 700; font-variant-numeric: tabular-nums; }

/* Graphiques en barres horizontales (âges, comparatif) */
.graphe { margin: 8px 0 14px; }
.graphe .legende { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: .85rem; color: var(--doux); margin-bottom: 8px; }
.graphe .legende span::before { content: ""; display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; background: var(--c); }
.graphe .groupe { display: grid; grid-template-columns: minmax(7rem, 11rem) 1fr; gap: 2px 10px; align-items: center; margin: 6px 0; }
.graphe .etiquette { font-size: .88rem; }
.graphe .barres { display: grid; gap: 2px; }
.graphe .trait { display: flex; align-items: center; gap: 6px; font-size: .8rem; font-variant-numeric: tabular-nums; color: var(--doux); }
.graphe .trait i { display: block; height: 10px; border-radius: 0 4px 4px 0; background: var(--c); min-width: 2px; }

.carte-rapport { height: 26rem; border-radius: var(--rayon); border: 1px solid var(--bord); margin: 8px 0 4px; z-index: 0; }
.legende-carte { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: .82rem; color: var(--doux); }
.legende-carte span::before { content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; vertical-align: 0; background: var(--c); border: 2px solid var(--b, var(--c)); }

.chiffres { display: grid; grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr)); gap: 10px; margin: 8px 0; }
.chiffres div { padding: 8px 10px; border: 1px solid var(--bord); border-radius: var(--rayon); background: var(--surface); }
.chiffres dt { color: var(--doux); font-size: .8rem; }
.chiffres dd { margin: 0; font-size: 1.15rem; font-weight: 650; font-variant-numeric: tabular-nums; }
.chiffres dd small { display: block; font-size: .78rem; font-weight: normal; color: var(--doux); }
.encadre { padding: 10px 12px; border-radius: var(--rayon); border: 1px solid var(--bord); background: var(--surface); margin: 8px 0; }
.encadre.faible { border-color: var(--attention); }
.meilleur { font-weight: 700; }
.meilleur::after { content: " ★"; color: var(--accent); }

.section-lieu { break-before: page; }

@media print {
  @page { size: A4; margin: 14mm 12mm; }
  :root { --fond: #fff; --surface: #fff; --texte: #111; --doux: #555; --bord: #ccc; --accent: #2f6b4f;
          --lieu-a: #1d4ed8; --lieu-b: #c2410c; --lieu-c: #7e22ce; --lieu-d: #0f766e; --lieu-e: #be185d; }
  body { font-size: 10.5pt; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .barre, .leaflet-control-zoom { display: none !important; }
  .rapport-contenu { max-width: none; padding: 0; }
  .carte-rapport { height: 11cm; }
  h2, h3 { break-after: avoid; }
  table, .graphe, .encadre, .chiffres, .tete-lieu { break-inside: avoid; }
  a { color: inherit; text-decoration: none; }
}

/* ===================== Refonte 2026-09 : graphiques et page de garde ===================== */
.page-rapport {
  --serie-1: #2a78d6; --serie-2: #eb6834; --reference: #b4b2a9;
  --st-bon: #0ca30c; --st-attention: #fab219; --st-critique: #d03b3b;
  --grille: #e1e0d9; --axe: #c3c2b7; --discret: #6f6d67;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .page-rapport {
    --serie-1: #3987e5; --serie-2: #d95926; --reference: #5f5e59; --grille: #2c2c2a; --axe: #383835; --discret: #a9a79f;
  }
}
:root[data-theme="dark"] .page-rapport { --serie-1: #3987e5; --serie-2: #d95926; --reference: #5f5e59; --grille: #2c2c2a; --axe: #383835; --discret: #a9a79f; }

/* Page de garde */
.garde { margin: 0 -16px; padding: 34px 28px 26px; background: var(--accent); color: var(--accent-texte); border-radius: 0 0 14px 14px; }
.garde .surtitre { text-transform: uppercase; letter-spacing: .12em; font-size: .78rem; opacity: .85; margin: 0 0 6px; }
.garde h1 { font-size: 2rem; line-height: 1.15; margin: 0 0 6px; }
.garde .activite { font-size: 1.12rem; margin: 0; opacity: .95; }
.garde .date { font-size: .9rem; opacity: .8; margin: 14px 0 0; }
.cartes-score { display: grid; grid-template-columns: repeat(auto-fit, minmax(16.5rem, 1fr)); gap: 14px; margin: 18px 0 8px; }
.carte-score { background: var(--surface); border: 1px solid var(--bord); border-top: 5px solid var(--couleur); border-radius: 12px; padding: 14px 16px 12px; break-inside: avoid; }
.carte-score h2 { font-size: 1rem !important; margin: 0 0 4px !important; padding: 0 !important; border: 0 !important; display: flex; gap: 8px; align-items: center; }
.carte-score .commune { color: var(--doux); font-size: .84rem; margin: 0 0 6px; }
.carte-score .g-jauge { margin: 4px auto 2px; }
.carte-score .g-tuiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.lecture { font-size: .9rem; color: var(--doux); margin: 10px 0 0; }

/* Sommaire */
.sommaire { display: grid; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); gap: 4px 20px; padding: 0; list-style: none; counter-reset: s; margin: 10px 0; }
.sommaire li { counter-increment: s; font-size: .92rem; }
.sommaire li::before { content: counter(s) ". "; color: var(--doux); }
.sommaire a { color: var(--texte); }

/* Jauge */
.g-jauge { margin: 0; display: grid; justify-items: center; }
.g-jauge svg { overflow: visible; }
.g-jauge-piste { fill: none; stroke: color-mix(in srgb, var(--g-statut) 18%, var(--surface)); stroke-linecap: round; }
.g-jauge-valeur { fill: none; stroke: var(--g-statut); stroke-linecap: round; }
.g-graduation { stroke: var(--axe); stroke-width: 1.5; }
.g-jauge-note { font-size: 46px; font-weight: 750; text-anchor: middle; fill: var(--texte); }
.g-jauge-sur { font-size: 13px; text-anchor: middle; fill: var(--doux); }
.g-verdict { display: inline-flex; gap: 7px; align-items: center; font-weight: 650; font-size: 1.02rem; margin-top: 2px; }
.g-icone { display: inline-grid; place-items: center; width: 1.35rem; height: 1.35rem; border-radius: 50%; background: var(--g-statut); color: #fff; font-size: .8rem; font-weight: 800; }
.statut-bon { --g-statut: var(--st-bon); }
.statut-attention { --g-statut: var(--st-attention); }
.statut-attention .g-icone { color: #3a2a00; }
.statut-critique { --g-statut: var(--st-critique); }

/* Tuiles */
.g-tuiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(9.5rem, 1fr)); gap: 8px; margin: 10px 0 4px; }
.g-tuile { padding: 8px 10px; border-radius: 10px; background: var(--fond); border: 1px solid var(--bord); }
.g-tuile dt { font-size: .76rem; color: var(--doux); }
.g-tuile dd { margin: 1px 0 0; font-size: 1.22rem; font-weight: 700; line-height: 1.2; }
.g-tuile dd small { display: block; font-size: .74rem; font-weight: 400; color: var(--doux); margin-top: 2px; }

/* Légende et notes */
.g-legende { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: .84rem; color: var(--doux); margin: 0 0 8px; }
.g-legende i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.g-note { font-size: .8rem; color: var(--doux); margin-top: 6px; }

/* Barres */
.g-barres { margin: 8px 0 14px; }
.g-barres-corps { display: grid; gap: 10px; }
.g-ligne { display: grid; grid-template-columns: minmax(6rem, var(--libelle)) 1fr; gap: 12px; align-items: center; }
.g-libelle { font-size: .88rem; line-height: 1.25; }
.g-libelle small { display: block; color: var(--doux); font-size: .76rem; }
.g-pistes { position: relative; display: grid; gap: 2px; border-left: 1px solid var(--axe); }
.g-piste { display: flex; align-items: center; gap: 8px; min-height: 14px; }
.g-barre { height: 12px; border-radius: 0 4px 4px 0; background: var(--c); flex: none; max-width: calc(100% - 4.5rem); outline-offset: 2px; }
.g-barre:hover, .g-barre:focus-visible { filter: brightness(1.12); }
.g-valeur { font-size: .8rem; color: var(--texte); font-variant-numeric: tabular-nums; white-space: nowrap; }
.g-repere { position: absolute; top: -3px; bottom: -3px; width: 0; border-left: 2px solid var(--texte); opacity: .55; }
.g-repere-cle { display: inline-block; width: 0; height: 12px; border-left: 2px solid var(--texte); opacity: .55; margin-right: 6px; vertical-align: -1px; }

/* SVG */
.g-svg { width: 100%; height: auto; display: block; overflow: visible; }
.g-grille { stroke: var(--grille); stroke-width: 1; }
.g-axe { stroke: var(--axe); stroke-width: 1; }
.g-texte { font-size: 12px; fill: var(--texte); font-variant-numeric: tabular-nums; }
.g-discret { fill: var(--discret); font-size: 11px; }
.g-fort { font-weight: 700; }
.g-centre { text-anchor: middle; }
.g-droite { text-anchor: end; }
.g-marque:hover, .g-marque:focus-visible { filter: brightness(1.12); outline: none; }
.g-trait { stroke-width: 2; stroke-linecap: round; }
.g-aire { opacity: .1; }
.g-seuil { stroke: var(--discret); stroke-width: 1; }
.g-point { stroke: var(--surface); stroke-width: 2; cursor: default; }
.g-reticule { stroke: var(--axe); stroke-width: 1; }
.g-colonnes, .g-point-mort { margin: 8px 0 14px; }

/* Fourchette */
.g-fourchette { margin: 22px 0 14px; }
.g-fourchette-piste { position: relative; height: 14px; border-radius: 7px; background: color-mix(in srgb, var(--serie-1) 12%, var(--surface)); margin: 0 3rem 26px; }
.g-fourchette-bande { position: absolute; top: 0; bottom: 0; border-radius: 7px; background: var(--serie-1); }
.g-fourchette-bas, .g-fourchette-haut { position: absolute; top: 20px; transform: translateX(-50%); font-size: .86rem; font-weight: 700; white-space: nowrap; }

/* Info-bulle */
.infobulle { position: absolute; z-index: 2000; pointer-events: none; background: var(--surface); color: var(--texte); border: 1px solid var(--bord);
  box-shadow: 0 6px 18px rgb(0 0 0 / .16); border-radius: 8px; padding: 6px 9px; font-size: .82rem; display: grid; gap: 1px; max-width: 18rem; }
.infobulle strong { font-size: .95rem; }
.infobulle span { color: var(--doux); }

/* Encadrés de lecture */
.cle { display: grid; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); gap: 12px; }
.a-verifier { list-style: none; padding: 0; margin: 8px 0; display: grid; gap: 8px; }
.a-verifier li { display: grid; grid-template-columns: 1.4rem 1fr; gap: 8px; padding: 9px 11px; border: 1px solid var(--bord); border-radius: 10px; background: var(--surface); break-inside: avoid; }
.a-verifier li::before { content: ""; width: 1rem; height: 1rem; border: 2px solid var(--doux); border-radius: 4px; margin-top: 2px; }
.a-verifier strong { display: block; }
.a-verifier span { color: var(--doux); font-size: .88rem; }
details.tableau-brut summary { cursor: pointer; color: var(--accent); font-size: .86rem; margin: 2px 0 6px; }

@media print {
  .garde { margin: 0; border-radius: 0; }
  .page-rapport { --grille: #e1e0d9; --axe: #c3c2b7; --discret: #6f6d67; --serie-1: #2a78d6; --serie-2: #eb6834; --reference: #b4b2a9; }
  .carte-score, .g-barres, .g-colonnes, .g-point-mort, .g-fourchette, .a-verifier li { break-inside: avoid; }
  details.tableau-brut { display: none; }
  .infobulle { display: none; }
}
.tete-lieu { display: grid; grid-template-columns: auto 1fr; gap: 12px 24px; align-items: center; margin: 12px 0; }
.tete-lieu .g-tuiles { margin: 0; }
@media (max-width: 640px) { .tete-lieu { grid-template-columns: 1fr; justify-items: stretch; } .tete-lieu .g-jauge { justify-self: center; } }
.explications { display: grid; grid-template-columns: minmax(8rem, 13rem) 1fr; gap: 6px 14px; font-size: .88rem; margin: 6px 0 10px; }
.explications dt { font-weight: 600; }
.explications dd { margin: 0; color: var(--doux); }
@media (max-width: 640px) { .explications { grid-template-columns: 1fr; } .explications dd { margin-bottom: 6px; } }
.g-tuile dd.long { font-size: .98rem; line-height: 1.25; }
/* L'essentiel */
.essentiel { background: var(--surface); border: 1px solid var(--bord); border-radius: 14px; padding: 4px 18px 12px; margin-top: 18px; }
.essentiel h2 { border-bottom: 0 !important; }
.essentiel-choix { display: grid; grid-template-columns: auto 1fr; gap: 10px 22px; align-items: center; }
.surtitre-bloc { text-transform: uppercase; letter-spacing: .08em; font-size: .72rem; color: var(--doux); margin: 0; }
.essentiel-lieu { font-size: 1.15rem; font-weight: 700; margin: 2px 0 6px; display: flex; gap: 8px; align-items: center; }
@media (max-width: 640px) { .essentiel-choix { grid-template-columns: 1fr; justify-items: center; } }
.sensibilite td.actuel { font-weight: 800; background: color-mix(in srgb, var(--serie-1) 12%, transparent); }
.sensibilite th[scope="row"] { font-weight: 600; color: var(--texte); }
@media print { .essentiel { break-inside: avoid; break-after: page; } .couverture { break-after: page; } }
@media print {
  .garde { padding: 16px 18px 14px; }
  .garde h1 { font-size: 1.45rem; }
  .cartes-score { gap: 10px; margin: 10px 0 4px; }
  .carte-score { padding: 8px 10px; }
  .carte-score .g-jauge svg { width: 150px; height: 84px; }
  .carte-score .g-tuile { padding: 5px 7px; }
  .carte-score .g-tuile dd { font-size: 1rem; }
  .lecture, .couverture .meta { font-size: 8.5pt; margin: 4px 0; }
  .couverture h2 { margin: 10px 0 4px !important; }
  .sommaire { margin: 4px 0; }
  .avertissement { margin-top: 6px; padding: 6px 10px; font-size: 8.5pt; }
}

/* Créer votre entreprise */
.creation h3 { margin-top: 28px; }
.constats { padding-left: 1.2rem; }
.constats li { margin: 5px 0; }
.formes, .obligations, .aides, .services { display: grid; grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); gap: 12px; margin: 10px 0; }
.forme, .obligation, .aide-carte, .service { background: var(--surface); border: 1px solid var(--bord); border-radius: 12px; padding: 12px 14px; break-inside: avoid; font-size: .9rem; }
.forme h4, .obligation h4, .aide-carte h4, .service h4 { margin: 0 0 6px; font-size: 1rem; display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.forme dl { display: grid; grid-template-columns: 7.5rem 1fr; gap: 4px 8px; margin: 0 0 8px; }
.forme dt { color: var(--doux); font-size: .8rem; }
.forme dd { margin: 0; }
.forme.exclue { opacity: .6; }
.forme-plus, .forme-moins { margin: 3px 0; }
.forme-plus::first-letter { color: var(--st-bon); font-weight: 800; }
.forme-moins::first-letter { color: var(--st-critique); font-weight: 800; }
.etiquette-alerte { font-size: .72rem; font-weight: 700; padding: 1px 7px; border-radius: 999px; background: color-mix(in srgb, var(--st-attention) 30%, transparent); color: var(--texte); }
.obligation.a-confirmer { border-style: dashed; }
.obligation-pratique { display: flex; flex-direction: column; gap: 3px; margin: 8px 0 4px; }
.etapes { padding-left: 1.4rem; display: grid; gap: 8px; }
.etapes li strong { display: block; }
.etapes li span { color: var(--doux); font-size: .92rem; }
.service-type { text-transform: uppercase; letter-spacing: .06em; font-size: .7rem; color: var(--doux); margin: 0 0 2px; }
.service p { margin: 3px 0; }
.service-contact { display: flex; flex-wrap: wrap; gap: 4px 12px; }
.service-role { color: var(--doux); font-size: .84rem; border-top: 1px dashed var(--bord); padding-top: 6px; margin-top: 6px !important; }
.sources-mini { font-size: .74rem; color: var(--doux); margin: 4px 0 8px; overflow-wrap: anywhere; }
.creation a { color: var(--accent); overflow-wrap: anywhere; }
.groupe-lieu { display: flex; gap: 8px; align-items: center; }
@media print {
  .creation a[href^="http"]::after { content: " (" attr(href) ")"; font-size: 7.5pt; color: #555; overflow-wrap: anywhere; }
  .sources-mini a[href^="http"]::after { content: ""; }
  .forme, .obligation, .aide-carte, .service { break-inside: avoid; }
}
.formes { grid-template-columns: repeat(auto-fit, minmax(19rem, 1fr)); }
.forme dl { grid-template-columns: 6.2rem 1fr; }
.sources-mini a { color: var(--doux) !important; }

/* Lien vers l'ajout d'une adresse : écran seulement */
.ajout-adresse { margin-top: 14px; padding: 10px 14px; border-radius: 10px; background: color-mix(in srgb, var(--accent) 10%, transparent); }
@media print { .no-print { display: none !important; } }

/* Comparatif chiffré des statuts : une carte par statut */
.statuts { display: grid; grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr)); gap: 12px; margin: 14px 0; }
.statut { border: 1px solid var(--bord); border-radius: 12px; padding: 14px 16px; background: var(--surface); break-inside: avoid; }
.statut h5 { margin: 0 0 6px; font-size: 1rem; }
.statut.statut-gagnant { border: 2px solid var(--accent); }
.statut.statut-gagnant h5::after { content: " ★ le plus de revenu"; color: var(--accent); font-size: .78rem; font-weight: 700; }
.statut.exclu { opacity: .65; }
.statut-net { margin: 0 0 8px; font-size: 1.5rem; font-weight: 800; }
.statut-net small { display: block; font-size: .78rem; font-weight: 400; color: var(--doux); }
.statut dl { display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; margin: 0 0 8px; font-size: .9rem; }
.statut dt { color: var(--doux); } .statut dd { margin: 0; text-align: right; font-weight: 650; white-space: nowrap; }
.statut-exclu { color: var(--attention); font-style: italic; margin: 0 0 8px; }
.statut-protection { margin: 0; padding-left: 1.1em; font-size: .82rem; color: var(--doux); }
.statut-protection li { margin: 2px 0; }

.lien-banque { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 10px; background: color-mix(in srgb, var(--accent) 10%, transparent); }
.lien-banque .bouton { text-decoration: none; }

/* Logo du projet, posé sur la page de garde (fond blanc pour rester lisible sur la couleur) */
.logo-projet { display: block; max-width: 220px; max-height: 88px; object-fit: contain; background: #fff; padding: 8px 12px; border-radius: 10px; margin: 0 0 14px; }
