Parcourir la source

Mise à jour config, API, PDF, analytics et htaccess

augustin.podvin il y a 8 mois
Parent
commit
f43151d2f2

+ 1 - 0
.gitignore

@@ -3,6 +3,7 @@
 
 # Composer archive (ne pas commiter le phar)
 composer.phar
+composer-setup.php
 
 # Stockage local (emails pseudo, PDFs générés, rate limit, analytics)
 /storage/outbox/

+ 13 - 41
README.md

@@ -1,49 +1,21 @@
-# Audit express self (V1)
+# Audit Express Self (V1)
 
-Stack : **HTML / CSS / JavaScript / PHP**.
+Quiz diagnostic "contrôle technique" — 20 questions, ~7 min.  
+Stack : HTML / CSS / JavaScript / PHP.
 
-## Objectif
-
-Une micro-app “contrôle technique” (quiz 20 questions) qui :
-- affiche des résultats immédiats (score /100, 5 piliers, 3 risques, aperçu quick wins)
-- permet de générer un **PDF 1 page** (100% PHP)
-- prévoit une étape email (transactionnel) sous forme **pseudo** (à brancher ensuite)
-
-## Installation (local)
-
-Pré-requis : PHP 8.1+.
-
-1) Installer les dépendances PHP (PDF) :
+## Démarrage rapide
 
 ```bash
-php composer.phar install --ignore-platform-req=ext-mbstring
+composer install --ignore-platform-req=ext-mbstring
+php -S 127.0.0.1:8000 -t public
 ```
 
-2) Lancer un serveur PHP :
-
-```bash
-php -S localhost:8000 -t public
-```
-
-Puis ouvrir `http://localhost:8000`.
-
-## Configuration
-
-- **URLs** (`config/config.php`) : `booking_url`, `devis_url`. Copier `config/config.local.example.php` en `config.local.php` pour surcharger.
-- **Sécurité** : rate limiting, taille max du body (1 Mo), liste blanche `allowed_notify_tools`.
-- **Notification admin** : `admin_notify_webhook` — POST JSON à chaque submit (Zapier, Make, endpoint custom).
-- Packs quiz : `config/packs/*.json` (pack-onboarding-v1, validation-facture, process-generique…)
-- Quick wins / risques / règles : `config/audit-structure.json`
-
-## Endpoints (V1)
-
-- `GET /api/pack.php?pack=onboarding-v1|validation-facture`
-- `POST /api/score.php` (JSON) → calcule score + résultats
-- `POST /api/pdf.php` (JSON) → génère et renvoie un PDF
-- `POST /api/email.php` (JSON) → **pseudo** envoi : stocke dans `storage/outbox/`
-- `POST /api/notify.php` (JSON) → inscription intérêt outil à venir
-
-## Intégration MODX
+→ http://localhost:8000
 
-Approche recommandée : intégrer les **templates HTML/CSS/JS** côté MODX, et garder les endpoints PHP (dossier `public/api/`) accessibles sur le même domaine.
+## Documentation
 
+| Fichier | Contenu |
+|---------|---------|
+| **docs/DOC.md** | Documentation complète (structure, déploiement, config) |
+| **docs/SECURITY.md** | Sécurité et bonnes pratiques |
+| **docs/MODX_INTEGRATION.md** | Intégration MODX |

+ 3 - 2
config/config.local.example.php

@@ -7,7 +7,8 @@ declare(strict_types=1);
  * Copier en config.local.php et adapter les valeurs.
  */
 return [
-    'booking_url' => 'https://votre-lien-calendly.com/rendez-vous',
+    'booking_url' => 'https://cal.com/augustin.podvin/decouvrir-les-opportunites-suite-a-mon-audit',
     'devis_url'   => 'mailto:contact@votredomaine.fr?subject=Demande%20de%20devis',
-    // 'admin_notify_webhook' => 'https://hooks.zapier.com/...',  // POST à chaque submit
+    // Webhook appelé à chaque submit (score, pdf, email) — à garder secret
+    'admin_notify_webhook' => 'https://hooks.zapier.com/...',  // ou Make, endpoint custom
 ];

+ 2 - 2
config/config.php

@@ -10,7 +10,7 @@ declare(strict_types=1);
  */
 return [
     // URLs (à adapter selon l'environnement)
-    'booking_url' => 'https://calendly.com/livinweb/diagnostic',
+    'booking_url' => 'https://cal.com/augustin.podvin/decouvrir-les-opportunites-suite-a-mon-audit',
     'devis_url'   => 'mailto:contact@livinweb.fr?subject=Demande%20de%20devis%20%E2%80%94%20Audit%20Express',
 
     // Sécurité
@@ -23,6 +23,6 @@ return [
     ],
     'allowed_notify_tools' => ['process-mapper'],  // Liste blanche pour notify.php
 
-    // Notification admin : webhook appelé à chaque submit (POST JSON : source, pack_id, answers, optional, result, pdf_base64)
+    // Webhook appelé à chaque submit (score, pdf, email) — Make, Zapier ou endpoint custom
     'admin_notify_webhook' => 'https://hook.eu1.make.com/hwpp9vg8i8sw32wroqfb1y1923vb6plp',
 ];

+ 118 - 0
docs/DOC.md

