  # ── Detailed mode ──────────────────────────

  if $detailed; then
    log::section "WireGuard Clients"
    for conf in "${dir}"/*.conf; do
      [[ -f "$conf" ]] || continue
      local client_name
      client_name=$(basename "$conf" .conf)
      local ip="${p_ips[$client_name]}"
      local type
      type=$(cmd::list::_get_type "$ip")
      [[ -n "$filter_type" && "$type" != "$filter_type" ]] && continue
      cmd::list::show_client "$client_name"
    done
    return
  fi

  # ── Table view ─────────────────────────────

  log::section "WireGuard Clients"
  cmd::list::_render_header $has_groups

  for conf in "${dir}"/*.conf; do
    [[ -f "$conf" ]] || continue

    local client_name
    client_name=$(basename "$conf" .conf)

    local ip="${p_ips[$client_name]:-}"
    if [[ -z "$ip" ]]; then
      # Fallback for peers not in precomputed data
      ip=$(grep "^Address" "$conf" | awk '{print $3}' | cut -d'/' -f1)
    fi