false,'error'=>'auth_required'], 401); $stmt = $pdo->prepare("SELECT msg_unread, rdv_unread FROM push_badge_counters WHERE compte_id = ?"); $stmt->execute([$compteId]); $row = $stmt->fetch(PDO::FETCH_ASSOC) ?: ['msg_unread'=>0,'rdv_unread'=>0]; $msg = (int)($row['msg_unread'] ?? 0); $rdv = (int)($row['rdv_unread'] ?? 0); json_response([ 'ok' => true, 'msg_unread' => $msg, 'rdv_unread' => $rdv, 'total' => $msg + $rdv, ]);