@@ -0,0 +1,118 @@
+# Audit Express Self — Documentation
+
+Quiz diagnostic "contrôle technique" (20 questions, ~7 min). Stack : HTML/CSS/JS + PHP.
+
+---
+
+## 1. Démarrage rapide (local)
+
+### Prérequis
+
+- **PHP 8.1+**
+- **Composer** : [getcomposer.org](https://getcomposer.org) — installer globalement ou télécharger `composer.phar` dans le projet
+
+### Commandes
+
+```bash
+composer install --ignore-platform-req=ext-mbstring
+php -S 127.0.0.1:8000 -t public
+```
+
+→ Ouvrir http://localhost:8000
+
+*Sans Composer global : `php composer.phar install ...`*
+
+---
+
+## 2. Structure du projet
+
+```
+audit express self/
+├── config/           Configuration + packs JSON
+├── src/              Classes PHP (Engine, PdfRenderer, etc.)
+├── vendor/           Dépendances (Composer)
+├── storage/          Données générées (emails, stats, rate limit)
+├── templates/        Modèle HTML du PDF
+├── public/           ← Racine web (ce que le navigateur voit)
+│   ├── index.php
+│   ├── api/
+│   └── assets/
+├── docs/             Documentation
+├── modx/             Intégration MODX (optionnel)
+├── composer.json
+└── README.md
+```
+
+---
+
+## 3. Configuration
+
+- **config.php** : valeurs par défaut
+- **config.local.php** : surcharges (booking_url, devis_url, webhook) — à créer à partir de `config.local.example.php`
+- **config.local.php** est ignoré par Git (ne pas le commiter)
+
+---
+
+## 4. Déploiement manuel (FileZilla)
+
+### Prérequis
+
+- Compte FTP OVH (host, user, password)
+- `config.local.php` créé sur le serveur (une seule fois)
+
+### Process
+
+1. **Versionner** : `git add .` → `git commit -m "..."` → `git push`
+2. **Composer** (si dépendances modifiées) : `composer install --ignore-platform-req=ext-mbstring`
+3. **FileZilla** : envoyer vers la racine FTP
+   - `config/` → racine (sans écraser config.local.php)
+   - `src/` → racine
+   - `templates/` → racine (requis pour la génération PDF)
+   - `vendor/` → racine
+   - contenu de `public/` → `www/`
+
+### Structure sur OVH
+
+```
+Racine FTP/
+├── config/
+├── src/
+├── templates/
+├── vendor/
+├── storage/     (créé automatiquement par l'app)
+└── www/
+    ├── index.php
+    ├── api/
+    └── assets/
+```
+
+---
+
+## 5. Endpoints API
+
+| Méthode | URL | Rôle |
+|---------|-----|------|
+| GET | /api/pack.php?pack=onboarding-v1 | Charge un pack de questions |
+| POST | /api/score.php | Calcule le score et les résultats |
+| POST | /api/pdf.php | Génère et renvoie le PDF |
+| POST | /api/email.php | Capture email + stocke dans storage/outbox |
+| POST | /api/notify.php | Inscription intérêt outil |
+
+---
+
+## 6. Packs disponibles
+
+| pack_id | Description |
+|---------|-------------|
+| onboarding-v1 | Onboarding collaborateur |
+| validation-facture | Validation de facture |
+| process-generique | Process universel |
+
+---
+
+## 7. Documentation complémentaire
+
+| Fichier | Contenu |
+|---------|---------|
+| **docs/SECURITY.md** | Checklist sécurité, bonnes pratiques |
+| **docs/MODX_INTEGRATION.md** | Intégration dans MODX (templates, snippets, BD) |

+ 2 - 2
MODX_INTEGRATION.md → docs/MODX_INTEGRATION.md

@@ -103,7 +103,7 @@ Colonnes de `audit_requests` :
 | `ae.resource.optional` | ID ressource optional       |
 | `ae.resource.results`  | ID ressource résultats      |
 | `ae.resource.pdf`      | ID ressource PDF download   |
-| `ae.booking_url`       | Lien Calendly               |
+| `ae.booking_url`       | Lien Cal.com / réservation  |
 | `ae.devis_url`         | URL ou mailto devis         |
 
 ---
@@ -264,7 +264,7 @@ La purge des données doit être exécutée régulièrement (cron ou tâche plan
 
 ### SQL à exécuter (ou via script shell)
 
- n’```sql
+```sql
 DELETE FROM modx_audit_requests
 WHERE status = 'draft' AND created_at < DATE_SUB(NOW(), INTERVAL 7 DAY);
 

+ 63 - 0
docs/SECURITY.md

@@ -0,0 +1,63 @@
+# Sécurité — Audit Express Self
+
+## Mesures déjà en place
+
+| Mesure | Détail |
+|--------|--------|
+| **CSRF** | Token validé sur tous les POST (score, pdf, email, notify) |
+| **Rate limiting** | Limites par endpoint (score, pdf, email, notify) |
+| **Taille body** | Max 1 Mo sur les requêtes JSON |
+| **Headers sécurité** | X-Frame-Options, X-Content-Type-Options, Referrer-Policy, etc. |
+| **Cookies session** | HttpOnly, SameSite=Lax, Secure (en HTTPS) |
+| **.htaccess** | Pas de listing répertoires, blocage fichiers sensibles |
+| **Document root** | `public/` — config/, src/, storage/ non accessibles en HTTP |
+
+---
+
+## Checklist production (OVH)
+
+### 1. Configuration
+
+- [ ] Créer `config/config.local.php` à partir de `config.local.example.php`
+- [ ] Mettre le webhook (`admin_notify_webhook`) dans `config.local.php` uniquement
+- [ ] Adapter `booking_url` et `devis_url` pour livinwebb.fr
+
+### 2. Serveur
+
+- [ ] **Document root** = dossier `public/` (pas la racine du projet)
+- [ ] **HTTPS** activé (Let's Encrypt inclus sur OVH)
+- [ ] **PHP 8.1+** sélectionné dans l'espace client OVH
+
+### 3. Permissions
+
+- [ ] Dossier `storage/` en écriture (755 ou 775 selon l'utilisateur du serveur)
+
+### 4. Compte OVH
+
+- [ ] Mot de passe fort pour l'espace client
+- [ ] Authentification à deux facteurs (2FA) si disponible
+- [ ] FTP/SSH : mot de passe fort ou clé SSH
+
+### 5. Après déploiement
+
+- [ ] Tester le quiz de bout en bout
+- [ ] Vérifier que les emails arrivent (ou sont bien stockés dans `storage/outbox/`)
+- [ ] Désactiver l'affichage des erreurs PHP en production (`display_errors = Off` dans php.ini ou .user.ini)
+
+---
+
+## En cas de compromission
+
+1. Changer immédiatement les mots de passe (OVH, FTP, base de données)
+2. Régénérer le webhook (nouvelle URL Zapier/Make)
+3. Vérifier les fichiers modifiés (dates, contenu suspect)
+4. Mettre à jour PHP et les dépendances Composer
+5. Contacter OVH support si besoin
+
+---
+
+## Données sensibles (RGPD)
+
+- Emails et réponses stockés dans `storage/outbox/` (V1 pseudo) ou base MODX
+- Purge recommandée : voir `docs/MODX_INTEGRATION.md` section 10 pour le cron de purge
+- Pas d'IP en clair : `ip_hash` (sha256) uniquement côté MODX

+ 4 - 5
modx/chunks/ae_cta_unlocked.html

@@ -7,13 +7,12 @@
 
     <div class="h2" style="margin-bottom:6px">Et maintenant ?</div>
     <p class="lead" style="margin-bottom:24px">
-      Votre diagnostic révèle des opportunités concrètes. Nous pouvons vous aider
-      à les transformer en plan d'action avec les bons outils digitaux.
+      Votre diagnostic révèle des opportunités concrètes. Réservez un entretien offert avec un consultant pour les prioriser et définir votre plan d'action.
     </p>
 
     <div class="cta-block">
-      [[+booking_url:notempty=`<a class="btn btn--primary btn--cta-main" href="[[+booking_url]]" target="_blank" rel="noreferrer">📅&nbsp;Réserver un appel découverte gratuit — 30 min</a>`]]
-      [[+devis_url:notempty=`<a class="btn btn--outline btn--cta-secondary" href="[[+devis_url]]">✉&nbsp;Demander un devis</a>`]]
+      [[+booking_url:notempty=`<div style="display:flex;flex-direction:column;align-items:center;width:100%"><span class="cta-offert">30 min offert</span><a class="btn btn--primary btn--cta-main" href="[[+booking_url]]" target="_blank" rel="noreferrer">Découvrir les opportunités suite à mon audit — Entretien de 30 min offert avec un consultant</a></div>`]]
+      [[+devis_url:notempty=`<a class="btn btn--outline btn--cta-secondary" href="[[+devis_url]]">Demander un devis</a>`]]
     </div>
 
     <p class="hint" style="text-align:center;margin-top:10px">
@@ -26,7 +25,7 @@
       <!-- Téléchargement PDF direct -->
       <a class="btn btn--outline"
          href="[[+action_url:replace=`resultats==pdf`]]?audit=[[+audit_uid]]">
-        ⬇&nbsp;Télécharger mon PDF
+        Télécharger mon PDF
       </a>
       <a class="btn btn--outline" href="[[+select_url]]" style="font-size:13px">
         Diagnostiquer un autre process

+ 3 - 3
modx/preview-chunks.html

@@ -580,12 +580,12 @@
               <div class="h2" style="margin-bottom:6px">Et maintenant ?</div>
               <p class="lead" style="margin-bottom:24px">Votre diagnostic révèle des opportunités concrètes. Nous pouvons vous aider à les transformer en plan d'action.</p>
               <div style="display:flex;flex-wrap:wrap;gap:10px;justify-content:center">
-                <a class="btn btn--primary" href="#">📅&nbsp;Réserver un appel découverte — 30 min</a>
-                <a class="btn btn--outline" href="#">✉&nbsp;Demander un devis</a>
+                <a class="btn btn--primary" href="#">Réserver un appel découverte — 30 min</a>
+                <a class="btn btn--outline" href="#">Demander un devis</a>
               </div>
               <hr style="border:none;border-top:1px solid var(--border);margin:24px 0">
               <div class="btnrow" style="justify-content:center;gap:10px">
-                <a class="btn btn--outline" href="#">⬇&nbsp;Télécharger mon PDF</a>
+                <a class="btn btn--outline" href="#">Télécharger mon PDF</a>
                 <a class="btn btn--outline" href="#" style="font-size:13px">Diagnostiquer un autre process</a>
               </div>
             </div>

+ 1 - 1
modx/setup/install.php

@@ -53,7 +53,7 @@ $settings = [
     'ae.resource.optional' => '',
     'ae.resource.results'  => '',
     'ae.resource.pdf'      => '',
-    'ae.booking_url'    => 'https://calendly.com/livinweb/diagnostic',
+    'ae.booking_url'    => 'https://cal.com/augustin.podvin/decouvrir-les-opportunites-suite-a-mon-audit',
     'ae.devis_url'      => 'mailto:contact@livinweb.fr',
 ];
 

+ 1 - 1
modx/snippets/AuditExpress_PDF.php

@@ -8,7 +8,7 @@
  * ou via une ressource dédiée avec ce snippet.
  *
  * Propriétés :
- *   &booking_url = `https://calendly.com/livinweb/diagnostic`
+ *   &booking_url = `https://cal.com/augustin.podvin/decouvrir-les-opportunites-suite-a-mon-audit`
  *
  * Envoie directement les headers PDF + contenu binaire, puis exit.
  */

+ 1 - 1
modx/snippets/AuditExpress_Results.php

@@ -5,7 +5,7 @@
  *
  * Propriétés :
  *   &select_resource_id = `4`  Pour "Diagnostiquer un autre process"
- *   &booking_url        = `https://calendly.com/livinweb/diagnostic`
+ *   &booking_url        = `https://cal.com/augustin.podvin/decouvrir-les-opportunites-suite-a-mon-audit`
  *   &devis_url          = `mailto:contact@livinweb.fr`
  *
  * L'audit_uid passe en GET (?audit=xxxx) ou est lu depuis la session.

+ 17 - 0
public/.htaccess

@@ -0,0 +1,17 @@
+# Audit Express Self — Sécurité Apache (OVH)
+
+# Désactiver l'affichage du contenu des répertoires
+Options -Indexes
+
+# Bloquer l'accès aux fichiers sensibles
+<FilesMatch "\.(env|log|json|sql|md|lock|yml|yaml)$">
+    Require all denied
+</FilesMatch>
+
+# Protection contre le hotlinking des images (optionnel)
+# <IfModule mod_rewrite.c>
+#     RewriteEngine On
+#     RewriteCond %{HTTP_REFERER} !^$
+#     RewriteCond %{HTTP_REFERER} !^https?://(www\.)?votredomaine\.fr [NC]
+#     RewriteRule \.(jpg|jpeg|png|gif|svg|webp)$ - [F]
+# </IfModule>

+ 3 - 0
public/api/_bootstrap.php

@@ -23,6 +23,9 @@ spl_autoload_register(function (string $class) use ($root): void {
     }
 });
 
+\AuditExpress\Security::sendHeaders();
+\AuditExpress\Security::requireJsonContentType();
+
 $config = load_config($root);
 
 return ['root' => $root, 'config' => $config];

+ 5 - 8
public/api/email.php

@@ -6,6 +6,7 @@ use AuditExpress\AdminNotifier;
 use AuditExpress\Analytics;
 use AuditExpress\Engine;
 use AuditExpress\Http;
+use AuditExpress\InputValidator;
 use AuditExpress\PackRepository;
 use AuditExpress\PdfRenderer;
 use AuditExpress\RateLimiter;
@@ -24,20 +25,16 @@ Security::validateCsrf();
 
 $maxBody = (int) ($config['max_body_bytes'] ?? 1_048_576);
 $body = Http::readJsonBody($maxBody > 0 ? $maxBody : null);
-$packId = (string) ($body['pack_id'] ?? 'onboarding-v1');
-$answers = $body['answers'] ?? [];
-$optional = $body['optional'] ?? [];
+$packId = InputValidator::sanitizePackId((string) ($body['pack_id'] ?? 'onboarding-v1'));
+$answers = InputValidator::validateAnswers(is_array($body['answers'] ?? null) ? $body['answers'] : []);
+$optional = InputValidator::validateOptional(is_array($body['optional'] ?? null) ? $body['optional'] : []);
 $userEmail = (string) ($body['email'] ?? '');
-$bookingUrl = (string) ($body['booking_url'] ?? '');
+$bookingUrl = InputValidator::sanitizeUrl((string) ($body['booking_url'] ?? ''));
 
 if ($userEmail === '' || !filter_var($userEmail, FILTER_VALIDATE_EMAIL)) {
     Http::json(['error' => 'Email invalide'], 400);
     exit;
 }
-if (!is_array($answers) || !is_array($optional)) {
-    Http::json(['error' => 'Invalid payload'], 400);
-    exit;
-}
 
 try {
     $packRepo = new PackRepository($root);

+ 2 - 1
public/api/pack.php

@@ -4,6 +4,7 @@ declare(strict_types=1);
 
 use AuditExpress\Analytics;
 use AuditExpress\Http;
+use AuditExpress\InputValidator;
 use AuditExpress\PackRepository;
 
 ['root' => $root] = require __DIR__ . '/_bootstrap.php';
@@ -13,7 +14,7 @@ if ($_SERVER['REQUEST_METHOD'] !== 'GET') {
     exit;
 }
 
-$packId = (string) ($_GET['pack'] ?? 'onboarding-v1');
+$packId = InputValidator::sanitizePackId((string) ($_GET['pack'] ?? 'onboarding-v1'));
 
 try {
     $repo = new PackRepository($root);

+ 5 - 10
public/api/pdf.php

@@ -6,6 +6,7 @@ use AuditExpress\AdminNotifier;
 use AuditExpress\Analytics;
 use AuditExpress\Engine;
 use AuditExpress\Http;
+use AuditExpress\InputValidator;
 use AuditExpress\PackRepository;
 use AuditExpress\PdfRenderer;
 use AuditExpress\RateLimiter;
@@ -24,16 +25,10 @@ Security::validateCsrf();
 
 $maxBody = (int) ($config['max_body_bytes'] ?? 1_048_576);
 $body = Http::readJsonBody($maxBody > 0 ? $maxBody : null);
-$packId = (string) ($body['pack_id'] ?? 'onboarding-v1');
-$answers = $body['answers'] ?? [];
-$optional = $body['optional'] ?? [];
-
-if (!is_array($answers) || !is_array($optional)) {
-    Http::json(['error' => 'Invalid payload'], 400);
-    exit;
-}
-
-$bookingUrl = (string) ($body['booking_url'] ?? '');
+$packId = InputValidator::sanitizePackId((string) ($body['pack_id'] ?? 'onboarding-v1'));
+$answers = InputValidator::validateAnswers(is_array($body['answers'] ?? null) ? $body['answers'] : []);
+$optional = InputValidator::validateOptional(is_array($body['optional'] ?? null) ? $body['optional'] : []);
+$bookingUrl = InputValidator::sanitizeUrl((string) ($body['booking_url'] ?? ''));
 
 try {
     $packRepo = new PackRepository($root);

+ 4 - 8
public/api/score.php

@@ -6,6 +6,7 @@ use AuditExpress\AdminNotifier;
 use AuditExpress\Analytics;
 use AuditExpress\Engine;
 use AuditExpress\Http;
+use AuditExpress\InputValidator;
 use AuditExpress\PackRepository;
 use AuditExpress\PdfRenderer;
 use AuditExpress\RateLimiter;
@@ -24,14 +25,9 @@ Security::validateCsrf();
 
 $maxBody = (int) ($config['max_body_bytes'] ?? 1_048_576);
 $body = Http::readJsonBody($maxBody > 0 ? $maxBody : null);
-$packId = (string) ($body['pack_id'] ?? 'onboarding-v1');
-$answers = $body['answers'] ?? [];
-$optional = $body['optional'] ?? [];
-
-if (!is_array($answers) || !is_array($optional)) {
-    Http::json(['error' => 'Invalid payload'], 400);
-    exit;
-}
+$packId = InputValidator::sanitizePackId((string) ($body['pack_id'] ?? 'onboarding-v1'));
+$answers = InputValidator::validateAnswers(is_array($body['answers'] ?? null) ? $body['answers'] : []);
+$optional = InputValidator::validateOptional(is_array($body['optional'] ?? null) ? $body['optional'] : []);
 
 try {
     $packRepo = new PackRepository($root);

+ 42 - 15
public/assets/css/app.css

@@ -4,6 +4,7 @@
   --navy:    #173258;
   --blue:    #2F506D;
   --cyan:    #00BEF3;
+  --cyan-hover: #00a8d9;
   --dark:    #04173d;
   --bg:      #f2f6fa;
   --bg-card: #ffffff;
@@ -105,7 +106,7 @@ body {
   margin-left: 8px;
 }
 .navbar__link--cta:hover {
-  background: rgba(0, 190, 243, .85);
+  background: var(--cyan-hover);
   color: #fff !important;
 }
 .navbar__badge {
@@ -296,20 +297,15 @@ body {
   border: 2px solid transparent; white-space: nowrap;
 }
 .btn--primary {
-  background: var(--dark); color: #fff; border-color: var(--dark);
+  background: var(--cyan); color: #fff; border-color: var(--cyan);
 }
-.btn--primary:hover { background: var(--navy); border-color: var(--navy); }
+.btn--primary:hover { background: var(--cyan-hover); border-color: var(--cyan-hover); }
 
 .btn--outline {
   background: transparent; color: var(--blue); border-color: var(--border);
 }
 .btn--outline:hover { border-color: var(--blue); }
 
-.btn--cyan {
-  background: var(--cyan); color: #fff; border-color: var(--cyan);
-}
-.btn--cyan:hover { opacity: .85; }
-
 .btn:disabled { opacity: .38; cursor: not-allowed; }
 
 /* ── Section label ── */
@@ -532,12 +528,27 @@ body {
 .unlock-gate__icon {
   font-size: 28px; color: var(--cyan); font-weight: 700;
   margin-bottom: 12px; line-height: 1;
-  animation: bounce 1.4s ease-in-out infinite;
+  animation: unlock-bounce 1.4s ease-in-out infinite;
 }
-@keyframes bounce {
+@keyframes unlock-bounce {
   0%, 100% { transform: translateY(0); }
   50% { transform: translateY(5px); }
 }
+.unlock-gate .btn--unlock {
+  animation: unlock-pulse 2s ease-in-out infinite;
+}
+@keyframes unlock-pulse {
+  0%, 100% { box-shadow: 0 2px 12px rgba(0, 190, 243, .35); }
+  50% { box-shadow: 0 4px 20px rgba(0, 190, 243, .5); }
+}
+.unlock-gate--exiting {
+  animation: unlock-gate-exit 0.32s ease-out forwards;
+  pointer-events: none;
+}
+@keyframes unlock-gate-exit {
+  0% { opacity: 1; transform: scale(1); }
+  100% { opacity: 0; transform: scale(0.97); }
+}
 .unlock-gate .h2 { text-align: center; font-size: 22px; }
 .unlock-gate .lead { text-align: center; max-width: 480px; margin: 0 auto 18px; }
 
@@ -574,7 +585,7 @@ body {
   color: var(--navy); font-family: Lato, sans-serif; font-size: 15px;
 }
 .unlock-row input[type="email"]:focus { outline: none; border-color: var(--cyan); }
-.btn--unlock { padding: 12px 28px; font-size: 16px; }
+.btn--unlock { padding: 12px 28px; font-size: 16px; box-shadow: 0 2px 12px rgba(0, 190, 243, .35); }
 
 /* ── CTAs débloqués ── */
 .unlocked-ctas {
@@ -599,15 +610,31 @@ body {
   align-items: center;
   gap: 12px;
   margin: 0 auto;
-  max-width: 420px;
+  max-width: 480px;
+}
+.cta-block .cta-offert {
+  display: inline-block;
+  font-size: 11px;
+  font-weight: 700;
+  text-transform: uppercase;
+  letter-spacing: .08em;
+  color: var(--cyan);
+  background: rgba(0, 190, 243, .12);
+  padding: 4px 10px;
+  border-radius: 6px;
+  margin-bottom: 4px;
 }
 .btn--cta-main {
   width: 100%;
-  padding: 16px 24px;
-  font-size: 17px;
+  padding: 18px 24px;
+  font-size: 16px;
   font-weight: 700;
   letter-spacing: .01em;
-  box-shadow: 0 4px 14px rgba(0,190,243,.35);
+  line-height: 1.35;
+  box-shadow: 0 4px 16px rgba(0,190,243,.4);
+  white-space: normal;
+  text-align: center;
+  word-wrap: break-word;
 }
 .btn--cta-secondary {
   width: 100%;

+ 34 - 24
public/assets/js/app.js

@@ -55,6 +55,7 @@ const state = {
   optional: {},
   result: null,
   emailUnlocked: false,
+  unlockExiting: false,
   captureEmail: '',
   notifyTool: '',
   roiInputs: { volume: '', tempsActuel: '', tempsCible: '', coutHoraire: '', tauxErreurs: '', tempsErreur: '', delaiActuel: '', delaiCible: '' },
@@ -118,7 +119,7 @@ async function apiJson(path, { method = 'GET', body } = {}) {
 function setView(v) { state.view = v; render(); }
 
 function goStart() {
-  Object.assign(state, { packId: null, pack: null, idx: 0, answers: {}, optional: {}, result: null, emailUnlocked: false, captureEmail: '' });
+  Object.assign(state, { packId: null, pack: null, idx: 0, answers: {}, optional: {}, result: null, emailUnlocked: false, unlockExiting: false, captureEmail: '' });
   setView('landing');
 }
 
@@ -178,7 +179,6 @@ function renderNotifyDialog() {
       if (body) {
         body.innerHTML = '';
         body.appendChild(h('div', { style: 'text-align:center;padding:20px 0' }, [
-          h('div', { style: 'font-size:36px;margin-bottom:12px;color:var(--good)' }, ['✓']),
           h('div', { class: 'h2', style: 'color:var(--good);margin-bottom:8px' }, ['C\'est noté !']),
           h('p', { class: 'lead' }, [`Vous serez parmi les premiers informés du lancement de ${toolName}.`]),
           h('button', {
@@ -325,6 +325,7 @@ function renderIntro() {
     state.optional = {};
     state.idx = 0;
     state.emailUnlocked = false;
+    state.unlockExiting = false;
     state.captureEmail = '';
     saveProgress();
     setView('quiz');
@@ -606,13 +607,19 @@ function renderResults() {
       const email = e.target.querySelector('input[type="email"]').value.trim();
       if (!email.includes('@') || email.length < 5) return;
       state.captureEmail = email;
-      state.emailUnlocked = true;
-      saveProgress();
+      state.unlockExiting = true;
       render();
-      setTimeout(() => document.getElementById('pdfDialog')?.showModal(), 80);
+      setTimeout(() => {
+        state.emailUnlocked = true;
+        state.unlockExiting = false;
+        saveProgress();
+        render();
+        setTimeout(() => document.getElementById('pdfDialog')?.showModal(), 50);
+      }, 320);
     };
 
-    return h('div', { class: 'unlock-gate' }, [
+    const exiting = state.unlockExiting;
+    return h('div', { class: 'unlock-gate' + (exiting ? ' unlock-gate--exiting' : '') }, [
       h('div', { class: 'unlock-gate__inner' }, [
         h('div', { class: 'unlock-gate__icon' }, ['↓']),
         h('div', { class: 'h2', style: 'margin-bottom:6px' }, ['Débloquez vos axes d\'amélioration']),
@@ -638,26 +645,29 @@ function renderResults() {
 
   /* ── CTAs débloqués ── */
   const renderUnlockedCtas = () =>
-    h('div', { class: 'unlocked-ctas' }, [
+    h('div', { class: 'unlocked-ctas unlocked-ctas--entering' }, [
       h('div', { class: 'unlocked-ctas__inner' }, [
 
         /* En-tête */
         h('div', { class: 'h2', style: 'margin-bottom:6px' }, ['Et maintenant ?']),
         h('p', { class: 'lead', style: 'margin-bottom:24px' }, [
-          'Votre diagnostic révèle des opportunités concrètes. Nous pouvons vous aider à les transformer en plan d\'action avec les bons outils digitaux.',
+          'Votre diagnostic révèle des opportunités concrètes. Réservez un entretien offert avec un consultant pour les prioriser et définir votre plan d\'action.',
         ]),
 
         /* CTAs commerciaux */
         h('div', { class: 'cta-block' }, [
-          BOOKING_URL ? h('a', {
-            class: 'btn btn--primary btn--cta-main',
-            href: BOOKING_URL, target: '_blank', rel: 'noreferrer',
-          }, ['📅\u00a0 Réserver un appel découverte gratuit — 30 min']) : null,
+          BOOKING_URL ? h('div', { style: 'display:flex;flex-direction:column;align-items:center;width:100%' }, [
+            h('span', { class: 'cta-offert' }, ['30 min offert']),
+            h('a', {
+              class: 'btn btn--primary btn--cta-main',
+              href: BOOKING_URL, target: '_blank', rel: 'noreferrer',
+            }, ['Découvrir les opportunités suite à mon audit — Entretien de 30 min offert avec un consultant']),
+          ]) : null,
 
           DEVIS_URL ? h('a', {
             class: 'btn btn--outline btn--cta-secondary',
             href: DEVIS_URL,
-          }, ['✉\u00a0 Demander un devis']) : null,
+          }, ['Demander un devis']) : null,
         ]),
 
         h('p', { class: 'hint', style: 'text-align:center;margin-top:10px' }, [
@@ -672,7 +682,7 @@ function renderResults() {
           h('button', {
             class: 'btn btn--outline',
             onClick: () => document.getElementById('pdfDialog')?.showModal(),
-          }, ['⬇\u00a0 Télécharger mon PDF']),
+          }, ['Télécharger mon PDF']),
           h('button', {
             class: 'btn btn--outline',
             style: 'font-size:13px',
@@ -707,7 +717,7 @@ function renderResults() {
     v2 ? renderV2Diagnostic() : null,
 
     /* Non-V2 : risques (visibles uniquement après déblocage) */
-    !v2 && unlocked ? h('div', { class: 'card' }, [
+    !v2 && unlocked && !state.unlockExiting ? h('div', { class: 'card' }, [
       h('div', { class: 'h2' }, ['3 risques probables']),
       riskItems.length
         ? h('ol', { class: 'list' }, riskItems)
@@ -715,7 +725,7 @@ function renderResults() {
     ]) : null,
 
     /* Non-V2 : coût caché (visible uniquement après déblocage) */
-    !v2 && unlocked && cost ? h('div', { class: 'cost-block' }, [
+    !v2 && unlocked && !state.unlockExiting && cost ? h('div', { class: 'cost-block' }, [
       h('div', { class: 'h2' }, ['Coût caché estimé']),
       h('div', { class: 'cost-figures' }, [
         h('div', { class: 'cost-fig' }, [
@@ -730,14 +740,14 @@ function renderResults() {
       h('p', { class: 'hint' }, ['Estimation indicative, à valider par mesure réelle.']),
     ]) : null,
 
-    /* Gate (formulaire déblocage) ou contenu débloqué — gate visible uniquement si non débloqué */
-    unlocked ? null : renderUnlockGate(),
+    /* Gate (formulaire déblocage) ou contenu débloqué — gate visible pendant animation de sortie */
+    !unlocked || state.unlockExiting ? renderUnlockGate() : null,
 
     /* V2 : mini plan (débloqué) */
     v2 ? renderMiniPlan() : null,
 
     /* Non-V2 : quick wins (débloqués) */
-    !v2 && unlocked ? h('div', { class: 'card' }, [
+    !v2 && unlocked && !state.unlockExiting ? h('div', { class: 'card' }, [
       h('div', { class: 'h2' }, ['5 quick wins prioritaires']),
       winItems.length
         ? h('ol', { class: 'list' }, winItems)
@@ -746,7 +756,7 @@ function renderResults() {
     ]) : null,
 
     /* CTA débloqué */
-    unlocked ? renderUnlockedCtas() : null,
+    unlocked && !state.unlockExiting ? renderUnlockedCtas() : null,
 
     renderPdfDialog(),
   ]);
@@ -966,7 +976,7 @@ function renderRoiResults() {
       ]),
       h('div', { class: 'btnrow' }, [
         h('button', { class: 'btn btn--primary', onClick: () => setView('qwf') }, ['Trouver mes 3 quick wins →']),
-        BOOKING_URL ? h('a', { class: 'btn btn--outline', href: BOOKING_URL, target: '_blank', rel: 'noreferrer' }, ['Réserver un appel découverte']) : null,
+        BOOKING_URL ? h('a', { class: 'btn btn--outline', href: BOOKING_URL, target: '_blank', rel: 'noreferrer' }, ['Entretien 30 min offert avec un consultant']) : null,
       ]),
       h('div', { class: 'btnrow', style: 'margin-top:6px' }, [
         h('button', { class: 'btn btn--outline', style: 'font-size:13px', onClick: () => setView('roi') }, ['← Modifier mes données']),
@@ -1125,7 +1135,7 @@ function renderQwfResults() {
         h('div', { class: 'qw-card__head-title' }, [qw.title]),
       ]),
       h('div', { class: 'qw-card__body' }, [
-        h('div', { class: 'qw-card__result' }, [`✓ ${qw.result}`]),
+        h('div', { class: 'qw-card__result' }, [qw.result]),
         h('div', { class: 'qw-section' }, [
           h('div', { class: 'qw-section__lbl' }, ['Ce qu\'on met en place']),
           h('div', { class: 'qw-section__val' }, [qw.setup]),
@@ -1156,12 +1166,12 @@ function renderQwfResults() {
     h('div', { class: 'card' }, [
       h('div', { class: 'h2' }, ['Et maintenant ?']),
       h('p', { class: 'lead', style: 'margin-bottom:16px' }, [
-        'Ces 3 quick wins sont un point de départ solide. Un appel découverte permet de valider les priorités et de cadrer le quick win n°1 en plan d\'action.',
+        'Ces 3 quick wins sont un point de départ solide. Un entretien offert avec un consultant permet de découvrir les opportunités et de cadrer le quick win n°1 en plan d\'action.',
       ]),
       h('div', { class: 'btnrow' }, [
         BOOKING_URL ? h('a', {
           class: 'btn btn--primary', href: BOOKING_URL, target: '_blank', rel: 'noreferrer',
-        }, ['📅\u00a0 Réserver un appel découverte — 30 min']) : null,
+        }, ['Découvrir les opportunités — Entretien 30 min offert']) : null,
         h('button', { class: 'btn btn--outline', onClick: () => setView('roi') }, ['Calculer le ROI →']),
       ]),
       h('div', { class: 'btnrow', style: 'margin-top:6px' }, [

+ 14 - 0
public/index.php

@@ -3,12 +3,26 @@ declare(strict_types=1);
 
 $root = dirname(__DIR__);
 require $root . '/config/config.loader.php';
+
+// Headers de sécurité
+header('X-Frame-Options: SAMEORIGIN');
+header('X-Content-Type-Options: nosniff');
+header('X-XSS-Protection: 1; mode=block');
+header('Referrer-Policy: strict-origin-when-cross-origin');
 $config = load_config($root);
 $bookingUrl = (string) ($config['booking_url'] ?? '');
 $devisUrl   = (string) ($config['devis_url'] ?? '');
 
 // CSRF : démarre une session pour le token (côté standalone)
 if (session_status() === PHP_SESSION_NONE) {
+    session_set_cookie_params([
+        'lifetime' => 0,
+        'path' => '/',
+        'domain' => '',
+        'secure' => (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') || ($_SERVER['SERVER_PORT'] ?? 0) == 443,
+        'httponly' => true,
+        'samesite' => 'Lax',
+    ]);
     session_start();
 }
 $csrfToken = $_SESSION['csrf_token'] ?? null;

+ 26 - 1
src/Analytics.php

@@ -27,7 +27,7 @@ final class Analytics
     }
 
     /**
-     * Incrémente un compteur global et optionnellement par pack.
+     * Incrémente un compteur global, par pack et par jour.
      */
     public function track(string $event, ?string $packId = null): void
     {
@@ -42,9 +42,12 @@ final class Analytics
         }
 
         $data = $this->readOrInit($fp);
+        $today = date('Y-m-d');
 
+        // Total global
         $data['total'][$event] = ($data['total'][$event] ?? 0) + 1;
 
+        // Par pack
         if ($packId !== null && $packId !== '') {
             if (!isset($data['by_pack'][$packId])) {
                 $data['by_pack'][$packId] = array_fill_keys(
@@ -55,6 +58,27 @@ final class Analytics
             $data['by_pack'][$packId][$event] = ($data['by_pack'][$packId][$event] ?? 0) + 1;
         }
 
+        // Par jour
+        if (!isset($data['by_day'][$today])) {
+            $data['by_day'][$today] = [
+                self::EVENT_DIA_INIT => 0,
+                self::EVENT_DIA_COMPLETED => 0,
+                self::EVENT_PDF_GENERATED => 0,
+                self::EVENT_EMAIL_CAPTURED => 0,
+            ];
+        }
+        $data['by_day'][$today][$event] = ($data['by_day'][$today][$event] ?? 0) + 1;
+
+        if ($packId !== null && $packId !== '') {
+            if (!isset($data['by_day'][$today]['by_pack'][$packId])) {
+                $data['by_day'][$today]['by_pack'][$packId] = array_fill_keys(
+                    [self::EVENT_DIA_INIT, self::EVENT_DIA_COMPLETED, self::EVENT_PDF_GENERATED, self::EVENT_EMAIL_CAPTURED],
+                    0
+                );
+            }
+            $data['by_day'][$today]['by_pack'][$packId][$event] = ($data['by_day'][$today]['by_pack'][$packId][$event] ?? 0) + 1;
+        }
+
         $data['last_updated'] = date('c');
 
         ftruncate($fp, 0);
@@ -109,6 +133,7 @@ final class Analytics
                 self::EVENT_EMAIL_CAPTURED => 0,
             ],
             'by_pack' => [],
+            'by_day' => [],
             'last_updated' => null,
         ];
     }

+ 102 - 0
src/InputValidator.php

@@ -0,0 +1,102 @@
+<?php
+
+declare(strict_types=1);
+
+namespace AuditExpress;
+
+/**
+ * Validation stricte des entrées API.
+ */
+final class InputValidator
+{
+    private const PACK_ID_PATTERN = '/^[a-zA-Z0-9_-]{1,64}$/';
+    private const OPTION_ID_PATTERN = '/^[a-zA-Z0-9_-]{1,64}$/';
+    private const MAX_ANSWERS = 25;
+    private const MAX_OPTIONAL_KEYS = 15;
+    private const MAX_OPTIONAL_VALUE_LENGTH = 256;
+    private const MAX_URL_LENGTH = 2048;
+
+    public static function sanitizePackId(string $packId): string
+    {
+        $packId = trim($packId);
+        if ($packId === '' || !preg_match(self::PACK_ID_PATTERN, $packId)) {
+            Http::json(['error' => 'pack_id invalide'], 400);
+            exit;
+        }
+        return $packId;
+    }
+
+    public static function validateAnswers(array $answers): array
+    {
+        if (count($answers) > self::MAX_ANSWERS) {
+            Http::json(['error' => 'Trop de réponses'], 400);
+            exit;
+        }
+        $sanitized = [];
+        foreach ($answers as $qId => $optId) {
+            if (!is_string($qId) || !is_string($optId)) {
+                Http::json(['error' => 'Format answers invalide'], 400);
+                exit;
+            }
+            $qId = trim($qId);
+            $optId = trim($optId);
+            if ($qId === '' || $optId === '' || strlen($qId) > 32 || strlen($optId) > 64) {
+                Http::json(['error' => 'Clé ou valeur answer invalide'], 400);
+                exit;
+            }
+            if (!preg_match('/^[a-zA-Z0-9_-]+$/', $qId) || !preg_match(self::OPTION_ID_PATTERN, $optId)) {
+                Http::json(['error' => 'Caractères invalides dans answers'], 400);
+                exit;
+            }
+            $sanitized[$qId] = $optId;
+        }
+        return $sanitized;
+    }
+
+    public static function validateOptional(array $optional): array
+    {
+        if (count($optional) > self::MAX_OPTIONAL_KEYS) {
+            Http::json(['error' => 'Trop de champs optionnels'], 400);
+            exit;
+        }
+        $sanitized = [];
+        foreach ($optional as $key => $value) {
+            if (!is_string($key) || strlen($key) > 64 || !preg_match('/^[a-zA-Z0-9_-]+$/', $key)) {
+                Http::json(['error' => 'Clé optional invalide'], 400);
+                exit;
+            }
+            if (is_string($value)) {
+                if (strlen($value) > self::MAX_OPTIONAL_VALUE_LENGTH) {
+                    Http::json(['error' => 'Valeur optional trop longue'], 400);
+                    exit;
+                }
+                $sanitized[$key] = $value;
+            } elseif (is_int($value) || is_float($value)) {
+                $sanitized[$key] = $value;
+            } elseif (is_bool($value)) {
+                $sanitized[$key] = $value;
+            } else {
+                Http::json(['error' => 'Type optional non autorisé'], 400);
+                exit;
+            }
+        }
+        return $sanitized;
+    }
+
+    public static function sanitizeUrl(string $url): string
+    {
+        $url = trim($url);
+        if ($url === '') {
+            return '';
+        }
+        if (strlen($url) > self::MAX_URL_LENGTH) {
+            Http::json(['error' => 'URL trop longue'], 400);
+            exit;
+        }
+        if (!filter_var($url, FILTER_VALIDATE_URL)) {
+            Http::json(['error' => 'URL invalide'], 400);
+            exit;
+        }
+        return $url;
+    }
+}

+ 28 - 0
src/Security.php

@@ -6,6 +6,34 @@ namespace AuditExpress;
 
 final class Security
 {
+    /**
+     * Envoie les headers de sécurité HTTP (à appeler en début de réponse).
+     */
+    public static function sendHeaders(): void
+    {
+        header('X-Frame-Options: SAMEORIGIN');
+        header('X-Content-Type-Options: nosniff');
+        header('X-XSS-Protection: 1; mode=block');
+        header('Referrer-Policy: strict-origin-when-cross-origin');
+        header('Permissions-Policy: geolocation=(), microphone=(), camera=()');
+        header('Content-Security-Policy: default-src \'self\'; script-src \'self\'; style-src \'self\' https://fonts.googleapis.com; font-src \'self\' https://fonts.gstatic.com; img-src \'self\' data:; frame-ancestors \'self\';');
+    }
+
+    /**
+     * Vérifie Content-Type pour les POST API (doit être application/json).
+     */
+    public static function requireJsonContentType(): void
+    {
+        if ($_SERVER['REQUEST_METHOD'] !== 'POST') {
+            return;
+        }
+        $ct = strtolower(trim((string) ($_SERVER['CONTENT_TYPE'] ?? '')));
+        if ($ct !== '' && $ct !== 'application/json' && !str_starts_with($ct, 'application/json;')) {
+            Http::json(['error' => 'Content-Type doit être application/json'], 415);
+            exit;
+        }
+    }
+
     /**
      * Démarre la session si besoin, valide le token CSRF pour les POST.
      * En cas d'échec : 403 et exit.

+ 29 - 0
templates/analytics.json

@@ -0,0 +1,29 @@
+{
+    "total": {
+        "dia_init": 10,
+        "dia_completed": 6,
+        "pdf_generated": 3,
+        "email_captured": 0
+    },
+    "by_pack": {
+        "process-generique-v2": {
+            "dia_init": 2,
+            "dia_completed": 0,
+            "pdf_generated": 0,
+            "email_captured": 0
+        },
+        "onboarding-v1": {
+            "dia_init": 7,
+            "dia_completed": 3,
+            "pdf_generated": 2,
+            "email_captured": 0
+        },
+        "process-generique": {
+            "dia_init": 1,
+            "dia_completed": 3,
+            "pdf_generated": 1,
+            "email_captured": 0
+        }
+    },
+    "last_updated": "2026-02-23T23:35:12+01:00"
+}

+ 16 - 13
templates/pdf_a4.php

@@ -25,17 +25,17 @@ $cost = $result['cost_hidden'] ?? null;
     <meta charset="utf-8" />
     <style>
       @page { size: A4; margin: 18mm 16mm; }
-      body { font-family: DejaVu Sans, Arial, sans-serif; color: #111827; font-size: 12px; }
-      h1 { font-size: 18px; margin: 0 0 4px 0; }
-      .muted { color: #6b7280; }
+      body { font-family: DejaVu Sans, Arial, sans-serif; color: #4b5563; font-size: 12px; background: #fff; }
+      h1 { font-size: 18px; margin: 0 0 4px 0; color: #374151; }
+      .muted { color: #9ca3af; }
       .row { display: block; }
-      .card { border: 1px solid #e5e7eb; border-radius: 10px; padding: 10px 12px; margin: 10px 0; }
+      .card { border: 1px solid #e5e7eb; border-radius: 10px; padding: 10px 12px; margin: 10px 0; background: #fafafa; }
       .score { display: table; width: 100%; }
       .score .left, .score .right { display: table-cell; vertical-align: top; }
-      .big { font-size: 28px; font-weight: 700; }
-      .badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-weight: 700; background: #f3f4f6; }
-      .bar { height: 8px; background: #f3f4f6; border-radius: 999px; overflow: hidden; }
-      .bar > span { display: block; height: 100%; background: #111827; }
+      .big { font-size: 28px; font-weight: 700; color: #374151; }
+      .badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-weight: 700; background: #f3f4f6; color: #4b5563; }
+      .bar { height: 8px; background: #e0f2fe; border-radius: 999px; overflow: hidden; }
+      .bar > span { display: block; height: 100%; background: #00BEF3; }
       .pillars { margin-top: 8px; }
       .pillar { margin: 7px 0; }
       .pillar .top { display: table; width: 100%; }
@@ -47,8 +47,10 @@ $cost = $result['cost_hidden'] ?? null;
       .two .col { display: table-cell; width: 50%; vertical-align: top; padding-right: 8px; }
       .two .col:last-child { padding-right: 0; padding-left: 8px; }
       .small { font-size: 11px; }
-      .cta { margin-top: 10px; }
-      .link { color: #111827; text-decoration: none; }
+      .cta { margin-top: 16px; padding: 14px 16px; background: #f0f9ff; border-radius: 8px; border-left: 4px solid #00BEF3; }
+      .cta-title { font-weight: 700; font-size: 13px; color: #2F506D; margin-bottom: 4px; }
+      .cta-desc { color: #6b7280; }
+      .link { color: #2F506D; text-decoration: none; font-weight: 600; }
       .hr { border-top: 1px solid #e5e7eb; margin: 10px 0; }
     </style>
   </head>
@@ -126,9 +128,10 @@ $cost = $result['cost_hidden'] ?? null;
     </div>
 
     <?php if ($bookingUrl !== ''): ?>
-      <div class="cta small">
-        Prochain pas : Revue express 20 minutes — <span class="muted">valider le diagnostic, prioriser, décider du plan minimal.</span><br/>
-        Lien : <span class="link"><?= $esc($bookingUrl) ?></span>
+      <div class="cta">
+        <div class="cta-title">Découvrir les opportunités suite à mon audit</div>
+        <div class="cta-desc small">Entretien de 30 min offert avec un consultant — prioriser vos opportunités et définir votre plan d'action.</div>
+        <div style="margin-top: 8px;">Réserver : <span class="link"><?= $esc($bookingUrl) ?></span></div>
       </div>
     <?php endif; ?>
   </body>