﻿Convert the following imperative loop-based data pipeline to a functional style using map, filter, reduce, and comprehensions. Preserve exact output.

`python
def process_sales(records):
    # Step 1: Filter out refunds
    valid = []
    for r in records:
        if r['amount'] > 0 and r['status'] != 'refunded':
            valid.append(r)
    
    # Step 2: Apply regional tax rates
    taxed = []
    tax_rates = {'US': 0.08, 'EU': 0.20, 'UK': 0.20, 'JP': 0.10}
    for r in valid:
        rate = tax_rates.get(r['region'], 0.15)
        total = r['amount'] * (1 + rate)
        taxed.append({**r, 'total': round(total, 2), 'tax_rate': rate})
    
    # Step 3: Group by region
    groups = {}
    for r in taxed:
        region = r['region']
        if region not in groups:
            groups[region] = []
        groups[region].append(r)
    
    # Step 4: Compute per-region totals
    summary = {}
    for region, items in groups.items():
        total = 0
        for item in items:
            total += item['total']
        summary[region] = {'count': len(items), 'total': round(total, 2)}
    
    return summary
`

Include tests with a sample dataset proving the functional version produces identical output.
